5370 Commits

Author SHA1 Message Date
Daniel Marjamäki
1e2fb4f1a4 Unused var: Limit bailout for foreach loops. Only bailout if name contains 'foreach' or 'for_each'. Only bailout variables that are used more than once in the body. Ticket: #4155 2012-12-17 18:19:05 +01:00
Daniel Marjamäki
72ea94bf75 Fixed #4155 (false positive: Variable is assigned a value that is never used (inside BOOST_FOREACH loop)) 2012-12-17 17:07:56 +01:00
Daniel Marjamäki
a84d21f271 CheckMemoryLeaksInFunction: Fixed problems with catch and function calls. Ticket: #4405 2012-12-16 18:06:40 +01:00
Daniel Marjamäki
bca7927913 AST: generate tree from bottom and upwards 2012-12-16 11:48:19 +01:00
Daniel Marjamäki
aad3a041ad AST: Handle function calls 2012-12-16 10:06:55 +01:00
Daniel Marjamäki
1ad9c933ec AST: Improved handling of unary operators 2012-12-16 08:41:04 +01:00
Robert Reif
6732f05b95 Fixed #4404 (Forward declared class cause false style warning about missing constructor) 2012-12-16 07:18:03 +01:00
Daniel Marjamäki
fa8e5cd7d8 AST: Simple AST. Not used in the clients. Only part of the testing for now. 2012-12-15 20:21:09 +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
Robert Reif
5a7ede2563 Fixed #4391 (False positive: ctor not detected after variable declaration) 2012-12-10 06:01:29 +01:00
Frank Zingsheim
327db15284 Fix #4045: memory leak not reported after usage of " + p[]" 2012-12-09 08:59:21 +01:00
Daniel Marjamäki
927a6e4794 Obsolete functions: removed 'ctime' warning. The function is obsolete but the message don't point out a good replacement nor where it's documented that this function is obsolete 2012-12-09 09:35:57 +01:00
PKEuS
410c0f98d9 Refactorized CheckObsoleteFunctions:
- Speedup checkobsoletefunctions by using symboldatabase and by not calling SymbolDatabase::findFunctionByToken() for each function call.
-> Benchmark (SQlite amalgamation):
    CheckObsoleteFunctions::runSimplifiedChecks(): 9s -> 0,016s (562%, 4% on entire runtime)
- Fixed false negative when passing function result as parameter
2012-12-08 02:46:30 -08:00
PKEuS
578e582987 Fixed regression #4368. 2012-12-08 00:26:10 -08:00
PKEuS
068c695bd1 Fixed false positive when ternary operator is used: case A&&B?B:A: 2012-12-07 12:44:30 -08:00
PKEuS
0ac4c3baf4 New check: Find suspicious case labels like 'case A||B:' 2012-12-07 12:27:32 -08:00
PKEuS
65db8b8b9f Fixed #4229 2012-12-07 11:45:20 -08:00
Edoardo Prezioso
0273c183a7 Run astyle and update the translation files.
I believe we need a hook script because else everytime we change a file we have to make a new commit to fix the discrepancies problems.
2012-12-07 01:49:51 +01:00
Robert Reif
63b585424d Fixed #4386 (False positive: ctor not detected) 2012-12-05 20:31:17 +01:00
Frank Zingsheim
b99d3f0767 Style change: Fixed #4369 (false positive: Variable 'i' is assigned a value that is never used)
based on aebdb3769fc0c3606480116202c9fbf542e8347f
due to comment in aebdb3769f
2012-12-05 20:18:14 +01:00
Frank Zingsheim
aebdb3769f Fixed #4369 (false positive: Variable 'i' is assigned a value that is never used) 2012-12-04 21:39:51 +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
Daniel Marjamäki
b08ba5b575 Preprocessor: Refactoring previous fix 2012-12-02 20:17:25 +01:00
Daniel Marjamäki
cb06d07ae7 Fixed #4351 (Escaped whitespace gives wrong error) 2012-12-02 18:04:19 +01:00
Daniel Marjamäki
15ef6bb32f Fixed #4382 (Use of alloca causes VLA recommendation in C++) 2012-12-02 11:39:26 +01:00
Daniel Marjamäki
bf91454136 Fixed #4224 (False positive: Comparison of a boolean with an integer (neglecting a cast)) 2012-12-02 08:34:30 +01:00
Daniel Marjamäki
dba51c906e cleanup: removed redundant insideLoop assignment in checkunusedvar. Thank you zingsheim for the suggestion 2012-12-02 07:28:05 +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
45a16baaa0 Token: try to improve speed of multicompare macro. 2012-12-01 23:58:01 +01:00
Edoardo Prezioso
f6c23fa1e7 runastyle and fix checkInternal messages. 2012-12-01 03:17:55 +01:00
Edoardo Prezioso
9ce6630b28 Add some unused private copy ctors and operator=.
In Token and in Check classes, GCC -Weffc++ reports that it's better to override the copy constructors and the assignment operator to avoid problems with copied objects which could have the same pointers, hence with double frees, when we delete one of these pointers in the copied and in the original object.
2012-12-01 02:17:46 +01:00
Edoardo Prezioso
f42ab9871d Fix build breakage in recent commits. 2012-12-01 02:02:45 +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
aeb4531a58 Token::Match: add a new pattern: '%comp%'.
Token::Match returns true if the token is a comparison operator. It's equivalent to matching '<|<=|==|!=|>=|>' and the tests show that the new pattern speeds up the program execution. Added the new pattern in CheckInternal (and also reordered the %cmd% lists) and in TestToken.
2012-12-01 00:55:24 +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
45b77554ea Fixed #4308 (C++11 raw string literals not parsed correctly) 2012-11-30 13:46:46 +01:00
PKEuS
bcb4410dae Fixed invalid function in symboldatabase causing endless recursion (VS10 warning) by const_cast 2012-11-30 02:25:40 -08: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
Daniel Marjamäki
031adef6ea Array index checking: Fixed TODO comment (false negatives when using ?:) 2012-11-30 09:01:15 +01:00
Daniel Marjamäki
1c4afbce8c Cleanup: Removed += and -= patterns from the checks. These should be simplified. 2012-11-30 07:08:16 +01:00
Daniel Marjamäki
82223227bd Uninitialized variables: Fixed false negative in new checking when using while loops 2012-11-30 06:30:04 +01:00
Robert Reif
35c2b8058d Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails) 2012-11-30 06:03:58 +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 75fbe310fffe781f8c788d28b76ccd538765181e. Add also a TODO in the non working detection inside TestSimplifyTokens::simplifyTypedef98.
2012-11-30 00:00:44 +01:00
PKEuS
0db2675912 Removed unnecessary pattern "const|" - typeStartToken() never points to "const" 2012-11-29 10:47:52 -08:00
Daniel Marjamäki
68327b3c64 Uninitialized variables: Fixed TODO testcase 2012-11-29 18:41:48 +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
233b7ddb4c Fixed #4323 (False Positive: Null pointer dereference) 2012-11-29 10:32:34 +01:00
Daniel Marjamäki
7760a92930 CheckAssignIf: Better handling of various expressions in assignments 2012-11-29 10:19:52 +01:00