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
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
36aeb74b5a
Fixed string literals in several unit tests (one test failing - changed it to TODO)
2012-11-29 21:07:52 +01:00
Daniel Marjamäki
68327b3c64
Uninitialized variables: Fixed TODO testcase
2012-11-29 18:41:48 +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
ddad2d45cf
CheckAssignIf: Add more testcases
2012-11-29 09:58:55 +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
Daniel Marjamäki
40719c56db
Fixed #4183 (false positive with method named c_str())
2012-11-28 08:48:48 +01:00
Daniel Marjamäki
fe8b6f0f95
astyle formatting
2012-11-28 08:48:00 +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
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
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
Edoardo Prezioso
9d0a295b85
Partially fixed #4288 (handle %var%|%num% patterns).
2012-11-17 20:51:18 +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
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
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
b15ff0c0e3
Fixed unit test failures caused by previous commit
2012-11-11 15:16:08 +01:00
PKEuS
17b720ef7d
Refactorization: Removed unnecessary code. Variable::typeStartToken() and Variable::typeEndToken() never point to "const".
...
Ran AStyle
2012-11-11 13:32:19 +01:00
PKEuS
704f285c90
Refactorized CheckStl::pushback():
...
- insert(), reserve() and clear() also invalidate iterators
- Properly support return and throw statements: Bailout after semicolon
- "." is also bad usage of invalid iterator.
2012-11-11 13:03:58 +01:00
Jose Roquette
e8d3a4300d
Fixed #4197 - False negative: invalidIterator2 not detected
2012-11-11 12:01:52 +01:00
PKEuS
4ee955fc8c
Improved CheckNullPointer::isPointerDeRef():
...
- Fixed #4240
- Added support for wstring/wchar_t
2012-11-10 19:53:20 +01:00
PKEuS
58fe7105f4
Remove C++11 keywords "override", "final" and "constexpr"
2012-11-09 19:53:10 +01:00
PKEuS
ce961578c2
New checks (inconclusive): Suspicious calculation with sizeof()
...
- Check for sizeof(ptr)/something: This indicates that programmer was trying to calculate array size, but sizeof(ptr) doesn't return the length of the memory area, but size of a pointer.
- Check for sizeof()*sizeof(): This indicates that programmer misunderstood what sizeof() does: It does return the length in bytes of the given variable, not e.g. the number of elements in an array.
2012-11-09 18:08:20 +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
PKEuS
aa2ad41629
Print message "Found calculation inside sizeof()" also for increment/decrement operator.
2012-11-06 11:39:47 -08:00
Zachary Blair
51d128c918
Fixed #2029 (free invalid address) by reporting previously-unreported errors as "inconclusive"
2012-11-05 21:02:51 -08:00
Edoardo Prezioso
1d4cacb3f1
Add more testcases for simplifyPlatformTypes:
...
these should cover up some unused branches.
2012-11-05 00:35:34 +01:00
Edoardo Prezioso
960dad0c21
Related to commit 71150e987ddf935237578aec3a4c6e02247882c2:
...
indent-separate test cases of the same kind.
2012-11-05 00:33:02 +01:00
Edoardo Prezioso
4d38dd4f2c
Add testcase for Tokenizer::simplifyVarDecl.
...
A branch was not executed in coverity, but there was a testcase which needed it.
2012-11-04 23:49:23 +01:00
Edoardo Prezioso
71150e987d
Add testcase related to commit 0d26a79f2c
.
...
cover up the case when there's at least a token before 'namespace %type% { }'.
2012-11-04 23:14:41 +01:00
Edoardo Prezioso
24bf6f99e1
More simplifyRedundantParenthesis changes:
...
simplify also '( var . var . ... . var )' parenthesis.
2012-11-04 22:38:18 +01:00
Edoardo Prezioso
87c931b74b
Add '%char%' as pattern to match in Token::Match.
...
All and only those single characters enclosed in "'" are accepted.
2012-11-04 16:58:18 +01:00
Andrew Martin
7c370ec873
Fixed #4305 (improve check: 'vector.size() < 1' should result in 'inefficient checking for '...' emptiness.')
2012-11-04 16:15:26 +01:00
PKEuS
4cd96158ae
Fixed parsing of "__asm__ volatile {""};"
2012-11-04 12:21:34 +01:00
PKEuS
b0c1c2c819
Don't suggest using initialization list for static variables ( #4332 )
2012-11-04 11:59:09 +01:00
PKEuS
e44ee280bc
Fixed handling of pointers to functions in namespace as template parameters ( #4172 )
2012-11-04 11:15:03 +01:00