Thomas Jarosch
4708be09f5
Fixed #4444 (segmentation fault)
2012-12-28 11:15:18 +01:00
Robert Reif
bd2f59bdf0
Fixed #4442 (crash of cppcheck while scanning gcc-testsuite (invalid code))
2012-12-28 08:36:20 +01:00
Daniel Marjamäki
b914466285
Uninitialized variables: fixed false positives by bailing out when variable is conditionally initialized and then there is a conditional return.
2012-12-27 18:45:00 +01:00
Daniel Marjamäki
bf9b900c30
Tokenizer::setVarId: Fixed problem with initializer lists ( #4436 )
2012-12-27 18:15:00 +01:00
Robert Reif
a43ae677d7
Fixed #4419 (False positive: Class does not have a constructor)
2012-12-27 17:21:30 +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
Simon Kagstrom
ef28bde3e4
Fixed #4408 (Force inclusion of files (a la -include /.../ in GCC))
2012-12-27 16:52:31 +01:00
Daniel Marjamäki
2e0a9c4b33
Fixed #4434 (false positive: (style) Mismatching assignment and comparison, comparison 'pen!=-1' is always true.)
2012-12-27 15:40:00 +01:00
PKEuS
735069e3a7
Fixed unit tests
2012-12-26 12:50:59 +01:00
Daniel Marjamäki
b3301a9ef9
Fixed #4433 (Wrong array size for string with \0)
2012-12-26 12:10:09 +01:00
Robert Reif
ce380301fd
Fixed #4432 (Crash on parsing PHP interpreter)
2012-12-26 08:29:10 +01:00
Daniel Marjamäki
f127d56719
Null pointer: Fixed FP when there are 'return p?p->x:0;'
2012-12-25 14:23:50 +01:00
Daniel Marjamäki
f16c30248a
Uninitialized variables: fixed FP when there are function calls where type* is converted to unknown_type
2012-12-25 14:05:29 +01:00
Daniel Marjamäki
f381058293
Uninitialized variables: fixed FP when there are suspicious function calls where type** is converted to type*
2012-12-25 13:58:15 +01:00
Daniel Marjamäki
bcc5a82b1d
Uninitialized variables: Fixed FP when using typeof on uninitialized data in return statement
2012-12-25 13:31:54 +01:00
Daniel Marjamäki
db123c2c9b
Fixed #4431 (FP: Erroneous 'Ineffective call of function empty()' in ?: test)
2012-12-25 12:50:38 +01:00
Daniel Marjamäki
299c1bb208
Uninitialized variables: handle unsimplified labels better
2012-12-25 10:37:21 +01:00
Daniel Marjamäki
db2a129557
Tokenizer: Improved handling of '\0' in strings
2012-12-25 08:56:12 +01:00
Daniel Marjamäki
83da4125e3
Uninitialized variables: Better value flow analysis. Fixed false positives.
2012-12-24 19:11:13 +01:00
Daniel Marjamäki
b39afb2cf9
Revert "Fixed #4419 (False positive: Class does not have a constructor)"
...
This reverts commit 9a79961b6c
.
There is a segmentation fault when checking lib/preprocessor.cpp
2012-12-24 07:46:55 +01:00
Robert Reif
9a79961b6c
Fixed #4419 (False positive: Class does not have a constructor)
2012-12-24 06:46:30 +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
Daniel Marjamäki
0b4da3d5cd
Uninitialized variables: Fixed false positives when variable x is given a nonzero value when variable y is uninitialized.
2012-12-23 16:27:04 +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
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
8e1e894dff
AST: Added some tests to ensure operator precedence is handled properly
2012-12-16 11:56:23 +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
PKEuS
c4821db796
Updated VS9 solution with qmake ( #4397 ).
2012-12-13 20:38:10 +01:00
Daniel Marjamäki
88c1e42bdb
VS2010: Added cli/cppcheckexecutor.cpp to testrunner project
2012-12-13 18:43:45 +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
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
PKEuS
4737966caf
Unit test cleanup: Removed some empty lines and whitespaces before \n.
2012-12-06 10:19:22 -08:00
Robert Reif
63b585424d
Fixed #4386 (False positive: ctor not detected)
2012-12-05 20:31:17 +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
Frank Zingsheim
590704afb4
Missing semicolon in "do {} while();" tests of testunusedvar.cpp ( #4180 )
2012-12-03 21:49:53 +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
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
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
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
47f1220367
Remove useless preprocessor pieces from some testcases.
2012-11-30 20:28:30 +01:00
Daniel Marjamäki
45b77554ea
Fixed #4308 (C++11 raw string literals not parsed correctly)
2012-11-30 13:46:46 +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
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
PKEuS
9cb9388e49
Fixed handling of pointers in templates ( #4319 )
2012-11-04 10:49:25 +01:00
PKEuS
6122819832
Message refactorization: Changed expression "0-terminate" to "null-terminate" as discussed on 24b98feadb
2012-11-03 21:21:19 +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
Daniel Marjamäki
24e71c479c
Fixed #4301 (htmlreport broken)
2012-11-03 11:25:40 +01:00
PKEuS
a36e008967
Fixed #4314 : Using CheckNullPointer::isPointerDeRef() here is overkill and doesn't work as intended, since this function is designed to return 'false' if it isn't sure.
2012-11-03 10:25:32 +01:00
PKEuS
472a39d157
Fixed two MSVC warnings in testsymboldatabase.cpp
2012-11-01 18:55:15 +01:00
PKEuS
24b98feadb
Message refactorization: checkuninitvar.cpp, checkunusedfunctions.cpp, checkunusedvar.cpp
2012-11-01 18:40:20 +01:00
Robert Reif
8e14d7682c
Symbol database: fix some function prototype bugs that were found during check conversions. Ticket: #4266
2012-10-30 15:48:06 +01:00
Daniel Marjamäki
e1dce66494
tweaked message
2012-10-28 13:03:40 +01:00
Daniel Marjamäki
38213f1f2f
Fixed #4237 (False positive: (error) Memory Leak: data (assign reference variable value to a shadow variable in inner scope))
2012-10-27 16:36:14 +02:00
Daniel Marjamäki
863441afe8
Fixed #4236 (False positive: pointer free()d twice - neglecting call to other function)
2012-10-25 19:41:18 +02:00
Daniel Marjamäki
e7483af028
Opposite inner conditions - made check 'experimental' because there are unsolved false positives.
2012-10-21 18:18:29 +02:00
Baris Demiray
0e100f7563
Fixed #4189 (Improve check (printf('%l') not detected))
2012-10-21 08:50:29 +02:00
Edoardo Prezioso
f0f216390e
Fixed #4276 (segmentation fault of cppcheck (invalid code))
2012-10-20 21:40:51 +02:00
Alexander Mai
1881898e67
Added unit test for #4290
2012-10-19 20:04:43 +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
b591097c87
Revert "Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails)"
...
This reverts commit 1ee980184e
.
2012-10-16 19:12:27 +02:00
Robert Reif
1ee980184e
Fixed #3190 (SymbolDatabase: Parse of sub class constructor fails)
2012-10-16 06:11:28 +02:00
Daniel Marjamäki
562291477d
Fixed #4226 (False positive: Uninitialized variable (problem with namespace ::rtl))
2012-10-15 06:53:38 +02:00
Daniel Marjamäki
be174d6266
TemplateSimplifier: Fixed bad pattern that was detected by CheckInternal and pointed out by edward-san. The handling of recursive templates is better now.
2012-10-14 19:48:53 +02:00
Robert Reif
0d4b87c71e
SymbolDatabase: Improved find function functionality. Taking arguments into account
2012-10-14 17:30:37 +02:00
PKEuS
2aae8381cc
Message refactorization: checkstl.cpp
2012-10-14 11:16:48 +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
XhmikosR
8d08c3b58b
pro and pri files: remove unneeded empty lines, use spaces for consistency
2012-10-12 17:46:57 +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
e62e03ab31
Fixed #4267 (segmentation fault of cppcheck (invalid code)).
2012-10-09 20:44:30 +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
f74c30e116
Fixed #4231 (False positive: (error) Returning/dereferencing 'ptr' after it is deallocated / released (ignoring goto))
2012-10-08 17:23:47 +02:00
Daniel Marjamäki
61183e7896
astyle formatting
2012-10-08 16:23:05 +02:00
Daniel Marjamäki
fefd8529c6
Fixed #4007 (False positive: 'Possible null pointer dereference' when using short-circuit evaluation)
2012-10-07 19:06:49 +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
Alexander Mai
3656366c7e
Fixed #4257 (False Positive: String literal compared with variable - for non-pointer variable)
2012-10-07 16:26:03 +02:00
Daniel Marjamäki
0115bb8d24
Fixed #4102 (False positive: 'find('=') + 1U' can't be replaced with compare)
2012-10-07 12:43:14 +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
dbddbe75bf
Path: Removed java/c# handling. Thanks amai.
2012-10-03 19:47:14 +02:00
Daniel Marjamäki
1e024a9abc
cleanup more java/c# code. Thanks amai for telling me about this.
2012-10-03 19:19:49 +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
Daniel Marjamäki
a64669b1ec
Fixed #4203 (Don't warn about setting NULL value for pointers and not using that value)
2012-09-30 17:22:35 +02:00
Daniel Marjamäki
c65ac603e9
Fixed #3837 (False positive: national locale inline asm comments are reported as unsupported)
2012-09-30 09:35:32 +02:00
Daniel Marjamäki
4e1bef5535
AssignIf: better handling of function calls
2012-09-29 19:22:34 +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
XhmikosR
5101243c64
use const_cast instead of c cast
2012-09-29 13:15:09 +02:00
PKEuS
c17853949d
Fixed scope handling problems with CheckOther::checkComparisonOfFuncReturningBool(), removed its experimental status.
2012-09-29 11:23:30 +02:00
Daniel Marjamäki
10aa667648
assignif: Fixed testcase. parse while loops if variable is local and not external.
2012-09-29 10:54:09 +02:00
Daniel Marjamäki
44926654a4
df
2012-09-29 10:41:12 +02:00
Daniel Marjamäki
12cfdee61b
AssignIf: Check into scopes recursively
2012-09-29 10:33:54 +02:00
Daniel Marjamäki
52be4a5925
Disabled checkComparisonOfBoolWithBool since there are false positives. Ticket #2617
2012-09-28 19:11:36 +02:00
Daniel Marjamäki
ff4f8b58f3
Disable checkComparisonOfFuncReturningBool check because of false warnings. Ticket #2617
2012-09-28 18:51:10 +02:00
Daniel Marjamäki
bb62325ddb
AssignIf: Better handling of complex conditions with multiple subconditions
2012-09-28 17:03:16 +02:00
Alexander Mai
074b7781b2
Fixed #4239 (segmentation fault of cppcheck (invalid code))
2012-09-27 06:35:36 +02:00
Daniel Marjamäki
9f7a0146d0
AssignIf: Detect mistake in such code: 'int x=y&4; if ((x==3)||..'
2012-09-26 20:15:46 +02:00
Mohit Mate
9e297c95f2
Fixed #2617 (improve check: comparing boolean with '<')
2012-09-26 18:18:36 +02:00
Daniel Marjamäki
8010bcfbe8
astyle formatting
2012-09-26 18:17:02 +02:00
Daniel Marjamäki
753942df0c
Revert "Fixed #4165 (False positive:(error) Uninitialized variable: here)"
...
This reverts commit 96b1890797
.
2012-09-26 16:15:35 +02:00
Daniel Marjamäki
96b1890797
Fixed #4165 (False positive:(error) Uninitialized variable: here)
2012-09-25 20:45:42 +02:00
Daniel Marjamäki
0ff8105c71
Fixed #4074 (Internal error. Token::Match called with varid 0)
2012-09-24 06:44:51 +02:00
Daniel Marjamäki
990340ba98
Fixed #4072 (False positive: Structure is not initialized in the constructor (1.55))
2012-09-23 18:29:05 +02:00
Daniel Marjamäki
68240fffc6
Fixed #4228 ((error) Internal error. Token::Match called with varid 0 (multiple declarations in for loop))
2012-09-23 17:15:39 +02:00
Daniel Marjamäki
ec01cc811e
Second fix for #4207 (Internal error. Token::Match called with varid 0)
2012-09-23 13:25:28 +02:00
Daniel Marjamäki
865c0205e3
Fixed #4210 (Unmatched suppression warning emitted from disabled check)
2012-09-23 10:56:12 +02:00
Daniel Marjamäki
c9c04f9691
Fixed #4038 (FP: possible null pointer dereference)
2012-09-23 09:20:16 +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
37695d44f3
Fixed #4085 (tinyxml2 false positives)
2012-09-22 16:49:28 +02:00
Daniel Marjamäki
a17f37c67d
CheckBufferOverrun: Better handling of functions with variable arguments
2012-09-22 16:19:19 +02:00
Daniel Marjamäki
d3e990b1e5
Fixed #3987 (False positive: Memory leak reported when throwing/catching)
2012-09-22 10:37:27 +02:00
Daniel Marjamäki
6d928a2ff7
Fixed #4119 (false positive with operator= when implemented in terms of swap)
2012-09-22 08:50:36 +02:00
Daniel Marjamäki
a65f427195
Fixed #3836 (False positive: variable not initialized in copy constructor/operator (attached example code)
2012-09-22 08:16:16 +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
406483b618
Fixed valgrind error in #3953 , but there's still the bad enum problem.
2012-09-20 21:07:37 +02:00
Daniel Marjamäki
de8e592d00
Class: Show inconclusive warnings about unknown types that are not initialized in copy constructors. Ticket: #3611
2012-09-20 19:16:26 +02:00
Daniel Marjamäki
7d3e661774
Fixed #3611 (CheckClass: uninitVar and operatorEqVarError false positives (non-copyable members))
2012-09-20 16:47:01 +02:00
Daniel Marjamäki
aa3cdc6b6f
Fixed #3565 (Variable hides enumerator (attached code example))
2012-09-19 19:19:13 +02:00
Daniel Marjamäki
c3cb6202ed
Fixed #4172 (TemplateSimplifier: Handle 'A<&f> x' template instantiation)
2012-09-19 16:10:13 +02:00
Ettl Martin
3905f4ad7d
fixed #4169 semgentation fault (invalid code); Applied patch from amai and added a unittest.
2012-09-19 11:03:40 +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
ffd5c82b4f
Fixed #4118 (False null-pointer warning when check is indirect)
2012-09-18 19:16:28 +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
3ff792560f
Deactived bad message. Ticket #4154
2012-09-17 18:10:11 +02:00
Daniel Marjamäki
25befccb26
Revert "CheckClass::copyconstructors: Removed check. Because there is unfixed ticket #4154."
...
This reverts commit 066a1d48fe
.
2012-09-17 17:59:35 +02:00
Daniel Marjamäki
066a1d48fe
CheckClass::copyconstructors: Removed check. Because there is unfixed ticket #4154 .
2012-09-17 16:18:27 +02:00
XhmikosR
3c14e4b52a
test: tabs to spaces, remove trailing spaces and extra empty lines at the end of files
2012-09-17 13:51:40 +02:00
PKEuS
5237ed2de9
Message refactorization: checkother.cpp
2012-09-16 19:44:02 +02:00
PKEuS
f762b55aa0
Fixed MSVC 10 compiler warnings
2012-09-16 16:29:06 +02:00
PKEuS
b06c078969
Updated VS10 solution.
2012-09-16 13:38:46 +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
57804b3554
Fixed compile error. I forgot to commit testtimer.cpp
2012-09-15 20:43:37 +02:00
PKEuS
9a624576f4
Revert "CheckOther::clarifyStatement: improved message to show what's the 'bad' and the 'good' expression."
...
This reverts commit f8591f9004
.
2012-09-15 20:19:02 +02:00
Daniel Marjamäki
ae7ee5ffd3
Symbol database: Added TODO test case for #3190
2012-09-15 20:13:32 +02:00
Daniel Marjamäki
295ba9cc4f
Fixed #2709 (Negative times in --showtime summary)
2012-09-15 19:49:48 +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
84c0368bfd
Fixed #3586 (false positive: uninitvar in argument in namespaced function)
2012-09-15 10:48:17 +02:00
Kamil Dudka
b4d78e3d05
Fixed #3651 (Preprocessor: Wrong handling of #elif)
2012-09-15 09:34:41 +02:00
Daniel Marjamäki
a9c1a052b9
CheckAssignIf: Improved checking for bitwise or
2012-09-14 19:13:44 +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
PKEuS
929f16d892
Fixed hang on garbage code ( #4193 )
2012-09-14 15:32:35 +02:00
Daniel Marjamäki
3e58472cd3
Fixed #4013 (Several test failures in testcmdlineparser.cpp)
2012-09-14 06:58:14 +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
Daniel Marjamäki
6ebfbf42e1
Fixed #4191 (wrong syntax error if 'error' substring of stringification)
2012-09-12 16:10:45 +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
1863306198
Fixed false negative in checkunusedvar.cpp and reduced code dupliaction.
2012-09-11 14:24:12 +02:00
PKEuS
623ffe23f0
Fixed #4145
2012-09-11 14:14:35 +02:00
PKEuS
50f9dd52ab
Used enum instead of string in implementation for '--language='.
2012-09-11 08:53:27 +02:00
PKEuS
77b5175ec3
Support 0B... syntax for binary numbers.
2012-09-11 08:39:01 +02:00
PKEuS
95f4bb3e97
Implemented support for binary numbers ( #4113 )
2012-09-10 21:13: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
ce9f6bdb56
Fixed segfault #4182
2012-09-10 17:33:52 +02:00
Daniel Marjamäki
54f1771938
Fixed #4082 (Maybe false positive: memleak)
2012-09-10 17:27:41 +02:00
PKEuS
3449684137
Fixed usage of _settigns->isEnabled("style") in CheckIO. Added forgotten test cases.
2012-09-10 16:23:00 +02:00
PKEuS
1e5d082251
Moved remaining part of c_str() checking to checkstl.cpp. Fixed false positive #4157 .
2012-09-10 15:20:38 +02:00
PKEuS
4e59e55229
Refactorization/Partial rewrite of CheckClass::copyconstructors():
...
- Reformatted check code and some test cases
- Fixed false positives #4148 (non-copyable/unknown base classes) and #4178 (copy ctor implementation not seen)
- Proper usage of STL containers
- Better support for initializer list
- Rephrased error messages
2012-09-10 13:31:30 +02:00
Ettl Martin
f1faaac1f2
Added testcases for #3098
2012-09-09 19:49:40 +02:00
Daniel Marjamäki
d3bdd84d8b
Fixed #4175 (segmentation fault of cppcheck)
2012-09-09 18:56:26 +02:00
Daniel Marjamäki
7acb04b44c
Tokenizer: improved simplification of numeric calculations
2012-09-09 16:22:39 +02:00
PKEuS
d44f10fc01
Fixed createLinks2() on this code: nvwa<(x > y)>
2012-09-09 15:31:23 +02:00
XhmikosR
1968b6ffe0
vs2010 projects: consistently use /MP and remove default property
2012-09-09 14:20:49 +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
c31ce68520
TestTokenizer: Added TODO assertion
2012-09-08 09:01:02 +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
Daniel Marjamäki
6b56b4a9d3
Show that inconclusive message is inconclusive
2012-09-07 16:11:15 +02:00
PKEuS
e87ebcc602
Added support for std::unique and std::remove_if to CheckStl::uselessCalls().
2012-09-07 14:23:32 +02:00
PKEuS
a4b5824dec
New internal check: checkRedundantNextPrevious().
...
Fixed findings by new internal check
2012-09-07 12:36:40 +02:00
PKEuS
489df29346
Moved Tokenizer::typeConstToConstType() to Tokenizer::simplifyConst()
2012-09-07 11:41:41 +02:00
PKEuS
c2d4afc525
Support default arguments in symboldatabase for arguments without name ( #4055 )
2012-09-06 20:50:46 +02:00
PKEuS
0c812c5ac3
Throw an InternalError when trying to divide (or modulo) by zero in MathLib.
2012-09-06 20:15:32 +02:00
PKEuS
20f989b6c4
Skip code in brackets in default argument declaration ( fixes #4057 )
2012-09-06 20:02:53 +02:00
PKEuS
31e7e41098
Fixed and refactorized broken CheckNullPointer::CanFunctionAssignPointer():
...
- return true if parameter is passed by reference (fixes #4111 )
- Use symboldatabase
- Improved handling of inconclusive
2012-09-06 18:33:15 +02:00
PKEuS
a8cdd15738
Fixed false positive #4077 .
2012-09-06 16:30:10 +02:00
Daniel Marjamäki
1c7027140a
Tokenizer: Improved simplifyRedundantParanthesis
2012-09-06 16:16:29 +02:00
PKEuS
6edec7bdce
Fixed false positive #4123 .
2012-09-06 16:10:51 +02:00
Daniel Marjamäki
2a9eaebcaa
replaced tabs with spaces
2012-09-05 20:50:25 +02:00
Daniel Marjamäki
3032ded9aa
replaced tabs with spaces
2012-09-05 19:46:44 +02:00
Arpit Chaudhary
67e40a85e5
Improved check for shifting by negative values and removed false positives
2012-09-05 16:09:40 +02:00
PKEuS
f969530e1f
Revert "Fixed #4087 " which was committed by accident.
...
This reverts commit 0bbef8d803
.
2012-09-05 13:57:57 +02:00
Nilesh Kumar
c7633fc73c
Fixed #3645
2012-09-05 13:48:00 +02:00
gaurav kaushik
9ad7dfd5fd
Fixed #211 and #214
2012-09-05 12:58:09 +02:00
PKEuS
e5b1a6ceb1
Merge branch 'master' of github.com:danmar/cppcheck
2012-09-05 12:18:11 +02:00
Zachary Blair
8546bcc94e
Fixed #2029 (new check: free invalid address)
2012-09-04 23:31:23 -07:00
PKEuS
0bbef8d803
Fixed #4087
2012-09-04 21:50:50 +02:00
Daniel Marjamäki
4eeec75b73
TestPreprocessor: Encode extended ASCII characters to avoid VS compiler warnings.
2012-09-04 16:29:06 +02:00
PKEuS
8924e8af43
Fixed #4143 : Give correct line numbers in checkunusedvar.cpp
2012-09-04 14:53:24 +02:00
anuraggarg011
913670d254
Fixed #3304 (simple cases)
2012-09-04 13:41:14 +02:00
kbajaj91
be716e81d3
Fixed #4138 - False positive about variable assigned a value that is never
...
used in loops
2012-09-04 13:06:04 +02:00
Edoardo Prezioso
f8591f9004
CheckOther::clarifyStatement: improved message to show what's the 'bad' and the 'good' expression.
2012-09-04 02:07:55 +02:00
Edoardo Prezioso
6fd60eebb0
Tokenizer: added a workaround for #3690 (Support MSVC's 'for each').
2012-09-03 20:23:53 +02:00
anuraggarg011
bf11248a09
Fixed #1620 (tokenizer: simplify well known math functions)
2012-09-03 18:51:15 +02:00
anuraggarg011
b156c727b0
Fixed #3939 : Support ****foo++;
2012-09-03 17:10:27 +02:00
Ankita Gupta
c3a65dca40
Fixed #3793 (improve check: calculation in sizeof)
2012-09-03 15:56:10 +02:00
Edoardo Prezioso
04661fd7d0
Fixed test changes I forgot in previous commit.
2012-09-03 15:20:34 +02:00
XhmikosR
cd7c4df622
consistency changes
2012-09-03 13:52:06 +03:00
PKEuS
27cafd495a
Don't bailout for noreturn functions in checkRedundantAssignments outside switch.
2012-09-03 12:03:30 +02:00
PKEuS
b6c1528566
Test case for #4135
2012-09-03 11:32:15 +02:00
Kartik Bajaj
ea0cbbcf78
Fixed #1481
2012-09-02 18:50:17 +02:00
deepak gupta
24659dee92
Fixed #4087
2012-09-02 14:26:39 +02:00
PKEuS
2d64b69cf4
New check: Detect redundant assignment to a variable and redundant copying to a buffer
...
This check partially replaces the check for redundant assignments in switch
2012-09-02 13:09:32 +02:00
Deepak Gupta
4202866100
Fixed #4096 (Improve check: Buffer overrun in for loop, postfix increment in array access)
2012-09-01 19:17:28 +02:00
pranav1509
6f6baa67e4
Added more patterns to redundant condition check.
2012-09-01 13:39:32 +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
Ankita-gupta
ff7373f46f
Fixed bug in Token::Match ( #3720 )
2012-08-30 13:33:19 +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
ea85dd305a
Fixed #4086 : Set varId in initialization list.
2012-08-28 12:44:40 +02:00
Daniel Marjamäki
9fe9944adb
Fixed #4034 (false positive:(error) Dereferencing 'cfileP' after it is deallocated / released)
2012-08-28 06:38:38 +02:00
Daniel Marjamäki
0d82b08080
Fixed #4040 (false positive: (error) Uninitialized variable: iter)
2012-08-27 15:48:21 +02:00
PKEuS
671f1b83d9
Fixed false positive: Return value of std::remove() ignored when std::remove(char*) is called ( #4093 )
2012-08-27 14:28:16 +02:00
PKEuS
046712aaec
Removed --doc formating hack that removes more than three newlines and added format testing of Check::classInfo instead.
...
- Fixed test failures shown by new test.
Use const_iterator instead of iterator in testcppcheck.cpp when possible
2012-08-26 16:22:46 +02:00
PKEuS
1fbaae948c
Added regression test cases for #404 .
2012-08-26 11:39:17 +02:00
PKEuS
4b1075b34b
Fixed #3729 : Don't suggest recursive call to optimize away c_str()
2012-08-26 10:56:46 +02:00
PKEuS
6893948c72
Bugfix: Reset property info when Token::link() is set (< can be a bracket or a comparison operator). Fixes #4075 .
2012-08-26 10:23:16 +02:00
PKEuS
662b0d2dbe
Simplify 0[foo] to *(foo) ( fixes #4083 )
2012-08-26 10:03:05 +02:00
PKEuS
9fa7e15fb4
Fixed setVarId for nested templates ( #3976 , #3769 ) and support C++11 right angle brackets in TemplateSimplifier::templateParameters()
2012-08-26 09:49:38 +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
41797d409d
Fixed #4036 (cppcheck hangs with 100% cpu load)
2012-08-25 13:24:17 +02:00
Daniel Marjamäki
7975ffba21
Fixed #3980 (Variable not assigned a value)
2012-08-25 13:07:33 +02:00
PKEuS
bb068d2f78
Fixed false positive #4039 : Handle operator precedence in CheckStl::size()
2012-08-25 12:36:13 +02:00
Daniel Marjamäki
985ac662ee
Fixed #4035 (False positive: Memory leak: pTempFile)
2012-08-25 12:00:25 +02:00
Daniel Marjamäki
730935efdd
Fixed testrunner assertions in TestPreprocessor
2012-08-25 11:45:18 +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
808c3468c9
New check: detect suspicious comparison of string literal with char* variable
...
Bugfix: Update Token type when varId is set
2012-08-24 14:25:17 +02:00
PKEuS
76fbcce13f
Restored (intentional) content of screwed up commits 1bcdf4ce3d
and 674f7980d519712ff16d8f874dfe55a84deb4b5b:
...
- New check (Inconclusive): Array filled incompletely with memset/memcpy/memmove
-- This check only warns if the number of elements is given as size in bytes to memset, memcpy or memmove and if the size of an element is larger than 1 Byte. It does not warn for random numbers
- New check: Detect ineffective statements like '*foo++;' (Should be: '(*foo)++;')
Sorry for the inconveniences.
2012-08-24 11:28:50 +02:00
Edoardo Prezioso
0f1accc2da
Revert latest two commits as they break the compilation and the style. PKEuS???
2012-08-24 00:10:19 +02:00
PKEuS
1bcdf4ce3d
New check: Detect ineffective statements like '*foo++;' (Should be: '(*foo)++;')
2012-08-23 12:28:40 -07:00
PKEuS
674f7980d5
New check (Inconclusive): Array filled incompletely with memset/memcpy/memmove.
...
This check only warns if the number of elements is given as size in bytes to memset, memcpy or memmove and if the size of an element is larger than 1 Byte. It does not warn for random numbers
2012-08-23 11:27:00 -07:00
Daniel Marjamäki
d24badbfda
Fixed #4068 (Endless loop inside MathLib::add())
2012-08-22 20:50:39 +02:00
Daniel Marjamäki
f133c9e8ec
Fixed #4020 (false positive: (style) Variable 'dst' is assigned a value that is never used)
2012-08-22 19:47:46 +02:00
PKEuS
4fb464982c
Fixed crash reported in #4076
2012-08-22 10:17:23 -07: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
PKEuS
4d2104ca08
Made a TODO from failing tests - Simplification of known variables is not smart enough to handle operator>> properly-
2012-08-22 16:44:41 +02:00
PKEuS
6364f43b7a
Fixed compiler error introduced recently.
2012-08-22 16:41:11 +02:00
Arpit Chaudhary
7c8da17c44
Added check for detecting if a variable or number is shifted by negative right operand. Statements like:
...
int i = -1;
a << i;
would result in an error message stating undefined behavior.
2012-08-22 15:44:20 +02:00
Kumar Ashwani
afe030ce9b
Fixed #2628 : Detect redudant usage of operator++/-- in switch.
2012-08-22 14:40:57 +02:00
PKEuS
e05a597066
Fixed false negatives in checkautovariables.cpp:
...
- Detect returning temporary instances (#4076 )
- Added support for returning user defined types
2012-08-22 04:08:32 -07:00
PKEuS
00f6c635b8
Detect functions returning a template type in SymbolDatabase
...
Fixed comment
2012-08-22 03:37:50 -07:00
Edoardo Prezioso
2b5cd2effc
Fixed G++ [-Wparentheses] warning. This also fixed #4073 (Crash on self assignment).
2012-08-21 20:15:04 +02:00
Daniel Marjamäki
41b624230f
Fixed #3942 (false positive: (error) Memory leak: keyword)
2012-08-21 17:02:11 +02:00
PKEuS
b4b5c80db9
Improved check: Added message when checking sign of a pointer.
2012-08-21 03:28:02 -07:00
PKEuS
a5bca705a5
New check: Ensure that the return value of std::remove() is used.
2012-08-21 02:30:27 -07:00
PKEuS
b641a10e35
Fixed false negative: memset(foo, 0, sizeof(&foo)); is as suspicious as memset(foo, 0, sizeof(foo));
2012-08-20 10:08:18 -07: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
PKEuS
a243983242
Refactorized type handling in CheckIO and CheckOther:
...
- Added several types (std::) to isComplexType
- Types in namespace std:: are considered to have no side-effects (solved one TODO)
- Scope of a pointer can be limited without side effects
2012-08-20 08:57:28 -07:00
PKEuS
c537a86363
Fixed false negative in unused variable checking when class without side effects inherits from another one.
2012-08-20 07:55:39 -07:00
PKEuS
c7e2490f2b
Refactorized iterator check:
...
- Handles reassignment (fix for #4062 )
- Better support of execution paths
- Use symboldatabase for better performance
2012-08-20 04:57:24 -07: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
Daniel Marjamäki
1601baa974
Fixed #4016 (false positive: incorrectLogicOperator)
2012-08-14 16:17:18 +02:00
Daniel Marjamäki
e534ee0426
Fixed #3706 (cppcheck 1.53 hangs when processing a certain template with specializations)
2012-08-13 16:17:33 +02:00
Daniel Marjamäki
8afdde0b5e
Fixed #3931 (FP: Buffer access out-of-bounds)
2012-08-12 17:06:54 +02:00
Edoardo Prezioso
358fb9a284
Fixed the GCC Wshadow warnings introduced recently.
2012-08-12 17:04:37 +02:00
Daniel Marjamäki
4368f66a00
Fixed #4018 (false positive: Dereferencing 'foo' after it is deallocated / released)
2012-08-12 16:18:07 +02:00
PKEuS
2ac2674f67
Fixed #4000 , added support for function prototypes to TemplateSimplifier::templateParameters()
2012-08-12 05:19:56 -07: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