Roman Zaytsev Borisovich
4610b135dc
Fixed #4694
2013-06-07 10:37:33 +04:00
Daniel Marjamäki
dec520c507
Tokenizer::simplifyEnum: Fixed false positives
2013-06-04 21:18:20 +02:00
Daniel Marjamäki
8b5792a0f8
Tokenizer::simplifyEnum: Fixed internalErrors when building with compiled patterns.
2013-06-04 18:57:46 +02:00
Daniel Marjamäki
fa1fd31667
Tokenizer::simplifyEnum: Improved handling of shadow variables
2013-06-04 06:51:01 +02:00
Daniel Marjamäki
8954cc0984
Fixed #4280 (Tokenizer::simplifyEnum: don't simplify shadow variables)
2013-06-03 19:18:51 +02:00
Daniel Marjamäki
ca632bd771
Fixed Cppcheck warning. Made method const
2013-06-01 14:35:21 +02:00
Frank Zingsheim
614a78084f
Fixed #4799 : Improved quickfix from 0943fecf03
...
(Segmentation fault in K&R simplification inside lambda expression)
2013-05-21 19:43:07 +02:00
Frank Zingsheim
0943fecf03
Fixed #4799 (Segmentation fault in K&R simplification inside lambda expression)
2013-05-14 20:56:31 +02:00
PKEuS
1903585ea3
Fixed bug in handling rvalue references: Scope has to be set everywhere. ( #4732 )
2013-05-14 01:43:32 -07:00
Frank Zingsheim
0076ebe08d
More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized)
...
Travis: Problems with matchcompiler.py
2013-05-12 11:19:10 +02:00
Frank Zingsheim
511f8a4c1f
More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized)
2013-05-12 10:19:43 +02:00
Daniel Marjamäki
cbe0a0825c
Fixed #4725 (Tokenizer: Replace block declaration (^{}) with asm())
2013-05-09 14:47:18 +02:00
Daniel Marjamäki
4659745106
Fixed #4786 (segfault with one LibreOffice file)
2013-05-06 16:56:34 +02:00
Zachary Blair
de8ee5b042
Fixed #4554 (false negative: buffer access out of bounds)
2013-05-02 21:50:48 -07:00
Daniel Marjamäki
9f8ce6f77f
Fixed #4729 (Tokenizer::setVarId: Varid not tracked properly after function declaration with 'shadow' parameter name)
2013-04-19 18:36:16 +02:00
PKEuS
cf5d8fa3df
Use Token::link() instead of Token::findClosingBracket() whereever possible
2013-04-15 13:48:28 -07:00
Daniel Marjamäki
a49fc57e00
Tokenizer: don't simplify 'a!=(b!=0)' to 'a!=b'. Ticket: #4697
2013-04-11 07:19:32 +02:00
XhmikosR
8ac9b8e7a9
remove duplicate ";" and fours dots
2013-04-09 17:49:09 +02:00
PKEuS
fd7c90f68d
Forgot to commit a file in eb2962792f
.
2013-04-04 10:57:35 -07:00
PKEuS
188096665c
Implemented support for rvalue references (C++11):
...
- Split up && when it is part of an rvalue reference declaration
- Added support into symbol database
- Current implementation sets Variable::isReference() to true also for rvalue references - they can probably be treated like normal references in many checks.
Changed behaviour of symbol database: Insert argument Variable of functions that are not implemented into SymbolDatabase::_variableList
2013-04-04 09:47:44 -07:00
Daniel Marjamäki
2d70af2c82
Reverted fix. It might be possible to make a better fix
2013-03-25 19:55:35 +01:00
Daniel Marjamäki
2b02013fa7
Fixed #4668 (False positive: uninitialized Variable after unknown macro)
2013-03-25 19:52:33 +01:00
Daniel Marjamäki
cc3139cf39
Tokenizer: Fixed 'variableScope' message.
2013-03-18 19:32:40 +01:00
Daniel Marjamäki
1b18bfc93c
Fixed #3585 (errors not recognized when class has extra specification)
2013-03-18 19:09:04 +01:00
Robert Reif
c600479c20
Symbol database: Tweaked debug printing of unknown types
2013-03-15 06:48:57 +01:00
PKEuS
796c3e101f
Implemented better fix for #4644
2013-03-12 08:05:03 -07:00
PKEuS
b3a9ac5c3b
Fixed #4644 : Don't assign varid to template parameter when 'typename' is used
2013-03-10 06:11:25 -07:00
Daniel Marjamäki
1f40af2ae2
Fixed #4637 (false positive: (error) Uninitialized member variable (missing function inlining))
2013-03-09 17:55:49 +01:00
PKEuS
99a73fe1d3
Don't assign a varid to a variadic function
2013-03-05 08:32:52 -08:00
PKEuS
d49f4a611a
Reduced code duplication in tokenizer
2013-03-02 09:19:53 -08:00
PKEuS
bf9aa102f2
Fixed possible nullptr dereference warning
2013-03-01 03:53:47 -08:00
PKEuS
0105f8223c
Simplified several Token::Match/simpleMatch calls when match string consists of a single pattern
...
Fixed two CheckInternal error messages
2013-03-01 03:42:04 -08:00
PKEuS
f899e6ca30
Changed behaviour of %op% pattern accordingly to changes to Token::isOp(). Added %cop% as replacement for old %op%
2013-03-01 02:43:59 -08:00
PKEuS
670c4de8a9
Changed behaviour of Token::is*Op() functions:
...
- Rename Token::isOp() to Token::isConstOp() (indicating that the operator does _not_ modify the input variables)
- Create new Token::isOp(), returning true also for ++, -- and assignment operators
- Make Token::isExtendedOp() returning also true for all assignment and ++/-- operators
2013-02-28 12:50:29 -08:00
Daniel Marjamäki
94da3bd57f
Fixed #4617 (False positive (style): noexcept for constructors)
2013-02-28 06:38:57 +01:00
Daniel Marjamäki
71b66209b7
Fixed #4300 (segmentation fault of cppcheck (invalid code))
2013-02-20 06:58:27 +01:00
Alexander Mai
b892d2e14c
Fixed #4300 (segmentation fault of cppcheck (invalid code))
2013-02-16 18:31:43 +01:00
Daniel Marjamki
635b7d5a0e
Fixed #4423 (Variable is assigned a value that is never used.)
2013-02-16 16:07:05 +01:00
Robert Reif
c5ee083c82
Fixed #4388 (false positive 'noConstructor' in 1.57)
2013-02-15 06:44:07 +01:00
Daniel Marjamäki
1e550f9fdf
Reverted fix for #4547 : It causes fp. See #4573
2013-02-12 16:13:08 +01:00
Ettl Martin
c192e4d669
spellfixes
2013-02-12 15:21:27 +01:00
Daniel Marjamäki
48e194dc56
Fixed #4572 (Analysis failed: sizeof final)
2013-02-10 23:54:15 +01:00
Stefan Naewe
46fb31f9e5
lib/tokenize: fix two compiler warnings about emtpy while loop
...
Fixes these warnings:
lib/tokenize.cpp: In member function ‘bool Tokenizer::tokenize(std::istream&, const char*, const std::string&)’:
lib/tokenize.cpp:1962: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
lib/tokenize.cpp: In member function ‘bool Tokenizer::tokenizeCondition(const std::string&)’:
lib/tokenize.cpp:2174: warning: suggest a space before ‘;’ or explicit braces around empty body in ‘while’ statement
Signed-off-by: Stefan Naewe <stefan.naewe@googlemail.com>
2013-02-08 12:15:42 +01:00
Daniel Marjamäki
463121be71
Fixed #4561 (cppcheck 1.58 crashes on empty signals block in headerfile)
2013-02-07 17:03:08 +01:00
Frank Zingsheim
5144307642
Raise syntax error for if-condition without parentheses according to #2518 #4171
2013-02-05 21:13:57 +01:00
Frank Zingsheim
b531195e08
Fixed #4547 (Improve check: Duplicate conditions in 'if' and related 'else { if'.)
...
Change tokenizer: "else if" -->> "else { if"
2013-02-04 21:12:12 +01:00
Frank Zingsheim
89560564ed
Refactoring: Add braces to an if-block, for-block, etc. in tokenizer.
...
Fixed #4521 (Tokenizer: Wrong braces for triple if else)
2013-02-02 16:01:34 +01:00
Robert Reif
ec1c86c152
Symbol database: more function/variable cleanup. Ticket: #4494
2013-01-31 06:41:18 +01:00
Robert Reif
859793731d
SymbolDatabase: Refactor findFunction handling. Ticket: #4494
2013-01-28 06:47:48 +01:00
Daniel Marjamäki
4391f0880f
Tokenizer: Add special tokenize method for the Preprocessor with only basic simplifications
2013-01-27 17:58:54 +01:00
Erik Lax
c2608108dd
Fixed #3928 (Tokenizer: Wrong simplification of inner if-else 'if (a) while (b) if (c) x; else y;')
2013-01-24 16:53:20 +01:00
Thomas Jarosch
f867d05d81
Use Token::simpleMatch() for simple pattern
...
Found by "internal" check
2013-01-21 10:14:39 +01:00
Daniel Marjamäki
67c9720299
Tokenizer: fixed simplification of static constants
2013-01-19 21:14:15 +01:00
Daniel Marjamki
6d5532980e
Tokenizer: Set proper variable ID when simplifying return statement. Ticket: #3500
2013-01-19 13:42:54 +01:00
Daniel Marjamki
bff6ed7af0
Fixed #3500 (false negative: (error) Returning pointer to local array variable)
2013-01-19 13:39:23 +01:00
Thomas Jarosch
e22b1f7740
Adapt Tokenizer::simplifyCallingConvention() and Tokenizer::simplifyKeyword() for the match compiler
...
This little change gives another 6% speed improvement on my box.
(tested with the testsuite and checking the 'rpm' codebase)
The profiler showed we were spending quite some time in
Tokenizer::simplifyCallingConvention(). The multi match
pattern in there is "complex", at least for the on-the-fly parser.
2013-01-16 20:33:01 +01:00
Andrew C. Martin
4a73c93750
Fix compiler warnings and comment/string typos
...
- fix g++ warning:
> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions
- fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522 )):
> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).
- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)
- fix word misspellings (mostly comments, a few output lines)
- Parenthesis => Parentheses (both variations were used in the codebase)
- fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():
```
- "An unsigned variable will never alwayw be positive so it is either pointless or "
+ "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Thomas Jarosch
f4227967ce
Simplify token string access
...
"internal" check reported:
[lib/tokenize.cpp:6671]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
2013-01-15 20:37:02 +01:00
Erik Lax
723d95597b
Fixed #4481 (Simplify %str% [ %num% ])
2013-01-13 20:52:38 +01:00
Daniel Marjamäki
2e56928834
Fixed #4482 (add test for UB due to usage of NULL in variadic functions)
2013-01-13 12:02:10 +01:00
Daniel Marjamäki
97b928b2bc
Fixed #4476 (Tokenizer: wrong simplification of static anonymous-type struct array declaration)
2013-01-10 18:24:01 +01:00
Daniel Marjamäki
eebfea2b23
Fixed #4381 (Inline type declaration on statics causes warning)
2013-01-07 19:20:15 +01:00
Edoardo Prezioso
4c73c29cdd
Revert partially the previous commit:
...
The two formulas are true iff 2n = 2 <=> n = 1.
2013-01-05 17:31:08 +01:00
Edoardo Prezioso
c465cf4ab4
Related to the previous commit:
...
Use bit operator '&' instead of modulo operator '%'.
2013-01-04 14:20:15 +01:00
Edoardo Prezioso
1c0c0471df
Simplify some generalized math formulas:
...
Now the 'sin^2+cos^2=1' and the 'sinh^2-cosh^2=-1' code can handle, for example: sin^4+cos^4=1, sinh^10-cosh^10=-1.
Also, the arguments can be also multitokens, so that it's possible to simplify, for example: 'sin^2(k())+cos^2(k())=1'.
2013-01-04 13:06:09 +01:00
Edoardo Prezioso
5485e6866f
Fixed wrong tokenization of some math formulas:
...
The two formulas: sin^2+cos^2 = 1 and sinh^2-cosh^2 = -1 are true iff the two arguments are the same.
2013-01-04 11:28:01 +01:00
Thomas Jarosch
7f0bc73e8e
Simple constification (needed by the match compiler)
2013-01-04 03:17:52 +01:00
Edoardo Prezioso
1affb0c96b
Use more Effective C++ code style in Token class:
...
1)The non-const version of Token::tokAt and Token::linkAt now will use a combination of const_cast and static_cast to remove duplicate code.
2)The non-const versions of Token::find(simple)match are added, in order to avoid the usage of const_cast outside the Token code.
3)As a consequence of 2), an useless const_cast applied to a call of Token::findsimplematch in Tokenizer code is removed.
2013-01-03 22:35:34 +01:00
Daniel Marjamäki
a3ee72a51d
Fixed #4409 (Cppcheck 1.58 dev hangs when checking mhz.c of lmbench3 (attached code))
2013-01-03 19:14:44 +01:00
Daniel Marjamäki
ded0d50591
Tokenizer: add reportProgress to Tokenizer::simplifyKnownVariables. Ticket: #4409
2013-01-03 15:22:06 +01:00
Reijo Tomperi
5d5f7085bf
Updating year 2012 -> 2013 to .cpp and .h files and man page.
2013-01-01 18:29:08 +02:00
Edoardo Prezioso
6612952dd4
Use 'simple' matching with normal patterns.
2012-12-31 13:30:06 +01:00
Daniel Marjamäki
4378357d7e
Fixed #4372 (Tokenizer misidentifying which function a variable belongs to)
2012-12-29 21:07:41 +01:00
Daniel Marjamäki
4d085dd3fd
Fixed #4316 (False positive: (constStatement) Redundant code)
2012-12-29 17:13:06 +01:00
Daniel Marjamäki
9af51a75e6
Tokenizer::setVarId: Proper handling of 'void f(struct foobar). Ticket: #4444 '
2012-12-29 08:54:39 +01:00
Daniel Marjamäki
bf9b900c30
Tokenizer::setVarId: Fixed problem with initializer lists ( #4436 )
2012-12-27 18:15:00 +01:00
Robert Reif
3e6d601982
Fixed #4436 (FP: Member variable is not initialized in the constructor. (with two parameters))
2012-12-27 17:15:38 +01:00
acm4me
7da155c8ba
Support for Sun Studio C++ compiler
2012-12-27 11:51:12 +01:00
Daniel Marjamäki
b3301a9ef9
Fixed #4433 (Wrong array size for string with \0)
2012-12-26 12:10:09 +01:00
Daniel Marjamäki
db2a129557
Tokenizer: Improved handling of '\0' in strings
2012-12-25 08:56:12 +01:00
Daniel Marjamäki
56b7670468
Tokenizer::setVarId: Fixed problem in initializer list when parameter and class member has same name
2012-12-23 19:55:09 +01:00
Robert Reif
dae232015e
Fixed #4430 (FP: Member variable is not initialized in the constructor.)
2012-12-23 08:04:44 +01:00
Daniel Marjamäki
47e1a571f7
Tokenizer: Fixed goto problems
2012-12-22 19:28:53 +01:00
Daniel Marjamäki
d3f5fd4e59
Tokenizer: Fixed Token::Match pattern
2012-12-10 20:38:07 +01:00
Daniel Marjamäki
df03e3a8d2
Fixed #4395 (Wrong simplification of known variables in nested assignment)
2012-12-10 06:08:33 +01:00
Daniel Marjamäki
c91250cd6e
Fixed #4277 (duplicateExpression finds false positive for floats in a union as a member of a class)
2012-12-03 17:05:37 +01:00
Robert Reif
b216639069
Fixed #4378 (simplifyEnum doesn't simplify enum type within open and close parenthisis)
2012-12-02 07:22:55 +01:00
Edoardo Prezioso
5101f3c029
Use the new pattern: '%comp%' where possible.
...
Change also the description comment of the Token::Match by adding the new pattern and the forgotten '%op%'.
2012-12-01 01:31:35 +01:00
Edoardo Prezioso
f3782935c2
Tokenizer: improve code and change name of +- concatenation function.
2012-12-01 00:43:23 +01:00
Edoardo Prezioso
3d1d983251
Tokenizer: simplify also __FILE__ together with __LINE__.
2012-12-01 00:37:10 +01:00
Daniel Marjamäki
672831f41a
Fixed #4187 (False positive: Variable inside a lambda is reported as uninitialized)
2012-11-30 10:30:26 +01:00
Edoardo Prezioso
a219ed313b
Fixed again #2963 (FP: Typedef names considered duplicate because __LINE__ not expanded).
...
It is caused by a regression introduced with commit 75fbe310ff
. Add also a TODO in the non working detection inside TestSimplifyTokens::simplifyTypedef98.
2012-11-30 00:00:44 +01:00
Edoardo Prezioso
e214d94589
Tokenizer: use list.back() when we start the loop backwards.
2012-11-29 17:42:31 +01:00
Daniel Marjamäki
3372657a07
Fixed #4227 (False positive: Comparison of a boolean with an integer (double dResult=false))
2012-11-29 09:29:25 +01:00
Daniel Marjamäki
509721d6d0
Fixed #4304 (False positive during an array declaration)
2012-11-29 08:44:12 +01:00
Edoardo Prezioso
6b40d93f6f
Try to fix Visual Studio compiler warning.
...
Related to commit 119ab519a4
.
2012-11-28 12:06:27 +01:00
Daniel Marjamäki
5d1b4e6dbb
Tokenizer: Remove redundant '+'
2012-11-28 07:09:56 +01:00
Edoardo Prezioso
f3029ce6bb
Fixed a bug in Tokenizer::simplifyKnownVariables.
...
When we find constant variables, check if there's a usage of its reference in the code (for example: don't simplify 'f(&x)' to 'f(&100)').
2012-11-26 17:06:52 +01:00
Edoardo Prezioso
76639578ad
Improve Tokenizer::simplifyFuncInWhile.
...
Differentiate between the new cppcheck:r variables by appending a number to the name, like 'cppcheck:r1', 'cppcheck:r2' and more.
2012-11-26 02:19:35 +01:00
Edoardo Prezioso
5fb2115e9d
Fixed a bug in Tokenizer::concatenateNegativeNumber.
...
The first negative number inside a '{}' list was not simplified correctly.
2012-11-20 19:14:58 +01:00
Edoardo Prezioso
c5e5ee9ed2
Adapt %var%|%num% changes with Tokenizer, final.
2012-11-17 22:44:31 +01:00
Edoardo Prezioso
1bf003389e
Adapt %var%|%num% changes with Tokenizer, part 4.
2012-11-17 22:43:42 +01:00
Edoardo Prezioso
f8e4af9ce2
Adapt %var%|%num% changes with Tokenizer, part 3.
2012-11-17 22:42:24 +01:00
Edoardo Prezioso
bd63db62af
Adapt %var%|%num% changes with Tokenizer, part 2.
2012-11-17 22:40:44 +01:00
Edoardo Prezioso
2b4215ea7a
Adapt %var%|%num% changes with Tokenizer, part 1.
2012-11-17 22:39:02 +01:00
PKEuS
e5ebb49312
Added support for sizeof(wchar_t). Improved <Windows.h> type testing for Win64 platform.
2012-11-11 16:16:17 +01:00
PKEuS
5555e055f1
Refactorized <Windows.h> type support:
...
- Changed some more Win32 simplifications of wide-character/string types to use wchar_t
- Added support for LPWSTR
- Fixed test case to ensure that simplifications also work for Win32W
2012-11-11 15:40:06 +01:00
PKEuS
4ea2df8671
Changed handling of type wchar_t:
...
- Don't simplify wchar_t to unsigned short on Win32 platforms to ensure that checking of strings and nullpointer dereferences works.
- Added it as standard type
2012-11-11 14:47:16 +01:00
PKEuS
58fe7105f4
Remove C++11 keywords "override", "final" and "constexpr"
2012-11-09 19:53:10 +01:00
Edoardo Prezioso
119ab519a4
Support GNU extension of '?:' operator:
...
"x ? : y" is equivalent to "x ? x : y". I found a lot of code with this extension, probably we should warn a user to not use this.
2012-11-08 17:49:43 +01:00
Edoardo Prezioso
9556634ee7
Revert 1c0617c504
.
2012-11-07 18:34:25 +01:00
Edoardo Prezioso
061a5e1ad7
Run astyle.
2012-11-07 02:24:46 +01:00
Edoardo Prezioso
1c0617c504
change some Token::Match patterns used in code:
...
replace '||' with '%oror%', where possible.
2012-11-07 02:23:09 +01:00
Edoardo Prezioso
63307c5db2
Remove the now useless fix for #4245 .
...
The fix for #4276 made completely useless that branch, so remove it until someone shows a testcase which breaks this commit.
2012-11-05 00:13:04 +01:00
Edoardo Prezioso
7293fcfa9b
Remove redundant code in simplifyVarDecl:
...
TokenList::insertTokens adds the missing braces links when needed. The function does not add links to '<>', though, hence the TODO.
2012-11-05 00:12:22 +01:00
Edoardo Prezioso
4e25ffa948
Remove unexecuted branch in duplicateTypedef:
...
If the code is intended to be used, please revert + provide a valid testcase.
2012-11-04 23:03:14 +01:00
Edoardo Prezioso
333711ae4f
Remove dead branch in simplifySizeof:
...
the code in that branch won't ever be executed because simplifySizeOf is called after arraySize, which adds the string length inside the '[]' parenthesis.
2012-11-04 22:41:38 +01:00
Edoardo Prezioso
24bf6f99e1
More simplifyRedundantParenthesis changes:
...
simplify also '( var . var . ... . var )' parenthesis.
2012-11-04 22:38:18 +01:00
Edoardo Prezioso
b6b359d1c6
Tokenizer::simplifyRedundantParenthesis refactor:
...
Change useless 'while' to 'if' where possible; unify duplicate 'delete [| ]| var' handling code.
2012-11-04 20:51:40 +01:00
Edoardo Prezioso
93f1fed205
Tokenizer '?:' handling code refactorization:
...
move '=|,|(|[|{|}|;|case|return (%bool%) ?' code handling from simplifyConditionOperator in simplifyConstTernaryOp in order to use a more efficient code, thus to remove code duplication.
2012-11-04 19:18:11 +01:00
Edoardo Prezioso
18e1eb7c70
Add missing hunks in the previous commit.
2012-11-04 19:08:54 +01:00
Edoardo Prezioso
c54eafdf69
Use '%char%' matching in the tokenizer file.
2012-11-04 17:22:38 +01:00
PKEuS
1c399c86ca
Improved fix for #4311 ; Added back support for "this." (fixes again #4291 )
...
Added TODO unit test for missing varid.
2012-11-03 21:16:05 +01:00
Daniel Marjamäki
6c2563c467
Fixed #4311 (False positive: warning (selfAssignment): Redundant assignment of 'm_bar' to itself.
2012-11-03 13:18:43 +01:00
Edoardo Prezioso
c9e0089546
Change Tokenizer member function name.
...
From 'simplifyQuestionMark' to 'simplifyConstTernaryOp' (the older name was not clear). Adjusted the doxy comment.
2012-11-02 14:57:12 +01:00
Edoardo Prezioso
8271d63744
Forgot to fix another clang analyzer message.
...
I don't understand why here there is a loop 'break' after a token stepping forward and a bool assignment.
2012-10-24 15:30:40 +02:00
Edoardo Prezioso
11b0047063
Fix some clang analyzer messages.
...
CheckMemoryLeak: two redundant assignments, should be clarified;
TemplateSimplifier: same;
Tokenizer: same.
2012-10-24 03:17:56 +02:00
Edoardo Prezioso
f0f216390e
Fixed #4276 (segmentation fault of cppcheck (invalid code))
2012-10-20 21:40:51 +02:00
Edoardo Prezioso
4ddcde1e6f
CheckMemoryLeak: add '?1:0' to clarify the value of the argument to 'deleteNext'; Tokenize.cpp: in simplifyCompoundAssignment(), remove ':' odd code used to fix a weird test case ('case' code not inside a function body), remove useless 'tok->next() != NULL' check (already true by previous condition); in simplifyConditionOperator(), handle better the parenthesis skipping code and remove useless ')'check; in simplifyQuestionMark(), remove useless 'tok->tokAt(-2)' check (Token::Match returns false if the token is NULL), add more patterns to Token::Match to handle more test cases; in simplifyBitFields(), add 'const' to 'offset' bool. RedirectOutputError: style nitpick change to declaration of a pointer.
2012-10-19 14:19:52 +02:00
Baris Demiray
d84d360afc
Fixed #4291 (Variable ID is not set when variable is accessed through 'this')
2012-10-19 06:18:13 +02:00
Edoardo Prezioso
61365ea0e5
Fixed #4293 (FP: Variable is not simplified, causing a false positive).
2012-10-17 00:25:20 +02:00
Daniel Marjamäki
562291477d
Fixed #4226 (False positive: Uninitialized variable (problem with namespace ::rtl))
2012-10-15 06:53:38 +02:00
Edoardo Prezioso
64b4960acc
Tokenizer: simplify GCC '({ %var%|%num% ; })' to '%var%|%num%'.
...
Remove useless brace around condition in simplifyFlowControl.
2012-10-13 13:24:41 +02:00
Edoardo Prezioso
1951d1cdc5
Tokenizer: improve the new 'skipTernaryOp' function by supporting GCC '{(var|num;)}' statement expression extension; improve 'Tokenizer::simplifyQuestionMark' by supporting simplification with 'case' before ternary operation, using skipTernaryOp to get colon and, most importantly, supporting indented '?:' operations.
2012-10-13 02:32:43 +02:00
Edoardo Prezioso
d4a3c1617a
Fixed: Tokenizer::simplifyLabelCaseDefault was careless with '?:' operator near 'case' adding the semicolon after the ternary colon.
2012-10-12 20:51:13 +02:00
Edoardo Prezioso
c42facae1f
Tokenizer::simplifyLabelsCaseDefault: jump '(' and '[' parenthesis.
...
TestTokenizer: add simple test cases with some correct and wrong syntax concerning 'case'.
2012-10-12 17:08:21 +02:00
Edoardo Prezioso
1e4b080737
Fixed #4278 (syntax error).
2012-10-11 13:35:20 +02:00
Edoardo Prezioso
e62e03ab31
Fixed #4267 (segmentation fault of cppcheck (invalid code)).
2012-10-09 20:44:30 +02:00
Edoardo Prezioso
3703e71f82
Related to previous commit: if the '{}' parenthesis are found after 'case', don't skip them after continuing to the main loop or it will cause indentlevel mismatching.
2012-10-09 18:24:21 +02:00
Edoardo Prezioso
9668508b32
Tokenizer::simplifyLabelsCaseDefault:
...
use more efficient check for 'const' token;
remove redundant NULL checks thanks to commit e3bbcf501f
.
2012-10-09 17:52:20 +02:00
Ettl Martin
2cf75d5339
astyle run
2012-10-08 21:50:21 +02:00
Ettl Martin
0879bb5825
#4245 : Segmentation fault (invalid code); Applied patch from amai.
2012-10-08 21:49:25 +02:00
Daniel Marjamäki
6a37942431
Fixed #3935 (False report for accessing array out of bounds after casting to short)
2012-10-07 18:38:05 +02:00
Daniel Marjamäki
4c1abde48e
Reverted 107b3b44
. Write syntax error for 'if MACRO()'. We can't know if MACRO() is supposed to be used in the condition or if it is some annotation that should be removed. Ticket #4171
2012-10-06 19:12:39 +02:00
Edoardo Prezioso
e3bbcf501f
Fixed #4234 (segmentation fault of cppcheck in Tokenizer::simplifyFlowControl() (invalid code))
2012-10-06 13:37:44 +02:00
Daniel Marjamäki
c2b61030a8
Fixed #4254 (Tokenizer::simplifyIfAssign: varids not preserved)
2012-10-06 12:49:24 +02:00
Daniel Marjamäki
2f069f550f
Removed Java/C# handling
2012-10-02 18:44:36 +02:00
Daniel Marjamäki
9a462d8a0a
Fixed #4225 (False positive: uninitialized variable (assignemnt in ternary expression with cast))
2012-09-30 18:49:25 +02:00
PKEuS
c4b881f844
Refactorizations in tokenize.cpp and testsimplifytokens.cpp:
...
- Avoid const_cast in testsimplifytokens.cpp
- Removed redundant null-check (VS11 code analysis)
- Fixed MSVC compiler warning
- Replaced some indentation counters
2012-09-29 14:10:41 +02:00
Daniel Marjamäki
ff4f8b58f3
Disable checkComparisonOfFuncReturningBool check because of false warnings. Ticket #2617
2012-09-28 18:51:10 +02:00
Alexander Mai
074b7781b2
Fixed #4239 (segmentation fault of cppcheck (invalid code))
2012-09-27 06:35:36 +02:00
Mohit Mate
9e297c95f2
Fixed #2617 (improve check: comparing boolean with '<')
2012-09-26 18:18:36 +02:00
Daniel Marjamäki
2e3a7db4eb
Fixed #4115 (Incorrect uninitialized variable error message with realloc macro)
2012-09-22 18:41:33 +02:00
Daniel Marjamäki
6c25f3662e
Tokenizer::simplifyEnum: Don't simplify enums in function heads. Ticket #3953
2012-09-21 16:17:20 +02:00
Edoardo Prezioso
8e1e8525a3
Partial rewrite of Tokenizer::simplifyComma:
...
skip '= { .. }' where possible;
hence remove '%num% after comma' check because it's redundant now;
replace round braces counter method with faster 'link skip';
if 'endAt' is 'NULL' after finding the ';' token, exit the function;
hence remove redundant 'tok != NULL' check after simplifying 'return' code.
2012-09-20 21:45:16 +02:00
Edoardo Prezioso
eb5a61edfe
Tokenizer: some changes to the code:
...
be sure '?:' ternary operation has whitespaces around the operators;
remove useless loop to get the 6 next tokens, use tokAt(6);
add '?1:0' to bool values when doing a sum with them.
remove useless 'enum' pattern checking in code executed after simplifyEnum;
after being sure the 'tok' is a standard type, begin the loop with the token next to it;
it's possible to remove two tokens before the current one without moving this.
2012-09-20 01:07:50 +02:00
Daniel Marjamäki
aa3cdc6b6f
Fixed #3565 (Variable hides enumerator (attached code example))
2012-09-19 19:19:13 +02:00
Ettl Martin
3f89e38275
fixed #4195 segmentation fault of cppcheck (invalid code); Added a testcase
2012-09-19 10:37:30 +02:00
Daniel Marjamäki
07d2935e81
Fixed #4164 (False positive: (error) Uninitialized variable: min)
2012-09-18 20:55:37 +02:00
Daniel Marjamäki
1f7d9ca22c
Fixed #4211 (Tokenizer::simplifyVarDecl: Improved handling of >> in templates)
2012-09-17 19:45:42 +02:00
Daniel Marjamäki
a99515ca91
Fixed #3933 (Negative array index issue (because sizeof struct is assumed to be 100))
2012-09-16 08:20:43 +02:00
Daniel Marjamäki
f1ebd99dc2
Fixed #3507 (false positive: comma-separated statements before return in methods)
2012-09-15 11:55:08 +02:00
Daniel Marjamäki
9f2e1ab98d
Fixed #4048 (Tokenizer::simplifyVarDecl: Improve handling of 'a::b const * p = 0;')
2012-09-14 16:46:45 +02:00
Daniel Marjamäki
19fdbf0fd0
Fixed #4185 (Incorrect 'Found duplicate if expressions' for strings with high bit set)
2012-09-13 16:44:10 +02:00
PKEuS
22a8e3f4e6
Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better.
2012-09-11 18:03:47 +02:00
Daniel Marjamäki
64faa780fe
Fixed #4087 (div by zero check is invalid for floats)
2012-09-11 16:50:42 +02:00
PKEuS
50f9dd52ab
Used enum instead of string in implementation for '--language='.
2012-09-11 08:53:27 +02:00
PKEuS
5940d77a62
Disabled C++ specific checks and simplifications when checking a C or non-C++ file.
2012-09-10 19:02:32 +02:00
PKEuS
87131f6105
Added new cmdline option --language= (alias of GCC-like -x) to enforce a specific language. Valid values: c, c++, java, c#. ( #3994 )
2012-09-10 18:51:32 +02:00
PKEuS
88f9e9991d
Fixed compiler warning ( #4136 )
2012-09-10 17:43:19 +02:00
PKEuS
ce9f6bdb56
Fixed segfault #4182
2012-09-10 17:33:52 +02:00
Daniel Marjamäki
cf8ac78069
Fixed test assertion failure caused by me
2012-09-09 18:33:41 +02:00
PKEuS
d44f10fc01
Fixed createLinks2() on this code: nvwa<(x > y)>
2012-09-09 15:31:23 +02:00
Daniel Marjamäki
511c5a62e7
Fixed #4141 (Crash when parsing divide by zero.)
2012-09-09 12:38:15 +02:00
Daniel Marjamäki
107b3b4401
Fixed #4171 (don't choke when parentheses are missing from macros)
2012-09-09 09:48:07 +02:00
Daniel Marjamäki
0c55d5cfa7
Fixed #4002 (syntax error for 'X( typedef, Y)')
2012-09-09 09:14:46 +02:00
Daniel Marjamäki
69a0062177
Tokenizer: don't crash for 'int'. Ralated with tickets #2978 and #3304
2012-09-08 20:59:25 +02:00
Daniel Marjamäki
853c6522dc
Tokenizer::simplifyEnum: Readded refactorings. Tickets 3949,3950,4025,4053 has been solved as far as I see.
2012-09-08 12:42:24 +02:00
PKEuS
78d49ea4b8
Fixed #3732 - properly simplify struct declarations:
...
- Don't replace "{ {" if they are part of an initialization
- Properly split struct definition, variable declaration and variable initialization.
Used std::stack instead of std::list
2012-09-08 10:51:31 +02:00
Daniel Marjamäki
a39b58046f
Tokenizer: Improved simplification of 'a?(1):b'
2012-09-08 10:45:00 +02:00
Daniel Marjamäki
2722f53edd
Fixed #4142 (false positive (error) Uninitialized variable: b)
2012-09-08 10:15:37 +02:00
Daniel Marjamäki
2ce5cb3075
Tokenizer: Simplified parentheses better in such pattern: 'git merge --squash 4142 operator git merge --squash 4142 (%var%|)) ( %num%|%bool% ) %op%|;|,|)'
2012-09-08 07:01:35 +02:00
PKEuS
a4b5824dec
New internal check: checkRedundantNextPrevious().
...
Fixed findings by new internal check
2012-09-07 12:36:40 +02:00
PKEuS
e4a693eaab
Refactorizations:
...
- Fixed several findings of CheckInternal.
- Removed some debug code from CheckOther::checkRedundantAssignment().
2012-09-07 11:59:20 +02:00
PKEuS
489df29346
Moved Tokenizer::typeConstToConstType() to Tokenizer::simplifyConst()
2012-09-07 11:41:41 +02:00
Daniel Marjamäki
1c7027140a
Tokenizer: Improved simplifyRedundantParanthesis
2012-09-06 16:16:29 +02:00
PKEuS
8c70778b70
Refactorization: Fixed several messages when self-checking cppcheck
2012-09-04 15:29:51 +02:00
anuraggarg011
913670d254
Fixed #3304 (simple cases)
2012-09-04 13:41:14 +02:00
Edoardo Prezioso
6fd60eebb0
Tokenizer: added a workaround for #3690 (Support MSVC's 'for each').
2012-09-03 20:23:53 +02:00
Edoardo Prezioso
6100776847
Tokenizer: remove unneeded initialization of strings explicitely with "".
2012-09-03 20:22:27 +02:00
anuraggarg011
bf11248a09
Fixed #1620 (tokenizer: simplify well known math functions)
2012-09-03 18:51:15 +02:00
Edoardo Prezioso
804fbe3f8f
Tokenizer::simplifyEmptyNamespaces: remove useless condition.
...
Token::deleteThis handles the !tok->next situation well.
2012-09-03 14:22:31 +02:00
PKEuS
c20adf91bf
Moved simplification of wide character string literals (L"foo") to tokenize(). Token::isLong flag used to indicate that string is a wchar_t literal.
2012-09-01 13:12:47 +02:00
Daniel Marjamäki
15bc552b37
Tokenizer: Fixed possible NULL pointer dereference
2012-09-01 10:11:18 +02:00
Daniel Marjamäki
a8d419820b
Tokenizer: removed unused variable
2012-09-01 09:57:48 +02:00
Edoardo Prezioso
0d26a79f2c
Tokenizer::simplifyEmptyNamespaces: new function.
...
It removes from the token list, if found, the following tokens: 'namespace %var% { }'. It won't involve C code.
2012-08-28 22:40:25 +02:00
PKEuS
bbce79d7b3
Small refactorization: Handle std::map more efficient in setVarIdStructMembers()
2012-08-28 12:57:11 +02:00
PKEuS
ea85dd305a
Fixed #4086 : Set varId in initialization list.
2012-08-28 12:44:40 +02:00
PKEuS
4bab7f0ee2
Removed unused and obsolete functions Tokenizer::getParameterName() and Tokenizer::getNameForFunctionParams()
2012-08-26 16:53:40 +02:00
PKEuS
662b0d2dbe
Simplify 0[foo] to *(foo) ( fixes #4083 )
2012-08-26 10:03:05 +02:00
Daniel Marjamäki
f127728582
Enable --std=c11 and --std=c++11 by default
2012-08-25 21:57:45 +02:00
Daniel Marjamäki
985ac662ee
Fixed #4035 (False positive: Memory leak: pTempFile)
2012-08-25 12:00:25 +02:00
Daniel Marjamäki
5051837c1a
Reverted last commit. I pushed it by mistake.
2012-08-25 11:00:51 +02:00
Daniel Marjamäki
5e1ccfaf90
Fixed #4035 (False positive: Memory leak: pTempFile)
2012-08-25 10:55:20 +02:00
PKEuS
f238f3fad5
Support sizeof in preprocessor directives
...
Applied "patch" provided by michaeln123 in #4071
2012-08-22 17:28:06 +02:00
PKEuS
43e01a2b1a
Ran AStyle, removed redundant tokAt(0)
2012-08-22 16:51:44 +02:00
SAndeep
0600b0be8f
sprintf changes
2012-08-22 16:46:14 +02:00
Daniel Marjamäki
9ffc7f4c2d
Fixed #3964 (False positive: Expressions in array declarations are not simplified 'char mac[17+1];')
2012-08-20 18:10:32 +02:00
Daniel Marjamäki
7786e12ba2
Fixed #3922 (false positive: (error) null pointer dereference)
2012-08-18 22:11:48 +02:00
Daniel Marjamäki
6a5cc4727d
Fixed #4019 (false positive: (style) Variable 'dest' is assigned a value that is never used)
2012-08-17 16:37:25 +02:00
PKEuS
35d94c26d5
Changed creation of SymbolDatabase. Database always created after Tokenizer::tokenize() and Tokenizer::simplifyTokenList() instead of on-demand creation by Tokenizer::getSymbolDatabase.
...
-> With Token::scope() it is possible to access the symboldatabase without having to call getSymbolDatabase(). The change increases safety because it is guaranteed that the database is available in all checks, even if the specific check doesn't call getSymbolDatabase
- Tokenizer::_symbolDatabase does no longer have to be mutable -> Increased const correctness
The change above required two additional changes:
- A bug causing a debug message was fixed in the symboldatabase that became visible in the test suite by the change above.
- Simplify expressions like "struct struct Foo" which might be result of typedef instanciation.
2012-08-12 03:01:24 -07:00
PKEuS
2ab33ef21b
Added Pointer to enclosing scope to class Token (Only available when symboldatabase is created).
2012-08-11 11:47:11 -07:00
PKEuS
45bad7d1b2
Refactorized tokenizer:
...
- Don't run setVarId() twice, keep old varId's while/after simplifyTokenList
-> Modified two test cases in testmemleak.cpp. I consider this to be safe. Feel free to investigate this.
- Fixed two nullpointer issues shown by cppcheck
Ran Astyle on teststl.cpp
2012-08-10 09:31:22 -07:00
Edoardo Prezioso
1d8240356b
Really fixed #4024 . Now the simplification won't be done on non-executive scopes.
2012-08-10 17:43:09 +02:00
Daniel Marjamäki
0254344df5
Tokenizer::simplifyEnum: Reverted refactorings/optimisations as there were regressions ( #3949 , #3950 , #4025 )
2012-08-10 14:06:24 +02:00
Edoardo Prezioso
d68d035e22
Tokenizer::simplifyFlowControl: separated the 'throw' case because it's not a reserved keyword in C, hence the function shouldn't simplify in C source files.
2012-08-07 19:38:51 +02:00
Daniel Marjamäki
735c0f5f6b
Fixed #3963 (segmentation fault of cppcheck (invalid typedef code))
2012-08-07 16:39:41 +02:00
Edoardo Prezioso
9e916eec66
Fixed #4024 (Tokenizer::simplifyFlowControl removes pieces of code inside a class if 'exit' is a member function).
2012-08-07 10:59:27 +02:00
Daniel Marjamäki
5ee7758a83
Fixed #4015 (segmentation fault of cppcheck (enum))
2012-08-06 16:21:21 +02:00
Daniel Marjamäki
25fd841b5d
Tokenizer: removed redundant include
2012-08-05 16:06:20 +02:00
PKEuS
452f95cea0
More robust template detection in clarifyCondition check based on Token::link. ( #3818 )
...
Create links between < and > only on non-C code.
AStyle fix
2012-08-02 04:03:01 -07:00
PKEuS
c8e40773f1
Fixed cppcheck messagesa about functions that can be const/static:
...
- Made Tokenizer::getErrorMessages static - Avoids creation of unnecessary instance of Tokenizer
- Changed Tokenizer::removeExceptionSpecifications to common style for simplification functions. In contrast to the comment, this function doesn't call itself recursivly - fixed comment.
- Made Tokenizer::IsScopeNoReturn static.
2012-08-01 12:04:47 -07:00
Ettl Martin
98d608231d
spelling fixes
2012-07-31 23:35:56 +02:00
PKEuS
1ec3c9f634
Fixed hang in libreoffice code (simplification of K&R style function declaration tried to simplify a function with parameters without name whose implementation contained "; {".
...
Test cases of this simplification only need basic simplifications done in Tokenizer::tokenize
2012-07-29 06:11:48 -07:00
Daniel Marjamäki
1a6f7ea9a0
Fixed #3998 (Tokenizer::simplifyEnum: wrong handling of expressions => crash)
2012-07-26 11:12:28 +02:00
Ville Skyttä
7ab2f6a9fa
Spelling fixes.
2012-07-21 18:11:20 +02:00
Daniel Marjamäki
a96ec0ad46
Fixed #3804 (False positive: Member not initialized (simplifyTokenList removes const on pointers))
2012-07-16 07:28:59 +02:00
PKEuS
e9182f1fcc
Implemented support for 'using namespace std;': Add std:: prefix to names that are known to be in std namespace. Simplify namespace (std::)tr1:: if C++11 flag is set.
2012-07-15 02:05:19 -07:00
Edoardo Prezioso
fae40c4782
Change every C version of 'size_t' to C++ 'std::size_t'.
2012-07-09 13:30:18 +02:00
Daniel Marjamäki
bf98e952c1
Fixed #3927 (false positive: (error) Uninitialized variable: new)
2012-07-08 13:59:00 +02:00
Daniel Marjamäki
49198f52c4
Fixed #3934 (False positive for logical conjunction with enum and define)
2012-07-07 15:34:26 +02:00
Daniel Marjamäki
543ccdd4c0
Removed simplifyEnum timer that I didn't intend to include in the previous commit.
2012-07-06 15:48:51 +02:00
Daniel Marjamäki
6ad5fc8456
Refactoring Tokenizer::simplifyEnum. The enum handling is now somewhat faster since all enum values of a enum are simplified at the same time.
2012-07-06 15:43:50 +02:00
Thomas Sondergaard
f72ddbb2e9
Fixed #3912 (Analysis failed)
2012-07-03 06:34:14 +02:00
Daniel Marjamäki
bb9f114d84
Fixed #3924 (False positive: Uninitialized variable (const pointer))
2012-06-30 12:12:36 +02:00
Daniel Marjamäki
8af044255d
Tokenizer: Added new function isFunctionParameterPassedByValue that check if a parameter is passed by value
2012-06-24 13:40:09 +02:00
Daniel Marjamäki
edea4ef131
Refactoring: Renamed CheckNullPointer::isPointer to Token::isUpperCaseName
2012-06-21 19:00:53 +02:00
Daniel Marjamäki
974225626d
Fixed #3901 (false positive: (error) Uninitialized variable: temp)
2012-06-19 20:07:39 +02:00
Daniel Marjamäki
4b6e1c6946
Fixed #3855 (false positive: (error) Instance of 'locale' object destroyed immediately)
2012-06-13 19:21:20 +02:00
August Sodora
90f92250dd
Fixed #3618 (segmentation fault of cppcheck)
2012-06-12 21:07:17 +02:00
Daniel Marjamäki
54a66391d8
Fixed #3750 (false positive: C-style pointer casting)
2012-06-12 18:45:31 +02:00
seb777
5b763a9f0a
Fixed #3579 (object destroyed immediately:False positive & negative)
2012-06-10 21:52:32 +02:00
August Sodora
e146591b5d
Fixed #3544 (segmentation fault of cppcheck)
2012-06-02 16:15:12 +02:00
PKEuS
9dc8123151
Refactorizations:
...
- Use const string references instead of const strings copies when possible
- Fixed cppcheck warning about postfix increment in CheckIO
- Use symbolDatabase to detect pointers in CheckOther::checkAssignBoolToPointer
2012-05-25 03:09:41 -07:00
Daniel Marjamäki
5b0551054a
varid: better templates handling
2012-05-22 18:58:13 +02:00
PKEuS
a9cfe2814a
Made some functions const according to cppcheck results
2012-05-17 02:54:17 -07:00
PKEuS
4bb2a1b27b
Made some functions static or const according to cppcheck results
2012-05-17 01:33:24 -07:00
Daniel Marjamäki
505aa6e4cc
TestSimplifyTokens::enum29: Fixed crash
2012-05-16 21:39:26 +02:00
Daniel Marjamäki
0bb0fdedc2
Fixed #3747 (False 'boolean result in bitwise' message with 'mask' enums)
2012-05-16 18:48:33 +02:00
PKEuS
0157f937bf
Fixed #3760 : Added explicit to C++ keyword list in setVarId
...
Made some constant arrays static
2012-05-16 01:59:52 -07:00
Daniel Marjamäki
4ae8e4f382
Tokenizer::setVarId: Minor fix of sizeof handling
2012-05-15 18:40:24 +02:00
Daniel Marjamäki
a0e5fad6a9
Fixed #3776 (Tokenizer::setVarId: No varid set when unknown macro is used before variable declaration)
2012-05-15 07:17:31 +02:00
Daniel Marjamäki
62f9875f90
Fixed #3799 (Bug: Function gets varId)
2012-05-13 07:55:35 +02:00
Daniel Marjamäki
8236cd4d50
Fixed #3785 (false positive: (style) Variable 'dinv' is assigned a value that is never used)
2012-05-08 12:04:54 -07:00
Daniel Marjamäki
99a29eafc9
Fixed #3691 (Tokenizer::simplifyKnownVariables: continue in switch)
2012-05-07 12:11:23 -07:00
PKEuS
28f6e2f4a9
Resolved cyclic dependency between Tokenizer and TemplateSimplifier
2012-05-06 01:38:55 -07:00
PKEuS
f105bf75a6
Refactorizations in ErrorLogger:
...
- Implemented constructor for ErrorLogger::ErrorMessage that takes a callstack of tokens -> replaced duplicate code in Check and Tokenizer
- Implemented strigify() for ErrorLogger::ErrorMessage::FileLocation to replace two identical implementations of it.
2012-05-06 01:17:15 -07:00
PKEuS
1a5fbd61d2
Splitted class TokenList from Tokenizer
2012-05-05 09:33:26 -07:00
Daniel Marjamäki
11614021e8
Fixed #3768 (Tokenizer::setVarId: no varid for 'std::string' parameter after a 'std::string' parameter called 'string')
2012-05-05 09:59:43 +02:00
Daniel Marjamäki
119b24e363
Fixed #3756 (False positive: uninitvar in malloc)
2012-05-03 19:10:51 +02:00
Edoardo Prezioso
5d6a257c86
Fixed #3770 (Segmentation fault in K&R function parameters simplification)
2012-04-29 12:58:52 +02:00
Daniel Marjamäki
df6f88b4fe
Fixed #3755 (Tokenizer::setVarId: improve varid inside class for struct/class variables)
2012-04-26 18:38:47 +02:00
PKEuS
1e708e10d0
Fixed #2875
2012-04-26 10:35:40 +02:00
Daniel Marjamäki
f84a4344ae
Fixed #3754 (Tokenizer::simplifyKnownVariables: wrong for loop simplification)
2012-04-25 19:23:17 +02:00
Edoardo Prezioso
08ae15e42d
Fixed the grammar in some reportError messages in the Tokenizer class, thanks to kimmov's suggestion.
2012-04-25 15:09:46 +02:00
PKEuS
dd5e9aa454
Make use of recently implemented Token::type() functionality
2012-04-25 09:56:07 +02:00
PKEuS
e0a3ca0845
Refactorizations in class Token: changed handling of different types of tokens.
...
- Replace _isNumber, _isName, _isBoolean attributes by a single _type attribute (enum Token::Type), because not two of the old booleans could be true at the same time.
-> Add support for lots of different other kinds of tokens. (More precise checking of token type possible)
-> Replaced instant checking of type for Operators, etc. by a value calculated at creation time. (Faster checking)
2012-04-23 21:05:26 +02:00
PKEuS
8cbed66089
Changed relationship between templatesimplifier and tokenizer:
...
- Pass a tokenizer to templatesimplifier to reduce code duplication (Make use of Tokenizer::reportError; remove redundant TemplateSimplifier::addtoken2) and amount of arguments passed to functions
Removed ctor and dtor implementation from TemplateSimplifier: This class shouldn't be instanciated.
2012-04-23 20:45:36 +02:00
Daniel Marjamäki
6ae135124e
Tokenizer::setVarId: better handling of initializer lists
2012-04-23 18:26:27 +02:00
Daniel Marjamäki
706631f527
Fixed #3748 (False positive out of bounds with postincrement)
2012-04-22 12:22:49 +02:00
Daniel Marjamäki
d5f6cfcfa8
Tokenizer: Use new setVarId function. Removed the old one.
2012-04-22 11:36:31 +02:00
PKEuS
3d2b5a30fe
Implemented generic reportError functions in tokenizer (similar to Check::reportError) to reduce code duplication
2012-04-22 11:28:46 +02:00
Daniel Marjamäki
8c8c9d5e5b
Tokenizer::setVarIdNew: don't treat '(sizeof *p)' as a variable declaration
2012-04-22 11:06:56 +02:00
Daniel Marjamäki
d63093d9bb
Tokenizer::setVarIdNew: Fixed issue found through TestUnusedVar tests
2012-04-22 10:59:58 +02:00
Daniel Marjamäki
871823e9c6
Tokenizer::setVarId: fixed problem for classes with inheritance
2012-04-22 10:38:06 +02:00
Daniel Marjamäki
e39b7f1bfd
Tokenizer::setVarIdNew: Fixed TestTokenizer::varid38
2012-04-22 10:24:19 +02:00
Daniel Marjamäki
e745d971c8
Tokenizer::setVarIdNew: Fixed test case TestTokenizer::varid27
2012-04-22 10:19:29 +02:00
Daniel Marjamäki
b4ffb5e0cf
Tokenizer::setVarIdNew: Fixed TestTokenizer::varid39 test case
2012-04-22 09:51:00 +02:00
Daniel Marjamäki
ed6673a9aa
Tokenizer::setVarIdNew: Fixed TestTokenizer::varid44
2012-04-22 09:18:27 +02:00
Daniel Marjamäki
71050bc586
Tokenizer::setVarIdNew: fixed TestTokenizer::varid_in_class2 test case
2012-04-22 08:51:19 +02:00
Edoardo Prezioso
be5a61b794
Fixed ticket #3721 (false positive: syntax error on valid C code ( K&R function style )).
2012-04-22 01:56:40 +02:00
Daniel Marjamäki
6d9b4a8032
Tokenizer::setVarIdNew: Fixed TestTokenizer::varid_operator test case
2012-04-21 19:29:24 +02:00
Daniel Marjamäki
1cc256339c
Tokenizer::setVarIdNew: Fixed TestTokenizer::varid19 test case
2012-04-21 18:22:18 +02:00
Daniel Marjamäki
42a95c9202
Tokenizer::setVarIdNew: Fixed segfault when using new setVarId on invalid code
2012-04-21 18:02:26 +02:00
Daniel Marjamäki
bd60dd46d0
Tokenizer::setVarIdNew: handle special case when there is an unknown macro. Ticket #2638
2012-04-21 17:57:20 +02:00
Daniel Marjamäki
b86295fbcd
Tokenizer::setVarIdNew: Improved C++ handling. All the TestTokenizer::varidclass?? tests pass now.
2012-04-21 17:25:44 +02:00
Daniel Marjamäki
6071a5afc3
Tokenizer::setVarIdNew: Fixed varidclass9
2012-04-21 13:39:43 +02:00
Daniel Marjamäki
85b470c41b
Tokenizer::setVarIdNew: Better C++ handling (varidclass5 and varidclass13)
2012-04-21 13:11:30 +02:00
Daniel Marjamäki
1492d8990f
Tokenizer::setVarId: better C++ handling
2012-04-19 20:58:52 +02:00
PKEuS
6a37c36ee8
Fixed #3741
...
Removed redundant nullpointer check (cppcheck catch)
2012-04-18 16:35:04 +02:00
PKEuS
cb064dc20e
Implemented generic mechanism for '<'-'>' "linkage" before link() works (Taken from Scope::findClosingBracket, but C++11 right angle bracket support added): Token::findClosingBracket
...
-> Replaced several indendation-counting mechanisms in tokenize.cpp
Fixed build failure in checkclass.cpp
2012-04-18 16:02:03 +02:00
Daniel Marjamäki
bb4184ca03
Tokenizer::setVarIdNew: better handling of class variables
2012-04-17 19:06:00 +02:00
Ettl Martin
09d41b2f84
ticket 2669: added todo testcase
2012-04-17 00:31:32 +02:00
PKEuS
bac8ed7127
Refactorized stringification of tokens:
...
- Function that stringifies one token: Token::stringify()
- Functions that stringify a list of tokens: Token::stringifyList()
-- Single and powerful "base" function, used by several "light" functions
Refactorized
- testtokenize.cpp and testsimplifytokens.cpp: Use improved stringification functions instead of several local implementations
- Avoided redundand creation of std::string when using TestTokenizer::tokenizeAndStringify and in cmdlineparser.cpp
2012-04-16 19:51:07 +02:00
Daniel Marjamäki
5ad1840120
Tokenizer::setVarIdNew: Copied code from Tokenizer::setVarIdOld that sets varid in member functions
2012-04-16 19:48:58 +02:00
PKEuS
1c3c94dc67
New simplification: Remove 'extern "C"' from C++ code.
...
Refactorization in cppcheck.cpp: Catch exception as const reference instead of non-const reference.
2012-04-16 16:25:04 +02:00
PKEuS
66d947675f
Refactorizations in tokenize.cpp:
...
- Removed a few indendation counters
- Removed unnecessary pattern "- >" because this code is simplified to "." before.
- Generalized pattern of simplifyFunctionReturn()
- Simplified removeExeptionSpecification, no longer recursive (-> #3385 )
2012-04-16 10:49:09 +02:00
Daniel Marjamäki
8f866c6e4c
Tokenizer::setVarIdNew: handle c++ keyword 'using'
2012-04-15 18:29:35 +02:00
Daniel Marjamäki
c58d02f146
Tokenizer::setVarIdNew: in C code, allow that variable declaration starts with delete and throw
2012-04-15 18:23:12 +02:00
Daniel Marjamäki
b0dc708b4d
Tokenizer::setVarIdNew: variable declarations dont start with NOT/goto/return/delete/etc
2012-04-15 18:02:49 +02:00