Commit Graph

2639 Commits

Author SHA1 Message Date
Kimmo Varis b8b2e3fae9 Move filelister* to cli.
Ticket #2445 (Move FileLister classes from LIB to CLI).
2011-01-18 19:58:49 +02:00
Pete Johns 75767705c7 Added testDoesNotIdentifyCallback for #2480
TODO
2011-01-18 21:50:22 +11:00
Pete Johns 0e1bab6dc3 Merge branch 'multi_indirection_templates' 2011-01-18 21:08:04 +11:00
Pete Johns abfd907763 Made isVariableDeclarationIdentifiesTemplatedPointerToPointerVariable() pass.
And added isVariableDeclarationIdentifiesTemplatedArrayVariable() (passing) into the bargain.
2011-01-18 20:14:12 +11:00
Pete Johns 69d4db714e Added TODO test cases for template variables with multiple levels of pointer indirection
Following email from Robert Reif
2011-01-18 18:29:42 +11:00
Robert Reif 8631ee65a3 Fixed #2474 (false positive: Member variable 'A::m_SemVar' is not initialised in the constructor.) 2011-01-18 07:34:11 +01:00
Daniel Marjamäki 965c1a94fd Fixed #2475 (False positive in structure initialisation: The scope of the variable bits can be reduced) 2011-01-17 20:51:15 +01:00
Kimmo Varis bd5e9e5309 Improve checking -D arguments for command line. 2011-01-17 21:19:27 +02:00
Kimmo Varis 6dd16d3919 Fix crash when giving -D without argument.
Fixes ticket #2476 (Crash when -D used without parameters.)
2011-01-17 21:03:22 +02:00
Daniel Marjamäki b5020468f6 Fixed #2467 (false positive: possible nullptr dereference) 2011-01-17 19:23:00 +01:00
Daniel Marjamäki 065e2e277e Fixed #2473 (False positive: Memory leak when there is local struct) 2011-01-17 19:00:21 +01:00
Robert Reif 959e10cee5 Symbol database: renamed classes. ticket: #2468 2011-01-17 18:29:19 +01:00
Robert Reif bf9528558e Symbol database: pulled out classes into global scope. ticket: #2468 2011-01-17 07:21:59 +01:00
Pete Johns 7918c4b804 isVariableDeclaration() now detects template variables. 2011-01-17 08:36:53 +11:00
Pete Johns 38c37ad2d8 Moved array declaration detection into isVariableDeclaration() 2011-01-17 08:36:52 +11:00
Daniel Marjamäki e6a1efa13b Fixed #2302 (Duplicate id 'unusedVariable') 2011-01-16 18:45:05 +01:00
Daniel Marjamäki 61aa86f201 testcppcheck: check that Cppcheck::getErrorMessages output is not empty 2011-01-16 17:07:12 +01:00
Daniel Marjamäki f50971a65a testcppcheck: test Cppcheck::getErrorMessages 2011-01-16 17:06:07 +01:00
Daniel Marjamäki 615c92c83b testcppcheck: cleanup 2011-01-16 16:45:00 +01:00
Daniel Marjamäki 483e50d5bc testcppcheck: removed 'parseArgsAndCheck' and 'parseOutputtingArgs'. Such tests belong to testcmdlineparser 2011-01-16 16:34:29 +01:00
Daniel Marjamäki 206565c837 testcppcheck: removed nonexistingpath and include tests. The Cppcheck class doesn't handle this. 2011-01-16 16:32:05 +01:00
Daniel Marjamäki f862b37c71 testcppcheck: the xml and template output is tested in testerrorlogger instead 2011-01-16 16:26:33 +01:00
Daniel Marjamäki e3e32de22e testcppcheck: the testcmdlineparser tests invalid command line arguments 2011-01-16 16:22:46 +01:00
Daniel Marjamäki 4661e38c65 testcppcheck: linenumbers are tested in the other tests 2011-01-16 16:21:34 +01:00
Daniel Marjamäki c841908149 testcppcheck: command line parsing of -D is tested in testcmdlineparser.cpp 2011-01-16 16:19:40 +01:00
Daniel Marjamäki 03ddfcb5b3 testcppcheck: parsing templates is tested in testcmdlineparser.cpp 2011-01-16 16:17:53 +01:00
Daniel Marjamäki a97e28491f Fixed #2407 (False positive: unused private function) 2011-01-16 12:16:31 +01:00
Daniel Marjamäki f72fd6960e Fixed #2449 (segfault in tokenize.cpp, incorrect parsing) 2011-01-16 11:54:28 +01:00
Raphael Geissert da998fec68 Tokenizer: simplify restrict 2011-01-16 11:37:03 +01:00
Robert Reif beb2db82a2 Fixed #980 (false negative: division by zero when using enum) 2011-01-16 11:24:58 +01:00
Robert Reif 0f6644e1ea Symbol database: Refactorings 2011-01-16 11:18:12 +01:00
Daniel Marjamäki 6edf35ebf5 Fixed #2463 (false positive: possible nullpointer dereference) 2011-01-15 12:09:36 +01:00
Daniel Marjamäki 97d0755750 Fixed #2454 (Tokenizer::simplifyKnownVariables: problem with float/double variables) 2011-01-15 08:48:42 +01:00
Daniel Marjamäki cf32016444 removed old comment 2011-01-15 08:30:54 +01:00
Daniel Marjamäki 5920dbb7e7 Fixed #2466 (Tokenizer: simplification of enum) 2011-01-15 08:21:06 +01:00
Robert Reif 8ecba0af90 Fixed #2464 (False positive: not initialised/not assigned Static variable in copy constructors.) 2011-01-15 08:04:50 +01:00
Robert Reif 79b9939610 Fixed #2465 (False positive: not initialised variable, but there is default constructor for it.) 2011-01-15 07:59:37 +01:00
Daniel Marjamäki 00b49a51da Fixed #2451 (False positive when incrementing map value via iterator) 2011-01-14 19:50:07 +01:00
Robert Reif 708a75e363 Fixed #2452 (syntax error when 'void f(typedef int x)' is used. causes segmentation fault.) 2011-01-14 07:41:22 +01:00
Daniel Marjamäki b247d7d56e Fixed #2450 (False positive when iterator reused) 2011-01-13 20:57:44 +01:00
Daniel Marjamäki 36c1807228 Fixed #2458 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant) 2011-01-13 20:12:57 +01:00
Zachary Blair 38be7056b0 Fixed #2434 (FP memleakOnRealloc) 2011-01-12 22:33:46 -08:00
Daniel Marjamäki 09f900ce79 Fixed #2440 (False negative: basic memory leak) 2011-01-11 20:14:15 +01:00
Kimmo Varis 846d3dae99 Accept include paths ending with backslash.
Convert include path to use internal path separators when parsing
command line. Convert back to native separators when using paths.

Ticket #2448 (Error in handling -I command line parameter)
2011-01-11 21:04:21 +02:00
Daniel Marjamäki 79e52a8c45 Fixed #2296 (Tokenizer: simplifyKnownVariable doesn't simplify pointer properly 'delete [] p;') 2011-01-11 19:34:35 +01:00
Daniel Marjamäki 9658e2299d Fixed #2443 (Possible null pointer dereference: xxx - otherwise it is redundant to check if xxx is null at line) 2011-01-10 19:57:26 +01:00
Daniel Marjamäki 2d92f1ff6a Fixed #2442 (False positive: Memory leak when function returns in 'if' instead of 'else if') 2011-01-10 19:35:06 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Daniel Marjamäki 2848abbf36 Fixed #1219 (improve check: null pointer not detected 'if (p) return; *p = 0;') 2011-01-09 20:16:16 +01:00
Daniel Marjamäki 79ef02812d Fixed #2211 (false negative: buffer access out of bounds for(int i=0; i !=6;i++)) 2011-01-09 18:51:28 +01:00
Daniel Marjamäki 0b0c46e373 astyle formatting 2011-01-09 18:39:59 +01:00
Daniel Marjamäki 88abb32ddf Fixed #2429 (Tokenizer: Wrong simplification of 'sizeof .1250E+04') 2011-01-09 10:09:54 +01:00
Daniel Marjamäki 68beffca04 Fixed #2437 (false positive: possible null pointer dereference: tok2) 2011-01-08 17:16:52 +01:00
Daniel Marjamäki 67a1c6817b Error message: Replace " with ' around variable name 2011-01-08 14:35:18 +01:00
Daniel Marjamäki 14cbaebfe2 Fixed #2428 (false alarm with code containing a throw clause) 2011-01-07 20:45:33 +01:00
Robert Reif 5f078da7ad Fixed #2425 (segmentation fault of cppcheck) 2011-01-07 18:58:14 +01:00
Ettl Martin 9b66f7a754 #ticket 2429: added a test to the mathlib to ensure the used floating point number is recognized correctly 2011-01-07 12:27:12 +01:00
Robert Reif bfc95e01c1 Fixed #2426 (### Internal error in Cppcheck. Please report it.) 2011-01-07 08:02:47 +01:00
Daniel Marjamäki 1b3a5ed0be Tokenizer: simplify NULL to 0 in the normal token list 2011-01-06 20:16:14 +01:00
Daniel Marjamäki 37b1f7c296 memsetZeroBytes: improved error message. ticket: #2421 2011-01-06 16:27:22 +01:00
Daniel Marjamäki ed71c57f1f astyle formatting 2011-01-06 12:07:18 +01:00
Raphael Geissert 6ec4497919 [PATCH] Check for calls to memset() where 0 bytes are to be filled
Inspired by Silvio Cesare's work
2011-01-06 11:31:58 +01:00
Daniel Marjamäki d1854e330b Fixed #2413 (fflush() with NULL argument is valid.) 2011-01-06 08:12:34 +01:00
Robert Reif 03a484554c Fixed #2415 (false positive: Member variable not initialized in constructor calling assignment operator) 2011-01-06 07:56:34 +01:00
Robert Reif d7e170b3ca typedef: fixed problem. ticket: #2414 2011-01-06 07:52:59 +01:00
Daniel Marjamäki c74b2e3cbf Fixed #2411 (possible null pointer dereference (aborting via function pointer not detected)) 2011-01-05 21:48:26 +01:00
Daniel Marjamäki 033e759c39 command line: added 'information' id to enable 2011-01-05 21:20:21 +01:00
Daniel Marjamäki 21af64049c Fixed #2401 (false positive: Uninitialized variable: result) 2011-01-05 20:44:04 +01:00
Daniel Marjamäki 68de938d23 Uninitialized variables. Fixed false positive when there are multiple related conditions. ticket: #2399 2011-01-05 19:54:56 +01:00
Robert Reif 157498e694 Fixed #2412 (typedef: struct with inheritance) 2011-01-05 17:42:55 +01:00
Kimmo Varis bb719774b1 Improve suspicious condition (string::find) message.
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2011-01-04 23:19:23 +02:00
Kimmo Varis 66e8b7bc1e Improve dangerous iterator usage (after erase()) message.
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2011-01-04 23:18:48 +02:00
Kimmo Varis b750a52f6d Improve strncat 3rd parameter usage warning message.
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2011-01-04 23:17:44 +02:00
Daniel Marjamäki d700f25518 Fixed #2399 (Tokenizer::simplifyKnownVariables: variables in conditions) 2011-01-04 21:35:35 +01:00
Daniel Marjamäki 63c1ee375e Fixed #2398 (false positive: Uninitialized variable) 2011-01-04 19:36:29 +01:00
Daniel Marjamäki 2c6421d162 Merge branch 'master' of https://github.com/rgeissert/cppcheck into rgeissert-realloc 2011-01-04 18:21:18 +01:00
Robert Reif 63208e87d3 typedef: delete unhandled typedefs. ticket: #2348 2011-01-04 07:43:40 +01:00
Robert Reif a782d3ddf7 typedef: fix testcase 4. ticket: #2375 2011-01-04 07:39:41 +01:00
Markus Elfring e459ed1de3 Fixed #2389 (mistakable warning from 'CheckClass::uninitVarError') 2011-01-03 19:03:42 +01:00
Markus Elfring 3fc0317997 Bug #2390: Enclose the output of a variable name with quotes in "CheckOther::variableScopeError"
The variable name output was enclosed by quotation marks in the member
function "CheckOther::variableScopeError" and corresponding test functions.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-01-03 05:15:20 +01:00
Raphael Geissert 3d9550b0bf Simplify "x = realloc (0, n);" to "x = malloc(n);" 2011-01-02 17:46:10 -06:00
Daniel Marjamäki d2714fefda typedef: Fixed testcase. ticket: #2375 2011-01-02 17:28:47 +01:00
Daniel Marjamäki 2e7e118cb8 Fixed #2392 (Preprocessor: Wrong simplification of __VA_ARGS__) 2011-01-02 11:19:37 +01:00
Daniel Marjamäki 571704f118 Added TODO testcase for ticket #2392 (Preprocessor: Wrong simplification of __VA_ARGS__) 2011-01-02 10:09:50 +01:00
Daniel Marjamäki b5876f00ff Fixed #2391 (cstdlib file and memory function check misbehavior) 2011-01-02 08:32:51 +01:00
Daniel Marjamäki 320604f073 typedef: added more tests. ticket: #2375 2011-01-02 07:42:47 +01:00
Daniel Marjamäki 4ec9d418ff Fixed #2215 (Improve check: Writing outside malloc bounds not detected) 2011-01-01 20:56:21 +01:00
Daniel Marjamäki 2a77dd3df1 Fixed #2246 (Improve check: Memory leak, function is not noreturn if return value is taken) 2011-01-01 20:14:01 +01:00
Daniel Marjamäki 3c238882a2 Fixed TODO testcase. Use symbol database instead of token list. Ticket: #2375 2011-01-01 17:54:37 +01:00
Daniel Marjamäki a9aa6375b7 gcc: disabled -Wconversion again - too many warnings 2011-01-01 09:16:31 +01:00
Daniel Marjamäki 2da3fea1b8 Fixed #2386 (segmentation fault occurs in the checking when typedef has same name as an enum constant) 2010-12-31 20:55:28 +01:00
Daniel Marjamäki 04eb9cf305 Fixed #2378 (Refactoring: create utility function that skips redundant if/for/while) 2010-12-31 18:07:46 +01:00
Daniel Marjamäki ed6c76ce04 Fixed #2385 (False positive: array index out of bounds) 2010-12-31 17:43:38 +01:00
Pete Johns 502cfe7243 Fixed #2384 ("The function 's::f' can be const" reported for pointer-to-pointer)
Moved check for pointer variables into isVariableDeclaration()

Can now handle multiple scopes and multiple levels of indirection. Simplified check for strucs and unions, too, reducing the size of getVarList().

skipScopeIdentifiers() and skipPointers() should probably be methods on class Token.
2010-12-31 22:12:32 +11:00
Zachary Blair d11b5163b7 Fixed #2382 (Catching exceptions by value instead of reference) 2010-12-31 03:01:38 -08:00
Daniel Marjamäki eb59bd5fd6 Added -Wconversion compiler flag. The ASSERT_EQUALS_DOUBLE was added that can be used when comparing double values. 2010-12-30 22:56:53 +01:00
Daniel Marjamäki 8bdb05da6e Uninitialized variables: typeof doesn't dereference. Ticket: #2367 2010-12-30 21:30:46 +01:00
Daniel Marjamäki 307178d3c2 Tokenizer: Better handling of duplicate enums. Ticket: #2381 2010-12-30 20:55:23 +01:00
Daniel Marjamäki 7ec169f66a Fixed #2321 (false positive: (performance) Prefer prefix ++/-- operators for non-primitive types.) 2010-12-30 14:27:32 +01:00
Pete Johns 2e61736c73 Refactoring following #2377 (Technically the member function xxx can be const)
symboldatabase now recognises variables with arbitrarily many scopes.

Extracted method isVariableDeclaration()

Added unit tests for isVariableDeclaration in new file testsymboldatabase.cpp

Extracted givenACodeSampleToTokenize helper class into testutils.h to reduce duplication.
2010-12-30 19:46:44 +11:00
Pete Johns 5d0ace3a50 Fixed #2377 (Technically the member function xxx can be const)
TODO: Add unit test for getVarList() and refactor variable check.

[Removed my testcase for #2377 and removed two TODOs.]
2010-12-30 17:56:28 +11:00
Ettl Martin ac42c0ba3b const correctness: added further testcases for increment/decrement member functions 2010-12-30 02:05:44 +01:00
Ettl Martin 7b92378c3a ticket 2377: added further testcases 2010-12-30 01:44:46 +01:00
Ettl Martin c29824fc49 added todo testcase for ticket 2377 Technically the member function xxx can be const 2010-12-30 01:29:09 +01:00
Daniel Marjamäki 3d3593e6e7 Fixed #2374 (False 'memory leak' report (assigning to map in subfunction)) 2010-12-29 22:18:23 +01:00
Robert Reif 3900ac731e simplifyTypedef: Better handling of 'typedef int RexxFunctionHandler();'. Ticket: #2348 2010-12-29 20:25:47 +01:00
Robert Reif 3f1f50e970 simplifyTypedef: operator typedef. Ticket: #2375 2010-12-29 20:22:06 +01:00
Daniel Marjamäki 38e7209d26 Fixed #2373 (Using XML2 in --errorlist output) 2010-12-29 12:43:29 +01:00
Robert Reif 137d0e2ba7 typedef: fixed problem with 'typedef int pread_f(int);'. ticket: #2348 2010-12-29 09:18:41 +01:00
Robert Reif e82b1f8946 typedef: fix typedef simplification. ticket: #2348 2010-12-28 21:21:13 +01:00
Daniel Marjamäki bdf0cb7115 Fixed #2370 (false negative: Buffer access out-of-bounds (for with if, no break)) 2010-12-28 20:46:31 +01:00
Daniel Marjamäki 0667fcf53c Fixed #2355 (simplifyTypedef: wrong simplification of 'typedef FMAC1 void (*a)();') 2010-12-28 14:04:44 +01:00
Robert Reif 1b92eeae1e Fixed #2354 (simplifyTypedef: function pointers are not simplified into valid code) 2010-12-28 08:01:32 +01:00
Pete Johns 58ddb3b0ab Fixed #2360 (testrunner fails to build in Mac OS X Leopard (10.5) - assert macro vs assert method)
Renamed assert to assert_.

Tested with gcc v4.0.1 on Snow Leopard.
2010-12-28 09:32:36 +11:00
Daniel Marjamäki d4e3e7e201 Fixed #2367 (false positive: (error) Uninitialized variable: s) 2010-12-27 21:19:10 +01:00
Daniel Marjamäki 448c03c6e6 Fixed #2367 (false positive: (error) Uninitialized variable: s) 2010-12-27 21:05:33 +01:00
Daniel Marjamäki 92acca3d0c Fixed #2368 (assigned a value that is never used) 2010-12-27 20:49:07 +01:00
Kimmo Varis e8b81f909d Change 'Scope of variable'-message to information message. 2010-12-27 16:48:03 +02:00
Ettl Martin ccde32b210 Created to testcase (#2368) for assigned a value that is never used false positive 2010-12-27 15:12:17 +01:00
Daniel Marjamäki 3853f93b34 TestClass: addon for 12f28507, fix a few more error messages. 2010-12-27 08:22:21 +01:00
Daniel Marjamäki 2367cfcf1e Fixed #2361 (false positive on t[0X10]) 2010-12-27 08:09:05 +01:00
Kimmo Varis 12f2850777 Improve the message about const function.
See discussion thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-12-26 23:44:03 +02:00
Kimmo Varis f5f2a2ce2a Improve message for container type range check.
See thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-26 23:44:02 +02:00
Kimmo Varis ad89a84796 Improve error message about overlapping buffers for s[n]printf().
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-26 23:44:01 +02:00
Daniel Marjamäki 6aa400fd80 Buffer overrun: UB when pointer arithmetic result points out of bounds. Ticket #1774 2010-12-26 21:23:28 +01:00
Daniel Marjamäki 6178459c15 Fixed #2304 (Tokenizer::simplifyKnownVariables: known strcpy parameter) 2010-12-26 20:34:07 +01:00
Daniel Marjamäki 5f3d2a7e35 Fixed #2090 (False negative: null pointer dereference 's=0; strcpy(s,p);') 2010-12-26 19:29:58 +01:00
Daniel Marjamäki f4581d833d Tokenizer: Bailout if @ is encountered in the code 2010-12-26 15:07:14 +01:00
Daniel Marjamäki 243a524909 Fixed #2350 (false positive: possible null pointer dereference) 2010-12-26 13:38:16 +01:00
Daniel Marjamäki f7a83b4d90 astyle formatting 2010-12-26 13:18:23 +01:00
Pete Johns 64e2c8668c Fixed #2358 (Compilation fail on Mac)
Added test case to prove it works. Not a true unit-test as it accesses the file-system.
2010-12-26 23:04:07 +11:00
Daniel Marjamäki ecad249ae2 Fixed #2346 (False positive: pointer is assigned value that is never used. used here: 'pCol = pCol->GetNext()') 2010-12-25 19:17:53 +01:00
Daniel Marjamäki 10ee43790d Fixed #2339 (Tokenizer::setVarId : Wrong handling of 'int gr = id - (TLFPressProperties::OIL_FLUID * nb);') 2010-12-25 12:40:44 +01:00
Daniel Marjamäki 6f8f0e1aa1 Fixed #2353 (Tokenizer::simplifyKnownVariables: wrong simplification after return) 2010-12-25 10:07:57 +01:00
Daniel Marjamäki 81c5576eb4 Misused scope objects: Don't use this check if the checked file is a pure C file. Ticket: #2352 2010-12-25 08:43:52 +01:00
Daniel Marjamäki 335d164cdf Fixed #2356 (False positive reported with iterator deletion) 2010-12-24 10:33:48 +01:00
Daniel Marjamäki 18fd12006a Tokenizer::simplifyGoto: Don't simplify 'goto' inside unhandled macro calls. Ticket: #2348 2010-12-23 22:03:58 +01:00
Daniel Marjamäki 472ecd8805 Tokenizer: Fixed calculation simplification of '0*(*p)'. Ticket: #2348 2010-12-23 18:59:18 +01:00
Daniel Marjamäki aff3623fec Fixed #2345 (False positive: uninitialized variable (in sub-condition in if inside a loop)) 2010-12-23 09:16:29 +01:00
Daniel Marjamäki be46d453c4 Information: Added new severity 2010-12-22 19:53:17 +01:00
Robert Reif fc7e2d1ac1 Fixed #2341 (false positive for function pointer returning typedef) 2010-12-22 18:37:23 +01:00
Daniel Marjamäki 00e9822cb3 Fixed #2337 (False Positive: memory leak) 2010-12-22 18:32:00 +01:00
Daniel Marjamäki f392dbef95 Fixed #2338 (False positive: Deallocating a deallocated pointer) 2010-12-22 08:24:50 +01:00
Daniel Marjamäki 6951c32683 Fixed #2336 (False positive: memory leak (passing pointer to subfunction)) 2010-12-21 21:12:45 +01:00
Daniel Marjamäki 0f9415a5fb Fixed #2330 (unreadVariable error for a fstream object when only extraction operator (>>) is used) 2010-12-21 19:02:00 +01:00
Robert Reif 244974a61a unused variables: fixed false negatives with the help of the symbol database. ticket: #2317 2010-12-21 08:13:40 +01:00
Daniel Marjamäki f73cce9eca Fixed #2317 ((style) Variable is allocated memory that is never used) 2010-12-20 18:31:16 +01:00
Daniel Marjamäki cdc8801be0 Fixed #2334 (Internal class index function (no need to 'strchr')) 2010-12-20 18:13:26 +01:00
Daniel Marjamäki 02892499d2 Fixed #2286 (Variable 'ownKilled' is assigned a value that is never used) 2010-12-19 18:27:31 +01:00
Daniel Marjamäki 8247270f35 Fixed #2328 (false positive: buffer overrun (for loop with a break => the end value is not reached)) 2010-12-19 10:39:43 +01:00
Daniel Marjamäki afbf5a8ef3 Visual Studio: updated project files with qmake 2010-12-19 07:51:34 +01:00
Daniel Marjamäki 41ac2c252f Fixed #2325 (Tokenizer: Remove for-loop if condition is false) 2010-12-18 21:43:12 +01:00
Kimmo Varis 67713e47bd Update test.pro for using base path for included pri files. 2010-12-18 17:07:20 +02:00
Daniel Marjamäki da15277675 QMake: added test/test.pro 2010-12-18 12:13:11 +01:00
Daniel Marjamäki 8ffc2b0ac6 Tokenizer: better handling for switch/break in the simplifyKnownVariables. Ticket: #2324 2010-12-18 11:14:31 +01:00
Daniel Marjamäki f6c00fc478 Fixed #2323 (false positive: Buffer access out of bounds) 2010-12-18 10:54:36 +01:00
Daniel Marjamäki fc9c450eed Fixed #2320 (false positive: Uninitialized variable: kbuf) 2010-12-18 10:06:21 +01:00
Daniel Marjamäki 7eb9855104 Tokenizer: Remove redundant parantheses in rhs. Ticket: #2320 2010-12-18 09:44:58 +01:00
Daniel Marjamäki 814efb2512 Fixed #2313 (False Positive: memory leak) 2010-12-17 21:34:22 +01:00
Daniel Marjamäki 7050e9610b checkmemoryleaks: added assertion for todo assertion 2010-12-17 21:30:02 +01:00
Daniel Marjamäki c2335f845e Fixed #2306 (False positive: array of std::string is reported as uninitialized) 2010-12-17 21:20:04 +01:00
Daniel Marjamäki 696550abd3 Fixed #2299 (false positive: possible nullpointer dereference) 2010-12-17 21:09:12 +01:00
Daniel Marjamäki 845d1491f9 Fixed #2307 (No constructor defined false positive when class is enclosed in namespace) 2010-12-17 20:56:46 +01:00
Daniel Marjamäki 0cebcc8fa9 Fixed #2300 (false positive: possible nullpointer dereference) 2010-12-16 21:41:50 +01:00
Daniel Marjamäki 49ee1533d9 Fixed #2301 (false positive: The given size 3 is mismatching) 2010-12-16 21:27:33 +01:00
Daniel Marjamäki 2d97189486 Fixed #2311 (False positive: Index out of bounds) 2010-12-16 20:16:59 +01:00
Daniel Marjamäki eb0231b48f astyle formatting 2010-12-16 20:15:22 +01:00
Robert Reif bf136f0123 Fixed #2314 (False positive: (style) Template instantiation 'Foo' hides typedef with same name) 2010-12-16 07:48:46 +01:00
Ettl Martin a55d7df8a3 test:testpreprocessor.cpp; fixed broken unit test due to wrong charcter encoding 2010-12-15 21:34:31 +01:00
Kimmo Varis 5ac9a7eaa7 Update VS2010 project files for new TinyXml location. 2010-12-15 22:13:31 +02:00
Kimmo Varis cf46f2ffb9 Update VS2008 project files for new TinyXml location. 2010-12-15 22:05:05 +02:00
vBm 46a11183a5 Fixed some spelling mistakes 2010-12-15 18:45:53 +01:00
Daniel Marjamäki 5ce63a1df0 Fixed #2292 (segmentation fault with cppcheck 1.46 with --errorlist) 2010-12-13 18:17:33 +01:00
Daniel Marjamäki 2d3865a671 Add support for user defined rules 2010-12-12 11:56:22 +01:00
Daniel Marjamäki 69bacde479 Tokenizer: Cleanup redundant statement '; x = x + 0;'. Ticket: #2283 2010-12-09 19:35:52 +01:00
Daniel Marjamäki ee083cd7a0 Fixed #2284 (False positive: Possible null pointer reference) 2010-12-09 18:17:56 +01:00
Daniel Marjamäki 3918aa4953 memory leaks: fixed test that I broke in my last commit 2010-12-09 06:13:59 +01:00
Daniel Marjamäki cad9c5f232 Fixed #2285 (False Positive: memory leak) 2010-12-08 21:02:02 +01:00
Robert Reif 980a90071c Fixed #2282 (Improve check: Function can be const) 2010-12-07 19:42:30 +01:00
Robert Reif 399cc63d2d Symbol database: adds new tests that verify that namespaces work for the class check 2010-12-07 07:08:05 +01:00
Robert Reif 271d8988aa Symbol database: fixed a TODO test where class variables were qualified with the class name 2010-12-07 07:07:36 +01:00
Daniel Marjamäki 26864dd011 Memory leaks: Removed the experimental checking using ExecutionPath. 2010-12-06 21:46:18 +01:00
Daniel Marjamäki 0b696b7079 Fixed #2280 (Tokenizer::setVarId : variable id not set for inner iterator) 2010-12-06 17:52:44 +01:00
Kimmo Varis cdcd3c4a8f Merge branch 'master' of github.com:danmar/cppcheck 2010-12-05 22:25:45 +02:00
Kimmo Varis 3ab725fa04 Add few tests for ErrorLogger. 2010-12-05 22:23:36 +02:00
Robert Reif 626a814241 Symbol database: better handling of inline functions. Ticket: #2219 2010-12-05 20:26:52 +01:00
Daniel Marjamäki b25e6ff24c Fixed #2279 ((style) struct of union member is never used) 2010-12-05 18:33:53 +01:00
Robert Reif c20b8831ee Fixed #2275 (False Positive: Member variable not initialized in the constructor) 2010-12-04 20:24:13 +01:00
Robert Reif 04b811b74f Fixed #2273 (False Positive: Member variable not initialized in the constructor) 2010-12-04 17:47:00 +01:00
Daniel Marjamäki 1f1df0645b Merge branch 'xml2' of github.com:danmar/cppcheck 2010-12-04 14:06:57 +01:00
Kimmo Varis c6c5fc6a1c Add tests for remaining CLI options. 2010-12-04 14:13:44 +02:00
Kimmo Varis d14b5039ce Improve 'Use x.empty() instead of x.size() for emptiness' warning.
Improve the performance warning message as discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192#p926
2010-12-04 10:15:48 +02:00
Kimmo Varis 8369d0ddd6 Improving 'Wrong assignment of auto variable' error message.
Improving the error message as discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-04 09:55:20 +02:00
Robert Reif 758fc85a12 Memory leaks: Determine that some classes are not auto-deallocated. Reduce false negatives. Ticket: #2219 and #1618 2010-12-04 07:29:12 +01:00
Daniel Marjamäki 93ebdca313 Fixed #2264 (False positive: variable assigned value that is never used) 2010-12-03 18:45:49 +01:00
Robert Reif b29568c81d Fixed #2271 (Tokenizer: simplify Qt signals and slots) 2010-12-03 08:14:09 +01:00
Robert Reif 2cd8bc74cc Symbol database: The symbol database has a bug where it can find an out of line constructor when looking for a destructor. Ticket: #2272 2010-12-03 07:35:06 +01:00
Daniel Marjamäki 8118e4755a Fixed #2263 (False positive: variable assigned value that is never used) 2010-12-02 20:08:05 +01:00
Robert Reif eda4bcae29 Fixed #2271 (Tokenizer: simplify Qt signals and slots) 2010-12-02 17:41:49 +01:00
Daniel Marjamäki af80384ae7 xml2: replace --xml2 with --xmlver=2. Ticket: #2106 2010-12-02 17:32:51 +01:00
Robert Reif 1bc8a2b6ba Fixed #2172 (False positive: struct is not initialized in constructor) 2010-12-02 07:35:01 +01:00
Daniel Marjamäki 12c8eeff2c xml2: Added experimental --xml2 result format. Ticket: #2106 2010-12-01 21:24:17 +01:00
Robert Reif f12c0c7ada Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219 2010-12-01 18:00:55 +01:00
Robert Reif 43dcc51752 Fixed #2252 (segmentation fault with enable=all) 2010-11-30 19:52:42 +01:00
Robert Reif f90236a183 Fixed #2252 (segmentation fault with enable=all) 2010-11-30 19:40:32 +01:00
Daniel Marjamäki 0081800a20 Fixed #2261 (False positive: memory leak) 2010-11-30 19:36:04 +01:00
Daniel Marjamäki 6761765a70 Fixed #2262 (False positive: Resource leak: fd) 2010-11-30 19:14:31 +01:00
Daniel Marjamäki 234b1e0098 Fixed #2265 (False positive: Uninitialized variable: path) 2010-11-30 18:40:36 +01:00
Daniel Marjamäki 065af5c444 Fixed #2251 (False positive: Possible null pointer reference) 2010-11-29 20:30:23 +01:00
Daniel Marjamäki cdb685c83c Fixed #2245 (False positive: Possible null pointer dereference) 2010-11-29 20:19:31 +01:00
Daniel Marjamäki 4de64209fb Fixed #2248 (memory leak : pointer inserted in an object) 2010-11-29 19:53:34 +01:00
Kimmo Varis f467e3120e Improve redundant STL container condition -message.
Have separate summary and verbose messages. Se discusion at forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-29 20:24:08 +02:00
Kimmo Varis 8d8945ac57 Improve "Assert statement 'varname' -message.
Modifying the message so that we have short message and verbose
message. As discussed in dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-29 20:12:21 +02:00
Daniel Marjamäki add8584612 Fixed #2232 (segmentation fault of cppcheck) 2010-11-29 17:46:10 +01:00
Kimmo Varis 85735e382f Improve the 'suspicious code sizeof sizeof' -message.
As discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-28 14:20:46 +02:00
Daniel Marjamäki 00da0adf25 Fixed #2236 (False positive: Assignment to itself) 2010-11-28 11:48:06 +01:00
Daniel Marjamäki 095f725b3c Fixed #2218 (False positive: Data is allocated but not initialized) 2010-11-27 17:34:54 +01:00
Daniel Marjamäki 03a92582ca Fixed #2235 (false Resource leak) 2010-11-27 11:09:42 +01:00
Kimmo Varis 2ed14431fe Ticket #2237 (Too long "short" message about iterator increment)
Improve the message for suspicious iterator increment in loop.
2010-11-27 10:57:26 +02:00
Kimmo Varis 837605b05b Ticket #2239 (Too long "short" message about function parameter passing)
Have a proper short message for the parameter passing warning and
improve the message.
2010-11-27 10:46:34 +02:00
Kimmo Varis 9b4b8b2abe Ticket #2238 (Improve postincrement warning message)
Have a proper short message for post ++/-- operators.
Pre ++/-- operators are usually more efficient for non-primitive types.
2010-11-27 10:30:57 +02:00
Kimmo Varis 87b69a10fa Ticket #2240 (Improve no constructor-message).
Improve the message about missing constructor but having class
attributes. Have proper short and long messages.
2010-11-27 10:17:03 +02:00
Daniel Marjamäki 0a744c0c6e Fixed #2234 (Variable is assigned a value that is never used) 2010-11-25 18:16:11 +01:00
Robert Reif 03b12c5494 Fixed #2230 (segmentation fault of cppcheck) 2010-11-25 07:43:39 +01:00
Robert Reif 08b86e0b7e Fixed #2228 (False positive: Claims function can be const when it can not be (shared_ptr)) 2010-11-25 07:15:33 +01:00
Daniel Marjamäki fc57e06cdd Fixed #2226 (segmentation fault of cppcheck) 2010-11-24 18:08:21 +01:00
Daniel Marjamäki 22a4dd2cc3 Fixed #2225 (false positive: variable is assigned a value that is never used '*(stack[0])+=arg') 2010-11-23 20:35:08 +01:00
Robert Reif 1842a122da reuse symbol database in checkmemoryleak.cpp. ticket: #2219 2010-11-23 18:41:07 +01:00
Robert Reif f1eef49fcb Fixed #2221 (segmentation fault of cppcheck) 2010-11-23 07:31:15 +01:00
Daniel Marjamäki 9d88e17c39 Tokenizer::simplifyKnownVariables: Reduce debug-warnings for conditional increment 2010-11-21 13:40:42 +01:00
Daniel Marjamäki ec6edaee6e Buffer overflow: Added unit test that makes sure that array index out of bounds is detected inside loop. Ticket: #2199 2010-11-21 12:24:57 +01:00
Zachary Blair 215cb5ac8d Fixed #2162 (false positive: Mutual exclusion over ||) 2010-11-21 00:06:43 -08:00
Daniel Marjamäki 0fe4249cfc Fixed #2216 (wrong warning when C++0x keyword delete is used) 2010-11-20 17:20:25 +01:00
Daniel Marjamäki e8ca76e02e Fixed #2200 (MathLib: Calculation overflow) 2010-11-20 10:05:33 +01:00
Daniel Marjamäki 9ccc57a455 Fixed #2214 (Improve check: Memory leak not detected when pointer is incremented) 2010-11-20 08:35:23 +01:00
Daniel Marjamäki fd64a7e683 Mutual exclusion: Disable this check until #2162 is fixed. 2010-11-20 07:43:07 +01:00
Daniel Marjamäki 66c2825b23 Fixed #2210 (False positive: buffer overrun (snprintf, unknown type)) 2010-11-18 19:26:46 +01:00
Daniel Marjamäki aa653fe42b Uninitialized variables: Fixed simple undetected case for '= %var% |' and '| %var% ;' 2010-11-16 20:16:44 +01:00
Daniel Marjamäki 35c72db251 Uninitialized variables: Fixed simple undetected case for '= %var% -' 2010-11-16 20:07:41 +01:00
Daniel Marjamäki cbdae275ed Uninitialized variables: Fixed false negative. Ticket: #2207 2010-11-16 20:01:57 +01:00
Robert Reif 77a5d4e399 Fixed #2204 (False positive when using const class members) 2010-11-16 07:30:55 +01:00
Ettl Martin 379daa3f24 fixed: wrong testcase from my last commit im testmathlib.cpp 2010-11-15 22:12:25 +01:00
Ettl Martin 88cc29ea0a mathlib: added todo testcases for ticket #2200 2010-11-15 21:03:49 +01:00
Daniel Marjamäki 29bb553782 Fixed #2207 (False positive: uninitialized variable (return if uninitialized)) 2010-11-15 20:35:01 +01:00
Daniel Marjamäki d250cb5aa2 Fixed #2206 (False positive: variable is assigned a value that is never used (array initializers)) 2010-11-15 17:53:55 +01:00
Daniel Marjamäki 7b3e7f6467 Fixed #2205 (False positive: variable is assigned a value that is never used (assigning to dereferenced casted pointers)) 2010-11-15 17:30:07 +01:00
Daniel Marjamäki 6d1c0687c9 Fixed #2202 (false postive: Data is allocated but not initialized: rbdc) 2010-11-15 17:11:08 +01:00
Zachary Blair 36d80d6eaa Fixed #2058 (Warn for unused variable when only doing malloc/free) 2010-11-14 17:37:36 -08:00
Daniel Marjamäki 378e83e73d Fixed #2201 (false positive: Uninitialized variable: __v0) 2010-11-14 17:35:22 +01:00
Kimmo Varis 41f06cef69 Update VS2010 solution/project files. 2010-11-14 11:04:45 +02:00
Daniel Marjamäki 71c1ce71ce Tokenizer::simplifyKnownVariables: Simplify known variables for struct members 2010-11-13 18:45:35 +01:00
Daniel Marjamäki 723570fe6c Tokenizer: added assertions to check that no debug messages are given. 2010-11-13 17:40:57 +01:00
Daniel Marjamäki 667cc8f6e5 Tokenizer: Skip debug warnings in Tokenizer::simplifyKnownVariables for loop variable 2010-11-13 16:40:04 +01:00
Daniel Marjamäki 5e93281310 Tokenizer: Added TODO test cases for splitting up variable declarations 2010-11-13 15:45:33 +01:00
Daniel Marjamäki 3d195f2326 Auto variables: improved the check for 'return retval.c_str()'. Ticket: #2191 2010-11-13 15:38:21 +01:00
Daniel Marjamäki 47d37e7a05 Uninitialized variables: Fixed false negatives when calling unknown function with uninitialized variable by value: 'f(a+1)' 2010-11-13 15:10:17 +01:00
Daniel Marjamäki 85cafb2035 Visual Studio 2008: Added lib/symboldatabase files 2010-11-13 12:28:49 +01:00
Daniel Marjamäki bf15236b9e Fixed #2196 (False positive: Invalid data is allocated but not initialized (initialization in loop)) 2010-11-13 10:33:35 +01:00
Daniel Marjamäki 3303c40879 uninitialized variables: fixed problem when parsing loop bodies 2010-11-13 08:03:59 +01:00
Daniel Marjamäki f7ca4f09ef Fixed #2151 (false negative: memory leak when calling subfunction that doesn't deallocate the memory) 2010-11-12 21:09:34 +01:00
Daniel Marjamäki a8d7ac0f0d Fixed #2193 (false negative: nullpointer dereference) 2010-11-12 19:42:02 +01:00
Daniel Marjamäki 9d7a623985 Uninitialized variables: Passing uninitialized array as parameter to function. Ticket: #2188 2010-11-12 17:38:25 +01:00
Daniel Marjamäki e523d5a3a3 Fixed #914 (improve check: usage of uninitialized variable) 2010-11-12 17:14:37 +01:00
Daniel Marjamäki 1204043556 Fixed #2148 (uninitialized variable: false negative, function parameter that is passed by value) 2010-11-12 17:06:14 +01:00
Daniel Marjamäki 6b489230e8 Fixed #2188 (Does not detect initialization) 2010-11-12 16:11:44 +01:00
Daniel Marjamäki ba7a3b376e Fixed #2167 (Drop linefeeds from error messages) 2010-11-11 19:54:43 +01:00
Daniel Marjamäki 0328d26fcb Fixed #2192 (false positive: resource leak) 2010-11-11 17:40:20 +01:00
Robert Reif 07f4067fa8 typedef: better handling of __typeof__ 2010-11-11 17:02:04 +01:00
Robert Reif a09c221014 typedefs: handle __typeof__ 2010-11-11 06:40:49 +01:00
Daniel Marjamäki 624ce205b9 Fixed #2185 (False negative: when constant is undefined a 'dangerous usage of strncpy' is not found) 2010-11-10 20:20:05 +01:00
Daniel Marjamäki 41bbe5d0cf Fixed #2182 (Context sensitive false positive) 2010-11-10 18:24:40 +01:00
Daniel Marjamäki 28c53cabea Fixed #2184 (False Positive: memory leak) 2010-11-10 17:46:40 +01:00
Daniel Marjamäki 508c171945 Symbol database: add support for class inline functions with classes 2010-11-09 17:06:07 +01:00
Robert Reif 36b03bdd3e Fixed #2179 (Segmentation fault in assignment operator) 2010-11-09 06:58:19 +01:00
Daniel Marjamäki c2bf3647a4 Fixed #2178 (segmentation fault of cppcheck) 2010-11-08 19:47:19 +01:00
Daniel Marjamäki 586f4992d8 Tokenizer::simplifyKnownVariables: Fixed TODO test cases in TestBufferOverrun 2010-11-07 17:42:32 +01:00
Daniel Marjamäki cd94fa89e0 Tokenizer: More specific bail outs in simplifyKnownVariables 2010-11-07 11:07:56 +01:00
Daniel Marjamäki b881718d9f Tokenizer: better bailout in simplifyKnownVariables when there is loop 2010-11-07 10:42:08 +01:00
Daniel Marjamäki fb068a4e71 Fixed #2170 (false positive: After a strncpy() the buffer should be zero-terminated) 2010-11-07 09:37:45 +01:00
Daniel Marjamäki bd2b1b2914 Tokenizer: better handling of const variables 2010-11-07 08:43:30 +01:00
Daniel Marjamäki 25391cb562 Tokenizer: Bailout simplifyKnownVariables for loop variables 2010-11-07 08:10:09 +01:00
Robert Reif 662cd27f87 Symbol database: fixed problem 2010-11-06 20:27:12 +01:00
Daniel Marjamäki 5be12a1d27 Tokenizer: improved simplifyKnownVariables 2010-11-06 19:43:32 +01:00
Robert Reif 8a379d4826 Fixed #2176 (Tokenizer::simplifyTypedef function pointer bug) 2010-11-06 15:15:50 +01:00
Robert Reif c49a8a99a3 Fixed #2175 (Tokenizer::simplifyTypedef : wrong simplification of 'typedef float vec_t[3];') 2010-11-06 13:28:44 +01:00
Daniel Marjamäki c39fbb86db Tokenizer::simplifyKnownVariables : Fixed TODO test case when simplifying pointer alias in function call 2010-11-06 13:24:33 +01:00
Daniel Marjamäki 13c2a73d3f Tokenizer::simplifyKnownVariables: Fixed TODO test case. 2010-11-06 11:38:58 +01:00
Daniel Marjamäki 694853249f Refactoring: Added ASSERT_EQUALS above TODO_ASSERT_EQUALS to catch changes in the behaviour better 2010-11-06 11:08:05 +01:00
Daniel Marjamäki e901ee2e68 Added TODO unit test for ticket #2175. simplify 'typedef float x[3];' 2010-11-06 09:31:43 +01:00
Daniel Marjamäki dd41c74d7f Fixed #2136 (false negative: array bounds) 2010-11-06 09:10:10 +01:00
Daniel Marjamäki 314e5b838b Tokenizer: removed redundant assignments such as 'x+=0;'. Ticket: #2173 2010-11-06 07:23:35 +01:00
Robert Reif 431201dd67 Fixed #2174 (Tokenizer::simplifyFunctionReturn bug) 2010-11-06 06:53:09 +01:00
Daniel Marjamäki 52faadda89 Tokenizer: simplify calculations with zero better 2010-11-05 20:35:31 +01:00
Daniel Marjamäki 4fdb420454 Tokenizer: simplifyknownvariables, improved handling of string constant 2010-11-05 20:05:57 +01:00
Daniel Marjamäki 65c7b6eb8b Uninitialized variables: better handling of for example 'a[1] = 1+a[2];' 2010-11-05 19:24:14 +01:00
Daniel Marjamäki a90a7202cb Uninitialized variables: detect usage of dead pointer: '*p += 10' 2010-11-05 17:04:41 +01:00
Daniel Marjamäki 95bfa50d7e Null pointers: Fixed false negatives in the CheckAndDeRef checking 2010-11-04 21:22:29 +01:00
Daniel Marjamäki f3bf14ba13 Fixed #2171 (false positive: possible nullpointer dereference) 2010-11-04 21:09:32 +01:00
Daniel Marjamäki d21974777c Fixed #2161 (false positive: assigned a value that is never used) 2010-11-04 20:16:17 +01:00
Daniel Marjamäki fce6f11ed8 Tokenizer: simplify 'a[b-1]+=1' better 2010-11-04 19:02:54 +01:00