Daniel Marjamäki
9e58714bb1
Cppcheck: Only show 'Too many configurations' and 'Interrupted checking' information messages when information severity is enabled
2012-12-23 08:23:52 +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
7f6a10599b
Fixed #4262 (Small Request/Suggestion for checks on array size of args (bounty offer))
2012-12-22 09:23:34 +01:00
Daniel Marjamäki
365a260ddc
Fixed #4398 (False negative: out of bounds (for loop))
2012-12-22 08:00:05 +01:00
Robert Reif
80848c6e0e
Fixed #4383 (Improve check: uninitialized member variable not detected when initialization is not proper)
2012-12-21 19:36:45 +01:00
Daniel Marjamäki
2050cd71db
Uninitialized variables: Better testing of function handling
2012-12-21 19:32:56 +01:00
Daniel Marjamäki
dc6aa92f3b
Uninitialized variables: warn about structs in C code
2012-12-21 18:50:38 +01:00
Daniel Marjamäki
cf84c211ed
Uninitialized variables: Improved handling of function calls
2012-12-21 17:04:15 +01:00
Daniel Marjamäki
415ee977d8
Uninitialized variables : fixed false positives when passing address of pointer to function.
2012-12-21 16:57:49 +01:00
Daniel Marjamäki
7e8019e474
Fixed #4403 (False positive 'Conversion of string literal <string> to bool always evaluates to true.' with BOOST_ASSERT)
2012-12-20 20:48:48 +01:00
Daniel Marjamäki
ccdea4dc2b
Uninitialized variables: Improved checking of functions
2012-12-20 19:45:30 +01:00
PKEuS
d82048f5f5
Fixed compiler error in VS10
2012-12-20 04:03:36 -08:00
Robert Reif
bb2a15c140
Symbol database: Better handling of 'using namespace N;'. Ticket: #4412
2012-12-20 06:53:04 +01:00
Daniel Marjamäki
3913fd8398
Fixed #4320 (False positives 'unassignedVariable' and 'uninitvar')
2012-12-18 19:02:30 +01:00
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 aebdb3769f
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 75fbe310ff
. 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
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
Daniel Marjamäki
ba3833c692
Fixed #3678 (stlcstrReturn for classes which don't provide a std::string)
2012-11-29 07:10:56 +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
40719c56db
Fixed #4183 (false positive with method named c_str())
2012-11-28 08:48:48 +01:00
Daniel Marjamäki
7d94230329
Fixed #4079 (#if condition does not evaluate numbers with sign)
2012-11-28 07:33:24 +01:00
Daniel Marjamäki
5d1b4e6dbb
Tokenizer: Remove redundant '+'
2012-11-28 07:09:56 +01:00
Frank Zingsheim
f23ce8d254
Fixed #4180 (false positive: (style) Variable is assigned a value that is never used (inside loop))
2012-11-28 06:11:33 +01:00
Daniel Marjamäki
4e92f8dfcd
Fixed #4295 (False positive: Expression '(X & 0xFF00000000000000LL)==0xa00000000000000' always evaluates to false (64-bit value))
2012-11-27 17:37:49 +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
Robert Reif
bbc1747919
Fixed #3702 (False negative: fail to detect constructor implementation with slightly different (irrelevant) signatures)
2012-11-26 16:34:44 +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
9dae536ce3
Little tweaks to Token::Match code.
2012-11-25 15:20:50 +01:00
Edoardo Prezioso
0f4cdc9e87
More CheckNullPointer speed ups, related to #4266 .
2012-11-25 14:55:31 +01:00
Edoardo Prezioso
927d3e8ce2
Speed up the new CheckNullPointer checking.
...
Related to commit 095824373a
, using the new precomputed vector of functions, related to ticket #4266 .
2012-11-25 12:40:14 +01:00
Zachary Blair
095824373a
Fixed #3302 (new check: nullpointer dereference)
2012-11-20 23:56:17 -08: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
Robert Reif
ffe657128f
Fixed #4364 (Segfault in CheckStl::stlBoundries)
2012-11-20 06:12:14 +01:00
Edoardo Prezioso
e0c10efdce
Add a 'prepend' bool option to Token::InsertToken.
...
If it's true, add a new token before this. Except when this is the first one in the list, because there's not a way to update the list.front (I noticed some Token functions can potentially delete the list.front(), I don't know which effects does it cause).
2012-11-20 02:58:19 +01:00
Edoardo Prezioso
fdeacbaec6
Enhance style and code to Token::Match function.
2012-11-20 00:19:57 +01:00
Edoardo Prezioso
39bd31b44c
Improve comment style in token.cpp.
2012-11-19 16:30:07 +01:00
Daniel Marjamäki
382e1e95ef
Fixed #4168 (False positive: (style) struct or union member 'super::x' is never used)
2012-11-18 15:24:47 +01:00
Daniel Marjamäki
7ecfb189a2
astyle formatting
2012-11-18 15:04:45 +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
Edoardo Prezioso
9d0a295b85
Partially fixed #4288 (handle %var%|%num% patterns).
2012-11-17 20:51:18 +01:00
Robert Reif
6b8e83a181
speed up checks by caching commonly looked up stuff in the symbol database (checkother, checkstl, checkunusedvar). Ticket: #4266
2012-11-16 06:50:49 +01:00
Daniel Marjamäki
a2febc49d6
Fixed #4318 (False positive: 'unreadVariable')
2012-11-15 08:36:43 +01:00
Daniel Marjamäki
79cd601ae7
Fixed #4356 (False positive at variable initialization)
2012-11-15 07:48:45 +01:00
Robert Reif
09eed80938
speed up checks by caching commonly looked up stuff in the symbol database (CheckOther). Ticket: #4266
2012-11-15 07:11:45 +01:00
Robert Reif
04d04c33c2
speed up checks by caching commonly looked up stuff in the symbol database (CheckOther). Ticket #4266
2012-11-14 18:12:33 +01:00
Robert Reif
6578b78077
speed up checks by caching commonly looked up stuff in the symbol database (checkIncorrectLogicOperator). Ticket: #4266 .
2012-11-13 18:30:33 +01:00