Commit Graph

2664 Commits

Author SHA1 Message Date
Daniel Marjamäki 654116af61 Tokenizer::simplifyTemplates: Broke out handling for 'template<>..' 2011-02-12 19:43:33 +01:00
Daniel Marjamäki 518a495334 Fixed #2576 (False positive: (error) Buffer access out-of-bounds) 2011-02-12 18:34:12 +01:00
Daniel Marjamäki 07e8325e50 Fixed #2549 (segmentation fault of cppcheck) 2011-02-12 16:51:59 +01:00
Daniel Marjamäki 7507f64ee7 Fixed #2558 (false positive: (error) Returning reference to auto variable) 2011-02-12 15:39:26 +01:00
Daniel Marjamäki 2657d36d03 Fixed #2502 (False positive: redundant assingment of object to itself) 2011-02-12 14:27:07 +01:00
Daniel Marjamäki 318f2e8a57 Fixed #2561 (False positive on array index when using conditional operator) 2011-02-12 11:31:10 +01:00
Daniel Marjamäki 63ade3e4f6 Tokenizer::simplifyKnownVariables: Split up the function into smaller functions. Broke out ..GetData function that extracts info about assigned variable before the simplification is made. 2011-02-12 09:24:20 +01:00
Daniel Marjamäki 27febb062b cppcheck: Added HAVE_DEPENDENCIES define. Cppcheck cli can be compiled without dependencies. 2011-02-12 08:06:59 +01:00
Robert Reif 78b5361ec8 fix #2568 (False positive: (style) Union 'A_t' hides typedef with same name (forward declaration)) 2011-02-11 19:09:24 -05:00
Sébastien Debrard f5ed52b84b fix #2569 check postfix increment on boolean 2011-02-11 23:38:23 +01:00
Daniel Marjamäki 951a81d0d2 Tokenizer::simplifyKnownVariables: Broke out the simplification into a separate function 2011-02-11 20:12:51 +01:00
Daniel Marjamäki 227a6100f7 astyle formatting 2011-02-11 19:31:37 +01:00
Greg Hewgill f2f2d1f885 Fixed #2571 (Preprocessor: better handling for #undef) 2011-02-11 18:51:22 +01:00
Greg Hewgill 751f8d46e5 Fixed #2570 (Preprocessor: #define parsing when there is no whitespace between a macro symbol and its double-quoted string expansion) 2011-02-11 18:01:27 +01:00
Robert Reif b8c5426bb8 fix #2567 Unused private function when implemented in different file 2011-02-11 08:00:41 -05:00
Erik Lax b3e8ef9d48 Fixed #2559 (Refactoring Preprocessor::read) 2011-02-11 06:30:42 +01:00
Daniel Marjamäki 08811c8179 CheckBufferOverrun: Refactoring. Broke out checkScope code for parsing 'for' bodies 2011-02-10 21:56:06 +01:00
Reijo Tomperi a71204b8e3 Change "tinyxml/tinyxml.h" includes into <tinyxml.h> and modify dmake to work with it.
This should allow usage of libtinyxml-dev or such libraries without modifications to code or makefile.
2011-02-10 22:35:48 +02:00
Robert Reif 2900d44ff0 #2560 (False positive: The class 'Altren' does not have a constructor, because base class is in namespace.) 2011-02-10 07:37:55 -05:00
Robert Reif e6848aef98 Tokenizer: refactor duplicated token copy code info function 2011-02-09 22:02:17 -05:00
Daniel Marjamäki 5175e4ff3f Fixed #2535 (false positive: (style) Variable 'A' is not assigned a value) 2011-02-09 19:20:44 +01:00
Robert Reif 301f83767e replace tok->strAt(0) with tok->str() 2011-02-09 07:45:19 -05:00
Robert Reif 7502cea4d3 Fixed #2554 (simplifyTypedef: wrong simplification for sizeof(array)) 2011-02-08 19:47:14 -05:00
Daniel Marjamäki 56ae77ba87 Fixed #2555 (Cppcheck 1.47 - Crash on WinMerge-Trunk (Win7 x64)) 2011-02-08 20:18:15 +01:00
Erik Lax aeae5a867d Fixed #2550 (Bad substr/strncmp comparison) 2011-02-08 19:49:29 +01:00
Greg Hewgill 7a219b1fb8 support wildcard characters * and ? in suppression list 2011-02-09 00:19:57 +13:00
Greg Hewgill a9f2879889 factor out file matching into own class 2011-02-09 00:19:56 +13:00
Robert Reif 1e0d538273 checkautovariables: refactor to use the symbol database 2011-02-07 19:26:34 -05:00
Daniel Marjamäki 7c9e52546d Fixed #2552 (preprocessor check XX is already guaranteed to be defined -- too eager?) 2011-02-07 20:26:29 +01:00
Daniel Marjamäki 4a7c56f970 1.47: Updated versions 2011-02-06 12:05:42 +01:00
Zachary Blair 44a350a6dc Ticket #2388. Added more detail to the 'exceptRethrowCopy' error message. 2011-02-06 02:01:14 -08:00
Zachary Blair daa04872a0 Merge branch 'master' of github.com:danmar/cppcheck 2011-02-06 01:31:09 -08:00
Daniel Marjamäki f7dcf2d3b9 Tokenizer: Added a comment about sizeof for struct/class. We always assume that the size is 100 2011-02-06 09:58:07 +01:00
Zachary Blair 8a494cf8bb Fixed #2388 (Use throw without argument to rethrow exceptions) 2011-02-05 01:11:09 -08:00
Robert Reif 95e917b27f Tokenizer: Replace __null with 0 (gcc constant) 2011-02-05 09:03:31 +01:00
Robert Reif c592ccd35d Fixed #2547 (segmentation fault of cppcheck) 2011-02-05 08:59:59 +01:00
Daniel Marjamäki 5640845a17 Fixed #2498 (False positive: redundant assignment) 2011-02-04 21:08:42 +01:00
Daniel Marjamäki d06fde77ff Fixed #2531 (False positive: Redudant assignment to itself) 2011-02-04 20:55:38 +01:00
Daniel Marjamäki dbc5929fa2 Fixed #2503 (false positive: memory leak (struct member, address is taken)) 2011-02-04 20:41:35 +01:00
Robert Reif f87056fca3 Fixed #2539 (segmentation fault of cppcheck) 2011-02-04 20:19:49 +01:00
Robert Reif 514c9b9b23 Fixed #2546 (make CheckMemoryLeakInClass also check structures) 2011-02-04 20:17:25 +01:00
Daniel Marjamäki 447d29938e Fixed #2544 (XML output does not specify encoding used) 2011-02-04 20:14:19 +01:00
Kimmo Varis 7d73b523be Clarify few verbose messages.
Dan pointed out to me earlier that he wants both short- and
verbose messages to be independently understandable. So modifying
some verbose messages to be easier to understand without the short
message.
2011-02-04 11:10:24 +02:00
Daniel Marjamäki 39c68e12ce Fixed #2533 (false positive: (error) Uninitialized variable: cBuffer) 2011-02-03 22:29:32 +01:00
Daniel Marjamäki 398190460f astyle formatting 2011-02-03 22:20:59 +01:00
Robert Reif e9ec4bc3e4 Fixed #2536 (cppcheck hangs with 100% cpu load) 2011-02-03 07:58:49 +01:00
Robert Reif 8288c28b3f Fixed #2537 (segmentation fault of cppcheck) 2011-02-03 07:57:10 +01:00
Raphael Geissert c9a0d95e89 A few more Token::Match -> ::simpleMatch replacements 2011-02-02 13:27:02 -06:00
Raphael Geissert f8e2d50e6f Use Token::simpleMatch where no special patterns are needed 2011-02-02 13:27:02 -06:00
Raphael Geissert 45e5dc20a2 Try to match custom rules as many times as possible, not just once 2011-02-02 13:27:02 -06:00
Raphael Geissert 15dceed6cd Remove uneeded indentation 2011-02-02 13:27:01 -06:00
Raphael Geissert 8d5863133c Use Token::simpleMatch where no patterns are used 2011-02-02 13:27:01 -06:00
Raphael Geissert cf2b6f7bc1 Remove useless spacing at the end of *Match strings 2011-02-02 13:27:01 -06:00
Raphael Geissert d592250284 Fix sizeof sizeof check to handle sizeof(sizeof type) 2011-02-02 11:49:32 -06:00
Daniel Marjamäki 9a383388be xml2: added <errors> element 2011-02-02 18:46:07 +01:00
Greg Hewgill bea36d1f83 use instances of less<Check *> to compare pointers for list::sort() 2011-02-02 22:58:25 +13:00
Greg Hewgill be195a72c9 initialise Check::_name in constructor rather than relying on virtual Check::name() 2011-02-02 22:58:25 +13:00
Robert Reif 8eb92001b3 Fixed #2530 (Tokenizer: Remove redundant 'MyClass::' inside MyClass class declaration) 2011-02-02 07:40:08 +01:00
Daniel Marjamäki defeded4b5 Fixed #2529 (False positive: array 'req[3]' index 4 out of bounds) 2011-02-01 21:46:07 +01:00
Kimmo Varis c2de1a8a52 Convert "too many configurations" message to information message.
The "too many configurations"-message is currently only printed to the
log. So it won't be seen by users integrating Cppcheck using XML
error file. It is also easily missed in the GUI as it only shows up
in the checking log. Making it a information message it shows up
with the other errors and tells user that file was not completely
checked.

Ticket #2527 (Make "too many configurations" message an error message)
2011-02-01 17:53:30 +02:00
Daniel Marjamäki 202c8eb4a0 Fixed #2525 (False positive 'Possible null pointer dereference') 2011-01-31 17:30:27 +01:00
Raphael Geissert 386de53ff7 Formatting, sorry 2011-01-30 20:37:37 -06:00
Raphael Geissert 29ca5fbe1e Minor optimisations to the preprocessor 2011-01-30 18:47:49 -06:00
Raphael Geissert b4a249f26e Reduce std::string::find() abuse 2011-01-30 18:40:59 -06:00
Raphael Geissert 66253af1e5 Handle "#endif !defined" conditionals 2011-01-30 17:33:44 -06:00
Raphael Geissert b944168bdc Check for cpp conditionals where a define is already guaranteed 2011-01-30 12:47:17 -06:00
Raphael Geissert 5137f5fb7f Detect null pointer dereferences for many FILE-related functions
Ticket #1415: check for calling f{eof,read,close,...} with NULL
2011-01-30 02:34:58 -06:00
Raphael Geissert 49848fd752 Remove duplicated defines
After simplifying define(A) conditionals, the final list of
configurations could end up containing duplicate items.

Ticket #1468
2011-01-30 02:13:32 -06:00
Robert Reif 09998d9e18 Memory leaks: less conservative checking of classes. ticket: #2517 2011-01-30 08:38:20 +01:00
Daniel Marjamäki 49fc53165c Tokenizer: remove some unhandled macros in the global scope. ticket: #2523 2011-01-30 08:34:58 +01:00
Daniel Marjamäki 0624e418f1 Memory leaks: bug fix. don't skip '}' by accident 2011-01-29 18:46:55 +01:00
Daniel Marjamäki a299411a82 Tokenizer: Better simplifications of static constants 2011-01-29 16:14:09 +01:00
Daniel Marjamäki 83625d8055 Fixed #2505 (Check processing of a preprocessor macro 'FREE') 2011-01-28 09:19:30 +01:00
Robert Reif 79862573ba Symbol database: better unit testing. ticket: #2468 2011-01-28 08:33:02 +01:00
Daniel Marjamäki 88abeeebba Fixed #2518 (Crash when checking rockbox's firmwire) 2011-01-27 21:16:25 +01:00
Daniel Marjamäki 524498e439 Tokenizer: collapse operator function names into a single token. ticket: #2519 2011-01-27 18:44:20 +01:00
Sébastien Debrard 078c36921d runastyle 2011-01-26 20:10:56 +01:00
Sébastien Debrard 3e7f29d6f9 fix #2510 Improve check 'sizeof for array given as function argument' 2011-01-26 20:08:06 +01:00
Sébastien Debrard 5d661d25a8 typo: message 2011-01-26 09:35:11 +01:00
Sébastien Debrard e82c190429 Merge branch 'master' of https://github.com/danmar/cppcheck
Conflicts:
	test/testother.cpp
2011-01-25 10:05:03 +01:00
Sébastien Debrard 4cf56dac2b Fix 2495 incorrect sizeof error message 2011-01-25 09:57:58 +01:00
Daniel Marjamäki a596a7a8fe Fixed #2494 (New check: clarify calculation when using ?: operator) 2011-01-24 21:40:49 +01:00
Sébastien Debrard c7b8bd543f fix ticket 155 - char array 2011-01-24 19:04:56 +01:00
Robert Reif f5b26222ff Symbol database: better handling of functions returning function pointer. ticket: #2468 2011-01-23 22:31:35 +01:00
Daniel Marjamäki 586cbd5839 Tokenizer: Upon createLinks error, report error and bailout 2011-01-23 09:38:38 +01:00
Daniel Marjamäki b10f0aabd6 Fixed #2376 (simplifyTypedef: upx-ucl) 2011-01-23 09:04:34 +01:00
Robert Reif 2a3cce5001 Symbol database: fixed corruptions. ticket: #2468 2011-01-23 08:41:31 +01:00
Daniel Marjamäki 86e6822264 Fixed #2493 (false positive: (error) Possible null pointer dereference: pExpr) 2011-01-23 08:38:09 +01:00
Daniel Marjamäki 9d3b242cd8 Fixed #1952 (false negative: buffer acces out of bounds with memcpy) 2011-01-22 21:31:26 +01:00
Debrard Sébastien 27dce075e0 Fixed #155 (check size of a variable whose type is a sized array) 2011-01-22 19:21:56 +01:00
Robert Reif 8abae6f1e5 Symbol database: match copy-constructor better. ticket: #2484 2011-01-22 17:43:36 +01:00
Daniel Marjamäki 1e25d74ba4 Class: better check if there are friends. ticket: #2459 2011-01-22 17:35:54 +01:00
Daniel Marjamäki f947955c63 Fixed #2492 (False positive: memory leak 'return &self->foo;') 2011-01-22 13:40:19 +01:00
Daniel Marjamäki 9551332321 Fixed #2459 (False positive with unused private function and friend) 2011-01-22 13:00:03 +01:00
Daniel Marjamäki 5c88129f01 Fixed #2484 (false positive because template is not instantiated properly) 2011-01-22 12:42:53 +01:00
Daniel Marjamäki bc31f317bc Fixed #2491 (Tokenizer::setVarId : wrong handling of function call: 'a(b * c, 1);') 2011-01-22 09:27:16 +01:00
Robert Reif 0746c2410a Symbol database: Fixed memory leak. ticket: #2468 2011-01-22 08:36:47 +01:00
Robert Reif 69eee86ee4 Tokenizer: Only create 1 symbol database. ticket: #2468 2011-01-22 08:34:24 +01:00
Robert Reif 767e01e24a Fixed #2478 (Crash when trying to analyze files (CheckClass::checkReturnPtrThis)) 2011-01-21 19:54:41 +01:00
Robert Reif d73709a620 Symbol database: rename variables. ticket: #2468 2011-01-21 07:42:41 +01:00
Daniel Marjamäki 87e3e9e703 Fixed #2488 (false positive with updating iterator in a for loop) 2011-01-20 20:48:35 +01:00
Daniel Marjamäki a21f8eec7c Fixed #2481 (false positive with break: After insert, the iterator '*' may be invalid) 2011-01-20 19:26:52 +01:00
Robert Reif 9dce0dd75c Symbol database: refactoring of classAndStructTypes parsing. ticket: #2468 2011-01-20 18:02:52 +01:00
Daniel Marjamäki 70eadb37bd Fixed #2481 (false positive with 'break;': After insert, the iterator '*' may be invalid) 2011-01-19 21:00:46 +01:00
Daniel Marjamäki ecac93ebed Fixed #2462 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant) 2011-01-19 18:37:33 +01:00
Pete Johns 94aafa482c Fixed #2480 (false positive on unused private function) 2011-01-19 20:32:08 +11:00
Daniel Marjamäki 856a631f35 Fixed #2483 (SymbolDatabase compiler warning (VS2008/VS2010)) 2011-01-19 07:33:38 +01:00
Kimmo Varis b8b2e3fae9 Move filelister* to cli.
Ticket #2445 (Move FileLister classes from LIB to CLI).
2011-01-18 19:58:49 +02:00
Kimmo Varis 86ac25456e Move sameFileName() method to Path class.
Ticket #2445 (Move FileLister classes from LIB to CLI). Moving
sameFileName() to Path allows moving FileLister* classes to CLI.
2011-01-18 19:58:16 +02:00
Pete Johns 0e1bab6dc3 Merge branch 'multi_indirection_templates' 2011-01-18 21:08:04 +11:00
Pete Johns ea01c04108 Added parenths to fix build breakage. 2011-01-18 21:07:33 +11:00
Pete Johns 62063aa250 Refactored to remove code duplication. 2011-01-18 20:51:57 +11:00
Pete Johns abfd907763 Made isVariableDeclarationIdentifiesTemplatedPointerToPointerVariable() pass.
And added isVariableDeclarationIdentifiesTemplatedArrayVariable() (passing) into the bargain.
2011-01-18 20:14:12 +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
Robert Reif c994508c3e Symbol database: Refactor the variables API. ticket: #2468 2011-01-18 07:32:06 +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
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
Zachary Blair 481907ef14 Fixed #2457 (CheckOther::checkIncorrectLogicOperator: hang if variable id is 0) 2011-01-16 13:57:29 -08:00
Pete Johns 9c300813a4 Fixed gcc warning. 2011-01-17 08:52:26 +11: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 93d1313186 Refactoring: Check if type is class/struct through symbol database 2011-01-16 19:57:29 +01:00
Daniel Marjamäki e6a1efa13b Fixed #2302 (Duplicate id 'unusedVariable') 2011-01-16 18:45:05 +01:00
Robert Reif d341b42b0c Symbol database: increased constness. ticket: #2468 2011-01-16 18:13:54 +01:00
Daniel Marjamäki 657c22d23b cppcheck: output errorlist to stdout 2011-01-16 17:18:09 +01:00
Robert Reif 66be74a5af Symbol database: Refactorings. Move check-specific code to check. Ticket: #2468 2011-01-16 16:37:11 +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 8ef47dc576 astyle formatting 2011-01-16 09:57:56 +01:00
Daniel Marjamäki 8fa26fbd28 Memory leaks: Optimised and refactored 2011-01-16 09:56:04 +01:00
Daniel Marjamäki 433ae8abf4 STL: Optimised checking 2011-01-15 22:38:05 +01:00
Daniel Marjamäki bb2862bc97 fixed unit test 2011-01-15 21:04:20 +01:00
Daniel Marjamäki 94ebb24d3d Optimising: about 5% improvement with Visual Studio executable 2011-01-15 20:55:51 +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 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
Kimmo Varis dffe1a0acd Fix doxgen comment. 2011-01-13 23:25:17 +02:00
Kimmo Varis 4668e19060 Modify Cppcheck::addFile() only take one file as a parameter.
CLI and GUI already do the directory walking for us and we have list
of files to check. So we were duplicating this directory walking.
Practically doing check again for each file if it is a directory.
Which can take some time with large amount of files.
2011-01-13 23:18:04 +02: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 88abb32ddf Fixed #2429 (Tokenizer: Wrong simplification of 'sizeof .1250E+04') 2011-01-09 10:09:54 +01:00
Daniel Marjamäki d316f6005f Fixed #2409 (print a warning if provided path (commandline option -I [PATH]) does not exist) 2011-01-09 09:29:38 +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 &quot; with ' around variable name 2011-01-08 14:35:18 +01:00
Daniel Marjamäki d758929490 Fixed #2433 (strtol: false positive when strtol isn't used in function call) 2011-01-08 09:23:51 +01:00
Daniel Marjamäki d27b6a1598 astyle formatting 2011-01-07 20:48:02 +01:00
Daniel Marjamäki 14cbaebfe2 Fixed #2428 (false alarm with code containing a throw clause) 2011-01-07 20:45:33 +01:00
Daniel Marjamäki 989e0e7ccb Preprocessor: fix bug when determining location when there is a missing include. ticket: #2326 2011-01-07 19:48:51 +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
Robert Reif 56ffde402f Fixed #2425 (segmentation fault of cppcheck) 2011-01-07 07:42:00 +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 a7835c4054 Preprocessor: Reverted fix for #2131, it didn't work well so a better fix is needed 2011-01-06 20:01:09 +01:00
Daniel Marjamäki 37b1f7c296 memsetZeroBytes: improved error message. ticket: #2421 2011-01-06 16:27:22 +01:00
Daniel Marjamäki 77ed6ecb5d Null pointers: Added comments 2011-01-06 13:18:49 +01:00
Daniel Marjamäki 04a117938d Buffer overrun: Added comments 2011-01-06 13:02:21 +01:00
Daniel Marjamäki ca294544ca CheckStl: Added comments 2011-01-06 12:20:54 +01:00
Daniel Marjamäki 616914c1ff Tokenizer: simple refactorings. and added a few comments 2011-01-06 12:07:37 +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
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
Daniel Marjamäki a0d62e041f Tokenizer: Fixed memory corruption 2011-01-05 19:38:22 +01:00
Robert Reif 157498e694 Fixed #2412 (typedef: struct with inheritance) 2011-01-05 17:42:55 +01:00
Robert Reif ed6f683573 typedef: better handling. ticket: #2414 2011-01-05 17:39:53 +01:00
Zachary Blair 188871c428 Removed an unnecessary newline in the message. Ticket #2343 2011-01-05 00:06:53 -08:00
Zachary Blair 3f97bd5477 Fixed #2343 (The ftime obsolete function warning seems wrong) 2011-01-04 23:21:02 -08: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 c2a194ead0 Fixed #2393 (Token::Match called with varid 0) 2011-01-04 18:34:51 +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
Daniel Marjamäki 85897c3991 Merge branch 'debug-warnings' of https://github.com/rgeissert/cppcheck into rgeissert-debug-warnings 2011-01-04 18:17:39 +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
Robert Reif 63ad1fbe69 Fixed #2400 (Tests crashing in Windows) 2011-01-04 07:34:32 +01:00
Raphael Geissert 2b1ec9a07f Mention the name of the variable in the inconclusive leak msg 2011-01-03 20:40:31 -06: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
Raphael Geissert e75a81669e Move simplification of realloc after simplification of math ops 2011-01-02 16:41:34 -06:00
Daniel Marjamäki d2714fefda typedef: Fixed testcase. ticket: #2375 2011-01-02 17:28:47 +01:00
Daniel Marjamäki 97f7a36e91 Buffer overruns: Added comments 2011-01-02 14:16:58 +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 b5876f00ff Fixed #2391 (cstdlib file and memory function check misbehavior) 2011-01-02 08:32:51 +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 789d944912 typedef: don't simplify typedef after 'case'. it means that there is a typedef and constant with the same names. Ticket: #2386 2011-01-01 20:20:03 +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 c8775344d6 uninitialized variables: Added some comments 2011-01-01 18:24:27 +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 3eabb4ebe0 Added comments in the memory leaks checking 2011-01-01 13:28:34 +01:00
Daniel Marjamäki 0cc49188c0 Memory leaks: localized variables 2011-01-01 12:27:57 +01:00
Daniel Marjamäki 62145431a7 Tokenizer: Added more comments 2011-01-01 11:40:32 +01:00
Daniel Marjamäki e385323b65 Tokenizer: Added doxygen comments 2011-01-01 11:26:48 +01:00
Daniel Marjamäki 71acf78c64 Tokenizer: added doxygen comments 2011-01-01 09:26:24 +01:00
Zachary Blair 68700b3561 Fixed #2382 (Catching exceptions by value instead of reference) 2010-12-31 12:48:24 -08: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 3e5614a5a3 Null Pointer: Refactoring - broke out CheckNullPointer::isPointer 2010-12-31 18:30:04 +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
Daniel Marjamäki b04885cd4f astyle formatting 2010-12-31 15:57:08 +01:00
Daniel Marjamäki 4d8fae186b added more comments 2010-12-31 15:56:41 +01:00
Daniel Marjamäki b634242a58 Added comments for CheckNullPointer::nullPointerLinkedList 2010-12-31 14:37:34 +01:00
Daniel Marjamäki 377bcbe729 Remove redundant condition 2010-12-31 14:24:15 +01:00
Daniel Marjamäki 1a8c410c06 gcc: fixed compiler warning (suggest parantheses around assignment) 2010-12-31 14:18:24 +01:00
Daniel Marjamäki 3de9d9cb31 Refactoring and commenting CheckNullPointer::nullPointerAfterLoop 2010-12-31 14:17:10 +01:00
Daniel Marjamäki 59c86b5876 added doxygen comments 2010-12-31 14:16:22 +01:00
Daniel Marjamäki 1fa730d963 added some comments 2010-12-31 13:58:17 +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 f1f1a21c23 Borland C++: Fixed compiler errors 2010-12-31 10:24:51 +01:00
Daniel Marjamäki d8f241e033 gcc: fixed -Wconversion errors 2010-12-31 09:51:27 +01:00
Daniel Marjamäki 68b9c6ec94 gcc: Fixed -Wconversion warnings in symbol database 2010-12-31 09:39:42 +01:00
Daniel Marjamäki cab338dffe gcc: fixed -Wconversion warnings in tokenizer 2010-12-31 09:38:03 +01:00
Daniel Marjamäki fa3853803b gcc: fixed -Wconversion warnings 2010-12-31 09:30:56 +01:00
Daniel Marjamäki f3ce02462e improved TODO comments 2010-12-30 22:41:22 +01:00
Daniel Marjamäki c7f2ddf63c CheckStl: Added comments 2010-12-30 22:36:25 +01:00
Daniel Marjamäki d005245188 fixed doxygen warnings 2010-12-30 22:13:31 +01:00
Daniel Marjamäki 742f5897b9 gcc: fixed compiler warning 2010-12-30 22:13:10 +01:00
Daniel Marjamäki 3d60d33280 Added comments 2010-12-30 22:07:27 +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
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
Daniel Marjamäki fd27be2440 Fixed #2372 (internal error in logicaloperator check (varid=0)) 2010-12-29 10:07:28 +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
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
Daniel Marjamäki 660de98c0c Fixed #2365 (Internal error: Token::Match called with varid 0) 2010-12-27 14:06:32 +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
Pete Johns 59acbb3da0 Fixed Linux build.
OSX built without limits.h
2010-12-26 23:08:51 +11: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 4fd8d2e056 Fixed #2326 (Preprocessor: inline-suppr does not work for id=missingInclude) 2010-12-26 11:14:57 +01:00
Pete Johns 7943d8ce53 canonicalize_file_name() is a GNU-extension.
Replaced with call to realpath() to build on non-Linux systems, such as Mac OSX.
2010-12-26 14:15:42 +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 65041cf0ff Fixed #2349 (Empty 'msg' in output when using '-j') 2010-12-24 11:13:57 +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 b89f486d0d Fixed #2344 (FileLister Unix: Don't convert to absolute paths) 2010-12-22 21:01:51 +01:00
Daniel Marjamäki be46d453c4 Information: Added new severity 2010-12-22 19:53:17 +01:00
Daniel Marjamäki 22a1f3332f xml2: changed the format of the cppcheck-version info 2010-12-22 18:45:09 +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 3a612d7cd8 xml2: Added cppcheck-version 2010-12-22 10:29:23 +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 c0bedb5036 Fixed #2331 (Token::Match is called with varid 0) 2010-12-19 21:27:28 +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 1cd6f16ecf Fixed #2322 (cppcheck follows recursive symlinks) 2010-12-19 11:22:27 +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 41ac2c252f Fixed #2325 (Tokenizer: Remove for-loop if condition is false) 2010-12-18 21:43:12 +01:00
Robert Reif a2aa601899 CheckOther: Use SymbolDatabase. Ticket: #2318 2010-12-18 20:35:40 +01:00
Kimmo Varis 062eabf246 Don't use relative paths in lib.pri.
Using relative path in included file binds it to be usable only
included from one directory. Instead use variable for giving the
base path for files.
2010-12-18 17:03:46 +02:00
Daniel Marjamäki 79ea453913 Preprocessor: Report 'missing system include' with debug severity. temporary solution until the handling of system includes is better. 2010-12-18 14:45:53 +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 18933ea0e6 QMake: auto-generate the visual studio project files with qmake 2010-12-17 21:43:47 +01:00
Daniel Marjamäki 814efb2512 Fixed #2313 (False Positive: memory leak) 2010-12-17 21:34:22 +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 e0a0ed6fac removed the NOLONGLONG handling. it seems unlikely it is needed 2010-12-16 21:53:18 +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
Robert Reif f2d69acbfd Symbol database: reuse in CheckOther. Ticket: #2318 2010-12-16 19:04:47 +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
Kimmo Varis ac8eb30d68 Fixed #2309 (cppcheck-suppress issue because of path slash/backslash)
Internally we are using forward-slash and only convert to backslash
for Windows output. For suppressing we must use internal
forward-slash format of paths.
2010-12-15 22:39:46 +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 48241c81f8 dmake: add include path '../externals' to lib.pri in case the pcre.h is placed there. 2010-12-12 17:26:13 +01:00
Daniel Marjamäki 2d3865a671 Add support for user defined rules 2010-12-12 11:56:22 +01:00
Daniel Marjamäki b90e514b32 1.46: updated version information 2010-12-12 08:33:05 +01:00
Daniel Marjamäki 1cfd3309bc XML2: Added severity 'portability' for future use. Ticket: #2106 2010-12-11 21:54:06 +01:00
Daniel Marjamäki 9de016b96d Obsolete functions: added better verbose messages 2010-12-09 19:49:33 +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
Robert Reif 4d2c210f2a Symbol database: use in checkmemoryleaks.cpp. ticket: #2219 2010-12-09 06:15:01 +01:00
Daniel Marjamäki cad9c5f232 Fixed #2285 (False Positive: memory leak) 2010-12-08 21:02:02 +01:00
Robert Reif c6e67d4aad Symbol database: use symbol database in the memory leaks function checking. Ticket: #2219 2010-12-08 07:49:01 +01:00
Robert Reif 980a90071c Fixed #2282 (Improve check: Function can be const) 2010-12-07 19:42:30 +01:00
Robert Reif b6acfa809b Symbol database: creates a single symbol database within Tokenizer on demand and changes all checks to use it 2010-12-07 07:08:49 +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
Robert Reif 6c719c5806 Symbol database: removed unnecessary null pointer checks 2010-12-07 07:07:07 +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
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 ab336b9088 Tokenizer: Added a few comments 2010-12-04 15:49:25 +01:00
Daniel Marjamäki 11a0ac4e07 xml2: rename '--xmlver' to '--xml-version'. bugfix in settings, change the type of _xml_version from bool to int. 2010-12-04 14:20:51 +01:00
Daniel Marjamäki 1f1df0645b Merge branch 'xml2' of github.com:danmar/cppcheck 2010-12-04 14:06:57 +01: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
Daniel Marjamäki 66f0948395 Preprocessor: Don't include system headers twice. 2010-12-02 18:07:32 +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
Daniel Marjamäki b4be71aa4e checkuninitvar: fixed possible null-pointer dereference. thanks orbitcowboy for spotting it. 2010-12-01 18:05:57 +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
Kimmo Varis 1a3175741f Fixed #2268 ([GUI] Generic class name is shown for 'Message' while correct one for 'Summary') 2010-12-01 17:55:22 +02: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 6bf0e7eb08 Remove extra space char from begin of verbose message. 2010-11-29 20:27:31 +02: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 564d896715 Run astyle. 2010-11-28 23:29:06 +02: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 3068dbf22e Preprocessor: Temporarily skip 'missing include' warnings for system headers in release mode. When the handling works better these messages should not be skipped. Ticket: #1937 2010-11-28 12:38:06 +01:00
Daniel Marjamäki 00da0adf25 Fixed #2236 (False positive: Assignment to itself) 2010-11-28 11:48:06 +01:00
Daniel Marjamäki ea405d95c6 Fixed #2241 (Segfault checking a file) 2010-11-28 07:35:42 +01:00
Kimmo Varis c9c6de24a6 Remove extra space from error message. 2010-11-27 20:54:02 +02:00
Kimmo Varis 2c3f9a9dce Small fix to error message.
Start with capital letter and no space in beginning.
2010-11-27 20:41:08 +02: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
Robert Reif 88a1448a07 Symbol database: refactor CheckMemoryLeakInClass::checkPublicFunctions to use the symbol database. Ticket: #2219 2010-11-25 21:04:49 +01: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 ad91f414db Symbol database: Avoid possible null pointer dereference if _settings is null. Ticket: #2219 2010-11-25 17:55:44 +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 bb745da5f9 Tokenizer::simplifyKnownVariables: suppress debug warnings about pointer aliases. Temporary solution that limits the amount of debug warnings somewhat. 2010-11-21 13:50:57 +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 9d9a5b0623 VS: Fixed compiler warnings. Ticket: #2200 2010-11-21 11:48:27 +01:00
Daniel Marjamäki ee333598fc gcc: fixed compiler warnings 2010-11-21 11:06:28 +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
Ettl Martin f10e433593 mathlib: toString() parameter changed to const reference 2010-11-20 14:21:18 +01:00
Daniel Marjamäki cda44e0c39 VS: Fixed compiler warnings 2010-11-20 11:48:03 +01:00
Daniel Marjamäki d021cd9074 VS: fixed compiler warning. Ticket: #2200 2010-11-20 11:28:47 +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
Robert Reif 27cae2f0d7 Symbol database: add global space and add all global functions and variables to it. Ticket: #2198 2010-11-20 07:26:50 +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 eb54be2b2a Uninitialized variables: Cleanup '+=' handling. This is simplified in the Tokenizer now. 2010-11-16 20:09:23 +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
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
Daniel Marjamäki 71ea6213d0 Fixed #2131 (Preprocessor: incorrect include file loading) 2010-11-14 08:35:32 +01:00
Robert Reif 6a06970e1b CheckClass: Refactoring - organize each check so the check function comes first, any helper functions come second, and the message functions come last. Ticket: #2198 2010-11-14 06:50:33 +01:00
Daniel Marjamäki 71c1ce71ce Tokenizer::simplifyKnownVariables: Simplify known variables for struct members 2010-11-13 18:45:35 +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 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 6836198a5c system headers: merged the systemheaders branch into master. it works pretty well. Ticket: #1937 2010-11-13 13:06:58 +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 a06a1a6574 Symbol database: Added files 2010-11-13 08:08:45 +01:00
Daniel Marjamäki 3303c40879 uninitialized variables: fixed problem when parsing loop bodies 2010-11-13 08:03:59 +01:00
Robert Reif 894586f4dd Fixed #2198 (SymbolDatabase: separate SymbolDatabase from CheckClass) 2010-11-13 07:31:56 +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
Robert Reif 0fffa1f651 This patch fixes a bug I introduced in the previous patch. It also speeds up nested class parsing by skipping the entire class implementation using { link to jump to } rather than parsing for }. Ticket: #2172 2010-11-12 19:29:20 +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 a605bdc8a2 Fixed #2195 (unit tests failing) 2010-11-12 15:43:16 +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
Robert Reif 4ddf6f3b44 Symbol database: code cleanups 2010-11-10 16:52:52 +01:00
Daniel Marjamäki 2102b9598e FileLister: fixed compiler errors in win32. accept all files given by user. 2010-11-09 19:32:11 +01:00
Daniel Marjamäki 14bf9fbbdb Fixed #2181 (How can I select the extension of the files to check?) 2010-11-09 19:20:31 +01:00
Daniel Marjamäki 81cac166d6 FileLister: minor cleanup 2010-11-09 19:11:43 +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 6a4f70e496 Fixed #2169 (Inline suppression does not work unless filename is given) 2010-11-08 18:53:48 +01:00
Daniel Marjamäki 21ec772e31 Tokenizer: Only show 'failed to instantiate template' debug messages if the --debug-warnings has been given 2010-11-08 18:01:28 +01:00
Daniel Marjamäki 27b7638901 Visual Studio: Fixed compiler warnings about assignment in condition 2010-11-08 17:29:08 +01:00
Robert Reif 23b50a3d81 Symbol database: delay finding class variables until after all classes have been found. 2010-11-08 17:12:25 +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 47e9fcb5a8 Revert "Tokenizer: More specific bailout in simplifyKnownVariables for loop variable"
This reverts commit 7e9bb62dff.
2010-11-07 17:40:27 +01:00
Daniel Marjamäki 7e9bb62dff Tokenizer: More specific bailout in simplifyKnownVariables for loop variable 2010-11-07 17:20:03 +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 2833a5ebb5 Tokenizer: Refactoring the simplifyKnownVariable 2010-11-06 20:23:49 +01:00
Daniel Marjamäki 5be12a1d27 Tokenizer: improved simplifyKnownVariables 2010-11-06 19:43:32 +01:00
Daniel Marjamäki 53fc0ca5e6 Tokenizer: Refactoring. Merged two patterns into one pattern. 2010-11-06 15:55:37 +01:00
Daniel Marjamäki afcc28e9ee Tokenizer: Added debug warning that is shown when bailing out in simplifyKnownVariables 2010-11-06 15:42:41 +01:00
Robert Reif 8a379d4826 Fixed #2176 (Tokenizer::simplifyTypedef function pointer bug) 2010-11-06 15:15:50 +01:00
Robert Reif 0205498a12 Symbol database: improved handling of out of line functions returning function pointers 2010-11-06 13:31:56 +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 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 06ec4d9a84 GCC: Fixed compiler warnings about sign-conversion 2010-11-04 20:52:20 +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 0984a0be47 Tokenizer: Fixed 'a[b-1]+=1' 2010-11-04 19:38:19 +01:00
Daniel Marjamäki fce6f11ed8 Tokenizer: simplify 'a[b-1]+=1' better 2010-11-04 19:02:54 +01:00
Daniel Marjamäki c29940b114 Fixed #2166 (false positive: possible null pointer dereference) 2010-11-04 18:18:19 +01:00
Robert Reif bc8ecf2aa7 Fixed #2168 (Segmentation fault of cppcheck) 2010-11-04 17:54:04 +01:00
Zachary Blair 10a4dde105 Fixed #2137 (Invalid mutual exclusion report) 2010-11-04 00:10:25 -07:00
Robert Reif 003f99da82 Symbol database: Fixed bug. Ticket: #2149 2010-11-04 06:58:37 +01:00
Robert Reif cf0403434d Symbol database: Bug fix 2010-11-03 20:33:07 +01:00
Daniel Marjamäki 1323cbdb6d Fixed #2160 (#2160 (Invalid unused variable report (style))) 2010-11-03 19:30:00 +01:00
Daniel Marjamäki 14803643ca empty string test: Removed this check 2010-11-03 17:56:14 +01:00
Daniel Marjamäki 19f809c9b4 Unused variables: better handling of '= %var% ++'. Ticket: #2160 2010-11-02 20:01:12 +01:00
Daniel Marjamäki dd4b2b8b46 Tokenizer: simplify 'x[0] += 1;' 2010-11-02 19:22:48 +01:00
Robert Reif 0fe72839d8 Symbol Database: Better handling of namespaces. Ticket: #2149 2010-11-02 18:30:57 +01:00
Daniel Marjamäki c4452effa3 Tokenizer: simplify 'x.y += 1;' 2010-11-01 20:33:55 +01:00
Daniel Marjamäki 1b9de20f9b Tokenizer: simplify 'case 0: x += y;' 2010-11-01 19:31:30 +01:00
Daniel Marjamäki 94fc13f0c4 Fixed #2159 (False positive: Null pointer dereference 'if (!x) return *y;') 2010-11-01 19:21:08 +01:00
Daniel Marjamäki 3fb17baa12 Fixed #2158 (False positive: value is not unused when using +=) 2010-11-01 17:36:54 +01:00
Daniel Marjamäki 285d76a413 Null pointers: Fixed false positive for 'x && x->y' 2010-10-31 19:48:58 +01:00
Daniel Marjamäki 69c6358198 CheckNullPointer: Reuse CheckNullPointer::isPointerDeRef in CheckNullPointer::nullPointerByDeRefAndChec 2010-10-31 16:07:50 +01:00
Daniel Marjamäki 32def3a3f0 CheckNullPointer: Reuse the CheckNullPointer::isPointerDeRef function 2010-10-31 15:46:08 +01:00
Daniel Marjamäki 33d3fd4716 CheckNullPointer: Reduced false negatives by making pattern more generic 2010-10-31 15:40:34 +01:00
Daniel Marjamäki 6faa4b79d3 CheckNullPointer: Refactoring. Created the function CheckNullPointer::isPointerDeRef that can be used to detect if a pointer is dereferenced 2010-10-31 15:32:19 +01:00
Daniel Marjamäki 1e866c3235 Visual Studio: Fixed compiler error 2010-10-31 11:42:45 +01:00
Daniel Marjamäki bc283d8b99 Uninitialized variables: Broke out the checking into separate file 2010-10-31 12:31:11 +01:00
Daniel Marjamäki df8a93bf97 Null pointers: Broke out the checking into separate file 2010-10-31 11:51:25 +01:00
Daniel Marjamäki 1ef09147f3 CheckOther: updated CheckOther::getErrorMessages 2010-10-31 10:07:35 +01:00
Daniel Marjamäki 6c19ea7b53 Tokenizer: Added a few comments 2010-10-31 09:58:44 +01:00
Daniel Marjamäki 558899dc74 Variable usage: Fixed false negative that I introduced when simplifying compound assignments 2010-10-31 09:34:25 +01:00
Daniel Marjamäki 23d3fd3a5a Fixed #2147 (uninitialized variable: false negative for 'x += y;') 2010-10-31 08:47:13 +01:00
Daniel Marjamäki 8d96697623 GCC: Fixed compiler warnings 2010-10-30 14:53:25 +02:00
Daniel Marjamäki b55f6458a2 Fixed #2120 (False positive: array index out of bounds (unknown type in struct, sub function)) 2010-10-30 12:32:43 +02:00
Daniel Marjamäki 7b630cc581 Fixed #2154 (false positive: The loop might unintentionally skip an element in the container) 2010-10-30 11:22:30 +02:00
Kimmo Varis 9627b667a1 Move simplifyPath method from FileLister to Path class.
simplifyPath() "fits" better to Path class conceptually. It handles
paths, not lists them. Also this way we get rid of few unneeded
dependencies to FileLister class.
2010-10-29 22:21:27 +03:00
Daniel Marjamäki 9435fde551 Tokenizer: Added function for checking if code is Java/C# 2010-10-28 18:51:55 +02:00
Daniel Marjamäki fee20bafa0 Java: Removed bailout added in 120073f000 2010-10-28 18:01:51 +02:00
Daniel Marjamäki 995e39200b Fixed #2130 (Invalid possible NULL pointer dereference, etc.) 2010-10-27 20:20:10 +02:00
Daniel Marjamäki fc98bcdcb2 Fixed #2141 (false positive: possible null pointer dereference) 2010-10-27 19:42:47 +02:00
Daniel Marjamäki fd153eac02 Fixed #2142 (false positive: null pointer dereference (throw)) 2010-10-27 19:38:42 +02:00
Robert Reif b6aca47e11 Fixed #1195 (Uninitialized member variable not detected 'std::vector<int> *ints;') 2010-10-27 19:28:15 +02:00
Robert Reif 5a8f490f07 Fixed #2135 (False positive 'Can be const') 2010-10-27 19:25:34 +02:00
Pete Johns 8022baec2a Removed unnecessary code duplication. 2010-10-27 19:34:06 +11:00
Cary R 59139b17cb Fixed #2138 (Add support for comments in suppression file) 2010-10-26 21:22:11 +02:00
Daniel Marjamäki a38b14d582 Tokenizer: Remove redundant semi colons 2010-10-26 21:05:20 +02:00
Daniel Marjamäki 79583ee45d #2133 (cppcheck: floating point exception) 2010-10-26 20:05:34 +02:00
Daniel Marjamäki 6200d4505a Fixed #2118 (Invalid syntax error report.) 2010-10-26 19:39:48 +02:00
Daniel Marjamäki 9370f552ac Fixed #2134 (sizeof(*list) complains of null pointer dereference) 2010-10-26 18:26:02 +02:00
Daniel Marjamäki b6106ddf72 Fixed #2132 (Internal error. Token::Match called with varid 0.) 2010-10-26 18:10:03 +02:00
Daniel Marjamäki 27235f27ae Fixed #2129 (Invalid dereference after release report) 2010-10-26 17:49:48 +02:00
Daniel Marjamäki 893f7fa347 Fixed #2130 (Invalid possible NULL pointer dereference, etc.) 2010-10-26 17:40:30 +02:00
Daniel Marjamäki bdd6d6d53d null pointer: use simplified token list in the 'check and deref' checking 2010-10-25 21:05:43 +02:00
Daniel Marjamäki 132aa8d0c4 uninitialized variables: fixed fp when analysing loops 2010-10-25 20:56:15 +02:00
Daniel Marjamäki 026514db1a Fixed #2127 (null pointer dereference after condition (SRD nr 522)) 2010-10-25 19:43:54 +02:00
Daniel Marjamäki 41a06a21d9 using deallocated pointer: detect first problem reported in ticket #2090 2010-10-25 17:36:46 +02:00
Zachary Blair 26afb04dc5 Fixed #2105 (Incorrect operator: mutual exclusion over ||) 2010-10-24 18:14:21 -07:00
Daniel Marjamäki 24a2def3ad Execution Path: Fixed FP in improved handling of loop bodies 2010-10-24 19:14:40 +02:00
Daniel Marjamäki 8f707e5e46 Null pointers: Better handling of loops 2010-10-24 18:51:14 +02:00
Daniel Marjamäki 40aeb17738 uninitialized variables: handling loop bodies. end upon '}' 2010-10-24 18:28:25 +02:00
Daniel Marjamäki 6601de7681 uninitialized variables: refactoring handling of loop bodies 2010-10-24 18:26:59 +02:00
Daniel Marjamäki b66d3c8858 Fixed #2125 (uninitialized variable: better handling of for loops) 2010-10-24 18:12:48 +02:00
Daniel Marjamäki cf86e11d05 Fixed #2111 (Class methods writing to a union are detected as 'can be const') 2010-10-24 16:43:10 +02:00
Daniel Marjamäki 13b8544436 Visual Studio: Fixed compiler warning. Ticket: #2123 2010-10-24 11:52:28 +02:00
Daniel Marjamäki 306587b1d0 Buffer overruns: Fixed TODO test case 2010-10-24 11:32:27 +02:00
Daniel Marjamäki f3c6c64e9a Fixed #2121 (False positive: Buffer access out-of-bounds when using uint32_t) 2010-10-23 13:12:17 +02:00
Daniel Marjamäki 120073f000 Java: fixed false positives about uninitialized variable 2010-10-23 10:56:30 +02:00
Daniel Marjamäki 5deb046ac5 Fixed #2120 (False positive: array index out of bounds (unknown type in struct, sub function)) 2010-10-23 08:49:03 +02:00
Daniel Marjamäki c907acf767 Fixed #1819 (False positive: auto variable assignment (unseen typedef)) 2010-10-22 21:12:56 +02:00
Daniel Marjamäki 9fdc03fc1d Fixed #2117 (false positive: buffer access out of bounds) 2010-10-22 20:15:51 +02:00
Daniel Marjamäki 9ae4a758b8 Fixed #2116 (Internal error. Token::Match called with varid 0) 2010-10-21 21:28:32 +02:00
Daniel Marjamäki eba827bc4b Fixed #2112 (Crash scanning qtcreator sources) 2010-10-21 19:42:09 +02:00
Daniel Marjamäki 6a66d32871 JAVA: better handling of java code 2010-10-20 22:15:35 +02:00
Daniel Marjamäki 4ff52b5883 Objective C: activate checking of .m and .mm files. The normal checking is used. 2010-10-20 21:09:07 +02:00
Daniel Marjamäki 8b866178ff Fixed #2103 (false positive when variable is checked to NULL and not freed) 2010-10-20 20:38:37 +02:00
Daniel Marjamäki 68dd2f8378 Fixed #2113 (False positive: Memory leak where a pointer is passed in a struct to another function to be freed) 2010-10-20 18:39:40 +02:00
Daniel Marjamäki 02ba2b202e Fixed #2110 (Tokenizer::simplifyTypedef: regression - wrong simplification of 'typedef char TString[256];') 2010-10-20 06:09:29 +02:00
Daniel Marjamäki f8c02718a5 Activated checking of .java and .cs files 2010-10-19 21:54:15 +02:00
Daniel Marjamäki 20674e08d0 Stl: improved check for dangerous usage of c_str 2010-10-19 20:21:58 +02:00
Daniel Marjamäki 2ca7dbc004 Fixed #2109 (false positive: buffer overrun) 2010-10-19 18:23:44 +02:00
Daniel Marjamäki 0864a0700a Fixed #2108 (False positive: the loop might unintentionally skip an element in the container.) 2010-10-18 20:05:54 +02:00
Daniel Marjamäki e54129fa8d STL: check for dangerous usage of string::c_str(). Ticket: #1116 2010-10-17 19:18:46 +02:00
Ettl Martin 7d1995dfaa Merge branch 'master' of github.com:danmar/cppcheck 2010-10-17 21:56:05 +08:00
Daniel Marjamäki 92a1e9e76e Severities: Added 'warning' and 'performance' severities. No changes to the command line options nor to the XML format. Ticket: #2106 2010-10-17 14:41:00 +02:00
Ettl Martin f25f3c64b4 fixed style waring (You should use ++ and -- as prefix whenever possible as these are more efficient than postfix operators) in lib/checkclass.cpp 2010-10-17 20:15:29 +08:00
Kimmo Varis ddfc7b2d5a Run dmake to update Makefile and lib/lib.pri. 2010-10-17 00:57:25 +03:00
Kimmo Varis 7a84e7dcca Add comment that qmake doesn't add _UNICODE define for project files. 2010-10-17 00:32:31 +03:00
Daniel Marjamäki 28e40cb9b0 unicode: updates to the handling of unicode filenames. Ticket: #2100 2010-10-16 21:39:58 +02:00
Daniel Marjamäki 88a98a2ef0 unicode: use short filenames when long filename doesn't work. Temporary solution for #2100 2010-10-16 12:40:21 +02:00
Daniel Marjamäki 4e121c94ab some more comments 2010-10-15 18:37:48 +02:00
Daniel Marjamäki d182079c5e added comments in CheckStl 2010-10-15 18:21:53 +02:00
Daniel Marjamäki 0b6948a805 Fixed #2101 (list in vector iterator usage) 2010-10-15 18:11:41 +02:00
Daniel Marjamäki ba2b986ece Fixed #2097 (false positive: buffer access out of bounds) 2010-10-14 20:00:32 +02:00
Daniel Marjamäki e11d9f1628 astyle formatting 2010-10-14 19:59:10 +02:00
Debrard Sebastien fb928b6778 Fixed #2018 (Postfix Operators) 2010-10-14 19:17:40 +02:00
Daniel Marjamäki b6c995ea47 Fixed #2096 (False positive: buffer overrun (extern array)) 2010-10-13 20:57:59 +02:00
Robert Reif 267d1f273e Fixed #2082 (Tokenizer::simplifyTypedef: wrong handling of array) 2010-10-13 20:02:37 +02:00
Daniel Marjamäki 229604b3e3 Fixed #2093 (False positive: buffer access out of bounds (unknown type)) 2010-10-13 18:06:50 +02:00
Pete Johns afe52fa9f2 Fixed MSVC++ compiler warning (pointers are not bools) 2010-10-13 21:19:18 +11:00
Pete Johns 52e16454fa Removed redundant code.
localClassDefinition is no longer required due to improved isIdentifierObjectType() in commit fbd3d92.
2010-10-13 20:48:37 +11:00
Pete Johns fbd3d92aa9 Fixed #2084 (False positive: object destroyed immediately (struct and function with same name))
Tightened up class definition matching so as not to match C-style struct tags.
2010-10-13 20:37:53 +11:00
Robert Reif a58094e827 Fixed #2089 (False negative: Function can be const (calling const function)) 2010-10-13 07:26:41 +02:00
Daniel Marjamäki 2334192bff Fixed #2087 (False positive: Array 'str[1]' index 1 out of bounds) 2010-10-12 21:52:02 +02:00
Debrard Sebastien d0629803a9 warning de compilation 2010-10-12 19:57:17 +02:00
Debrard Sebastien 3273f964c8 comment 2010-10-12 19:56:35 +02:00
Debrard Sebastien 1a4e3dcc44 increment check 2010-10-12 19:54:39 +02:00
Daniel Marjamäki 9e15c4ef38 Fixed #2088 ([test.c:12]: (error) Buffer access out-of-bounds: l) 2010-10-12 19:35:20 +02:00
Robert Reif 907ed0ac6f Fixed #2085 (False negative: function can be const when member variable is compared) 2010-10-12 07:57:09 +02:00
Daniel Marjamäki 74bf1821e6 Array index: detect array index out of bounds when datatype is unknown. Ticket: #2086 2010-10-11 20:52:14 +02:00
Daniel Marjamäki 3dfcbfc0e0 assignment in assert: modified the error message to better explain the reason why the warning is given. 2010-10-11 17:59:08 +02:00
Robert Reif a6e915f0cd Fixed #2081 (false negative: the function can be declared as const) 2010-10-11 17:43:36 +02:00
Zachary Blair d9967d4fd2 Fixed #2079 (detect side effects in assert) 2010-10-10 13:05:06 -07:00
Daniel Marjamäki 81aed3fbd7 Tokenize: Fixed bug in Tokenize::simplifyKnownVariables 2010-10-10 19:27:42 +02:00
Daniel Marjamäki ef4ce6f46b STL: fixed false positives in the new double-increment check when iterator shadows outer iterator 2010-10-10 14:28:14 +02:00
Daniel Marjamäki 5cc7c9dcf7 Parameter passed by value: updated error message so it mentions the reason. 2010-10-10 14:12:11 +02:00
Daniel Marjamäki ae0528ef59 STL: fixed false positives for the new double-increment check 2010-10-10 11:22:44 +02:00
Daniel Marjamäki 835b511bee STL: Added double-increment check. 2010-10-10 10:52:41 +02:00
Daniel Marjamäki a73ada54d5 Fixed #1705 (false negative: access past end of buffer) 2010-10-10 09:15:18 +02:00
Daniel Marjamäki 14f12e0647 Fixed #2078 (false negative: member variable not intialized) 2010-10-10 07:57:26 +02:00
Daniel Marjamäki a3367874d9 Fixed #1778 (false negative: nullpointer dereference (std::string pointer)) 2010-10-09 07:57:34 +02:00
Daniel Marjamäki 068317bed1 STL: Fixed TODO test case TestStl::erase5 2010-10-09 07:15:34 +02:00
Daniel Marjamäki e0ba626351 ClassInfo: Removed unused functionality 2010-10-08 19:43:41 +02:00
Robert Reif 02027eb750 Fixed #2074 ('Internal error in Cppcheck' on complex function typedef (even 2 typedefs!)) 2010-10-06 05:43:07 +02:00
Daniel Marjamäki 7b4e08385d STL: refactoring CheckStl::erase so ExecutionPath is used 2010-10-05 20:54:13 +02:00
Pete Johns 4e11e71a21 Fixed 2072 (object destroyed immediately: add --doc info) 2010-10-04 08:54:19 +11:00
Pete Johns 4bf9ff26ea Fixed 2071 (false positive: object destroyed immediately (when using '= { ... }'))
Simplified check within CheckOther::checkMisusedScopedObject() as a result.
2010-10-04 08:16:11 +11:00
Daniel Marjamäki cd8ef1cded Revert "temporarily disable the 'object destroyed immediately' message"
This reverts commit fa94312c9a.
2010-10-03 18:05:08 +02:00
Daniel Marjamäki 5bf2a300d9 1.45: updated version information 2010-10-03 17:05:36 +02:00
Daniel Marjamäki fa94312c9a temporarily disable the 'object destroyed immediately' message 2010-10-03 16:59:13 +02:00
Pete Johns 78795dc3ac Fix false positive: Misused Scope Object does not pick constructors of local class declarations.
It does pick up if there is an unused construction within the function, though.
2010-10-02 22:59:04 +10:00
Daniel Marjamäki e4c3b390cc Fixed #2069 (cppcheck fails to scan OpenBSDs ftp source code) 2010-10-02 13:28:44 +02:00
Pete Johns 365b1bed1a Fixed false positive: checkMisusedScopedObject no longer errors on calls to function objects. 2010-10-02 21:25:16 +10:00
Pete Johns 9a9302cba1 Prevent Tokenizer::simplifyCalculations() from removing parantheses from calls to Functors. 2010-10-02 21:19:05 +10:00
Pete Johns b72b699b76 Fixed false-positive: Object is referenced on construction
struct Foo {
        void bar() {
        }
    };

    void fn() {
        Foo().bar(); // This caused a false-positive
    }
2010-10-02 20:26:29 +10:00
Pete Johns 3f72d3a877 Check misused scope object does not pick local class method.
Also fixed mistyped withinFuntion ->withinFunction.
2010-10-02 20:12:52 +10:00
Pete Johns 0017655f55 Added test for functor false-positive [passing]
Also removed typedef's following danmar's review and renamed isClassresults -> isClassResults to make more clear.
2010-10-02 18:45:24 +10:00
Pete Johns 6e0ef3eda2 Fixed #1132 (Detection of misused scope objects in functions)
Emits error in the form:

    [useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately

    ...if an instance of a class or struct is unnamed and therefore destroyed
    straight after creation.

    Only checks for misused scope objects within functions.

    Optimised isIdentifierObjectType() by memoizing.
2010-10-02 14:22:26 +10:00
Pete Johns 50c2fa9ab0 Revert "Fixed #1132 (Detection of misused scope objects)"
This reverts commit c6acdccfa0.
2010-10-01 20:52:16 +10:00
Pete Johns c6acdccfa0 Fixed #1132 (Detection of misused scope objects)
Emits error in the form:

    [useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately

...if an instance of a class or struct is unnamed and therefore destroyed
straight after creation.

Removed "internal error" from token.cpp, since in this case varid would be NULL.
2010-10-01 20:30:21 +10:00
Daniel Marjamäki 6eeed00888 Fixed #2067 (Template methods do not 'use' private ones) 2010-09-30 21:22:49 +02:00
Daniel Marjamäki 415cbc63c3 Fixed #2066 (false positive: uninitialized variable when initializing through function pointer) 2010-09-27 19:26:09 +02:00
Daniel Marjamäki 80069f016e Fixed #2065 (false positive: memory leak) 2010-09-27 17:53:10 +02:00
Pete Johns 6a52538a9a Fixed #1949: assert() hides memory leaks
Added separate unit-test (trac1949), initially broken to highlight the error and added "assert" to call_func_white_list.

Left TestMemleakInFunction::call_func() as is, as this wouldn't highlight the actual problem.
2010-09-27 20:25:34 +10:00
Daniel Marjamäki cdecbe29d0 Optimisation: Made Tokenizer::simplifyInitVar faster 2010-09-26 15:54:41 +02:00
Daniel Marjamäki ff7a99ad37 Revert "Optimisation: small speedups in the Tokenizer::simplifyTokenList handling"
This reverts commit 056037feed.
2010-09-24 22:18:51 +02:00
Daniel Marjamäki 056037feed Optimisation: small speedups in the Tokenizer::simplifyTokenList handling 2010-09-24 22:14:18 +02:00
Daniel Marjamäki 86e517c5d3 Fixed #1951 (Preprocessor: Compound macro statements not handled correctly) 2010-09-24 21:38:11 +02:00
Daniel Marjamäki 4c98a7e67b Optimisation: Removed unused and slow code. The code was added to fix #1225 but it is now redundant. 2010-09-24 20:56:21 +02:00
Daniel Marjamäki 8950beac37 Optimisation to make the CheckUninitVar::parse slightly faster 2010-09-23 21:40:08 +02:00
Daniel Marjamäki 3f79faac2a Fixed #2059 (cppcheck gives wrong path in error description) 2010-09-22 19:52:14 +02:00
Daniel Marjamäki 7e954ebb57 Optimisation: optimised Token::Match 2010-09-20 20:15:07 +02:00
Kimmo Varis bc4c8e6e94 Delete unused VS lib-projects.
Those projects are just remainder from tries to create a real library
from the lib code.
2010-09-20 21:09:10 +03:00
Daniel Marjamäki 21bf58f1ec Optimisation: small optimisation of CheckClass::privateFunctions 2010-09-20 19:43:03 +02:00
Kimmo Varis d0acc16506 Update VS2010 solution/project files. 2010-09-20 18:09:17 +03:00
Daniel Marjamäki 78e13f098e Refactorings: Optimised the Token::multiCompare function 2010-09-19 15:14:13 +02:00
Daniel Marjamäki 78bd66cd5c Fixed #2056 (False positive: Resource leak) 2010-09-19 12:16:29 +02:00
Daniel Marjamäki a6ff3681bb Fixed #1802 (Preprocessor: macros are expanded wrong) 2010-09-18 22:20:01 +02:00
Daniel Marjamäki a7cf68b9ef Check Class: Removed the 'operator= should not return a const reference' 2010-09-18 20:05:34 +02:00
Daniel Marjamäki 6ba5385878 CheckClass: the 'virtual destructor' checking is currently inactive 2010-09-18 19:03:15 +02:00
Daniel Marjamäki 395f10aa6d Fixed #2053 (false positive on list erase) 2010-09-18 16:46:38 +02:00
Daniel Marjamäki de3c761790 Fixed #2052 (False positive: possible null pointer dereference 'else continue') 2010-09-18 14:56:07 +02:00
Daniel Marjamäki fce70508f7 Fixed #2045 (False negative: Uninitialized variable (found with gcc)) 2010-09-17 20:38:37 +02:00
Daniel Marjamäki 1c3862bd35 Execution Paths: fixed TODO test cases 2010-09-17 19:31:45 +02:00
Ettl Martin f6e75b5542 fixed clang++ warning: lib/path.cpp:80:2: warning: no newline at end of file [-pedantic] 2010-09-16 21:39:17 +02:00
Daniel Marjamäki f843678a07 Redundant conditions: some refactorings
* removed the 'redundant null pointer' check. sometimes it's unsafe to delete NULL pointer. and this check doesn't point out errors anyway.
 * moved the 'redundant condition' check for set::remove. Moved it to CheckStl.
2010-09-16 18:49:23 +02:00
Ettl Martin a56f6d276a fixed warning from cppcheck: [lib/checkbufferoverrun.h:129]: (style) 'operator=' should not return a const reference 2010-09-15 22:25:12 +02:00
Daniel Marjamäki ebf13acfbd Fixed #2032 (inline suppressions fail with comment on the same line as function) 2010-09-15 21:10:54 +02:00
Daniel Marjamäki de3b9f610a Fixed #2033 (all inline suppressions fail with relative paths) 2010-09-15 21:03:21 +02:00
Daniel Marjamäki 7e67bb53b8 Fixed #2049 (False negative: 'Uninitialized variable' error won't show) 2010-09-15 20:04:50 +02:00
Daniel Marjamäki 416f093fc3 Tokenizer: fixed variable declaration simplification 2010-09-15 19:53:47 +02:00
Daniel Marjamäki 38b35feaa8 Tokenizer: the 'failed to parse typedef' messages should not be shown unless --debug-warnings are given 2010-09-14 20:59:09 +02:00
Daniel Marjamäki 42d0ad8262 Fixed #2048 (Preprocessor: ifndef incorrectly simplified) 2010-09-14 17:45:37 +02:00
Robert Reif f2a3267ac7 Preprocessor: Report #error configuration when -D is used. Ticket: #2042 2010-09-14 07:21:19 +02:00
Robert Reif 0153dccb66 Symbol database: Skip bail out in constructors if a virtual function might be called because that would be undefined behaviour. Ticket: #1895 2010-09-14 07:16:53 +02:00
Daniel Marjamäki b0bb71ee20 Preprocessor: Handle C++0x rawstrings by replacing them with normal strings. Ticket: #2022 2010-09-13 19:36:40 +02:00
Daniel Marjamäki b1d74ed6b8 Revert "Preprocessor: Report #error configuration when -D is used. Ticket: #2042"
This reverts commit 674644cb29.
2010-09-13 16:59:43 +02:00
Robert Reif 674644cb29 Preprocessor: Report #error configuration when -D is used. Ticket: #2042 2010-09-13 16:55:40 +02:00
Robert Reif 6de1711515 Symbol database: reduce false negatives for 'uninitialized variable' when calling base class function. ticket: #1895 2010-09-12 22:40:51 +02:00
Daniel Marjamäki 84d9282da2 Memory leaks: remove redundant 'if return ; else|' 2010-09-12 21:41:13 +02:00
Robert Reif aae2986361 Fixed #2042 (#error messages should be displayed when user defines are used) 2010-09-12 21:30:47 +02:00
Daniel Marjamäki 5a95303405 Memory leaks: reduce 'loop { if continue ;' to 'loop {' 2010-09-12 21:15:19 +02:00
Daniel Marjamäki 0a30aba2e6 Memory leaks: insert ';' in the simplifycode to split up the commands 2010-09-12 21:04:05 +02:00
Daniel Marjamäki 9c4a05a3bd Memory leaks: simplify 'loop { use ; callfunc ; }' to 'use ;' 2010-09-12 20:45:30 +02:00
Daniel Marjamäki ceeef847ef Memory leaks: simplify 'if break ; break ;' 2010-09-11 21:48:40 +02:00
Daniel Marjamäki 7aa0504692 Memory leaks: simplify 'use use' 2010-09-11 21:32:21 +02:00
Daniel Marjamäki 424fe064cb Memory leaks: don't write debug warning for '; alloc ; dealloc ; return ; }' 2010-09-11 21:14:20 +02:00
Daniel Marjamäki d4e045cee5 Memory leaks: fixed try/catch and nested loops simplifications 2010-09-11 21:07:35 +02:00
Daniel Marjamäki 4064712baa Memory leaks: improved simplification for 'callfunc' 2010-09-11 20:49:24 +02:00
Daniel Marjamäki 73122c3e8a Memory leaks: Improved the simplifycode for 'use ; if| use ;' 2010-09-11 20:18:16 +02:00
Daniel Marjamäki ecd863700e Fixed #2023 (false positive with realloc()) 2010-09-11 11:15:04 +02:00
Robert Reif 69afc0a0db Symbol database: fixed false positive. ticket: #1895 2010-09-11 08:23:30 +02:00
Daniel Marjamäki 0418731473 Fixed #2030 (False positive: Uninitialized variable when function does not return) 2010-09-10 19:02:40 +02:00
Robert Reif 5a6eff90d1 Symbol database: Refactoring. ticket: #1895 2010-09-10 07:02:49 +02:00
Daniel Marjamäki 0afd19c59b Fixed #2039 (unions not handled properly, false positive about initialization) 2010-09-09 20:15:00 +02:00
Daniel Marjamäki 929a54e1b0 Fixed #2038 (memleak false positive with assignment expression in arguments) 2010-09-09 19:40:36 +02:00
Daniel Marjamäki 5af0d65aef Fixed #2025 (iso646 c++ operators are not handled correctly) 2010-09-09 17:43:09 +02:00
Robert Reif 6d35396720 Symbol database: refactoring - differentiate between member data initialization and assignment and save the order of variable declarations. makes it possible to create some additional checks. ticket: #1895 2010-09-09 07:26:40 +02:00
Robert Reif c3762903a9 Symbol database: fixed false negative for uninitialized variable. ticket: #1895 2010-09-09 07:21:51 +02:00
Daniel Marjamäki 80be31de13 Fixed #2037 (memleak not detected in exit path when variable used) 2010-09-08 20:03:22 +02:00
Daniel Marjamäki 8e746ca53f CheckMemoryleaks: reduce 'use ; if return ; dealloc ;' to 'if return ; dealloc ;'. ticket: #2037 2010-09-08 19:22:03 +02:00
Robert Reif 2fc2859b68 Fixed #2035 (Enum 'qboolean' hides typedef with same name) 2010-09-08 06:45:57 +02:00
Daniel Marjamäki 5688412f00 Fixed #2030 (False positive: Uninitialized variable when function does not return) 2010-09-07 20:25:29 +02:00
Daniel Marjamäki 3a4cda0f0d Fixed #2034 (false positive: unused private function (Borland C++ __property)) 2010-09-07 18:37:43 +02:00
Reijo Tomperi d0423ff8ac Set encoding to UTF-8 for some files. 2010-09-06 22:39:02 +03:00
Daniel Marjamäki cfe694330f Fixed #2024 (Internal Error on multiple append calls on same string object) 2010-09-06 21:34:51 +02:00
Kimmo Varis e800490b50 Add back <stdexcept> as GCC requires it.
I removed <stdexcept> after checking it builds with VS 2008. But Dan
pointed out GCC needs that header.
2010-09-06 22:00:56 +03:00
Kimmo Varis 3551ce8b58 Remove unneeded includes. 2010-09-06 21:08:50 +03:00
Robert Reif 28c5893ee0 const functions: fixed false negatives for the type P. ticket: #1884 2010-09-06 19:04:14 +02:00
Daniel Marjamäki cfbc06c8b6 removed 'empty catch block' check. to avoid false positives we'll need to check if it is bad with an empty catch block (dead pointer/undefined behaviour/etc) 2010-09-05 13:27:58 +02:00
Kimmo Varis 120b6b9133 Remove unused function.
I forgot to remove the function that was used in command line
parsing code.
2010-09-05 11:24:01 +03:00
Kimmo Varis 45eaebe423 Move CLI command line parsing to own class. 2010-09-05 11:17:31 +03:00
Daniel Marjamäki 0f8bc429ad Fixed #2021 (false positive: syntax error with -std=gnu++0x code) 2010-09-05 08:16:19 +02:00
Daniel Marjamäki 7d3ccb064b Fixed #2020 (false positive: (error) Uninitialized variable, used in asm statement) 2010-09-05 08:06:37 +02:00
Daniel Marjamäki 51bc784537 Tokenizer: Fixed problem in Tokenizer::simplifyRedundantParanthesis when simplifying 'void delete(double num);' 2010-09-05 07:53:43 +02:00
Daniel Marjamäki a2b4e5641f Fixed #2010 (missing continue in switch check ?) 2010-09-04 14:24:45 +02:00
Daniel Marjamäki 75fb99cee7 Fixed #2015 (### Internal error in Cppcheck. Please report it.) 2010-09-04 11:49:56 +02:00
Daniel Marjamäki 9415423352 Fixed #2017 (false positive::struct or union member 'Base::m_ui' is never used) 2010-09-04 11:21:34 +02:00
Daniel Marjamäki beb4dddb2e Refactoring CheckMemoryLeaks 2010-09-04 10:06:34 +02:00
Daniel Marjamäki f490ebcf88 Fixed #1872 (Confused -v switch) 2010-09-03 13:30:49 +02:00
Daniel Marjamäki 1938b8a423 Fixed #1976 (False Positives with unions) 2010-09-03 08:10:29 +02:00
Daniel Marjamäki fb4fce466e Fixed #2014 (False positive with longjmp) 2010-09-03 07:18:01 +02:00
Daniel Marjamäki 427c0f4bfd Fixed #1975 (segmentation fault of cppcheck) 2010-09-02 23:01:12 +02:00
Daniel Marjamäki 190a0040b7 Null pointer: Fixed false positive 2010-09-02 21:08:58 +02:00
Daniel Marjamäki 01b05618e5 Tokenizer: Fixed Cppcheck warnings 2010-09-02 20:51:01 +02:00
Robert Reif 80fdf1ca51 Symbol database: Fixed false negatives for unused private functions. Ticket: #1895 2010-09-02 19:22:54 +02:00
Sbastien Debrard 2049f70754 Fixed #1972 (file extensions) 2010-09-02 19:17:47 +02:00
Robert Reif fbffaade2e Fixed #2011 (Parser error in template function) 2010-09-02 19:09:06 +02:00
Robert Reif cb318c21e3 Symbol database: adds support for inline functions returning function pointers and starts to convert privateFunctions over to the symbol database. Ticket: #1895 2010-09-02 07:40:20 +02:00
Daniel Marjamäki eb74bfc15a Fixed #2007 (False positive: member variable not initialized (Borland C++ property)) 2010-09-01 18:10:12 +02:00
Robert Reif 4153b7d24b refactoring namespace handling. ticket: #2001 2010-09-01 16:47:53 +02:00
Robert Reif 7a8190e188 Fixed #2002 (Wrong operator() parsing) 2010-09-01 06:32:46 +02:00
Kimmo Varis 63f1de509c Merge branch 'master' of github.com:danmar/cppcheck 2010-08-31 23:26:25 +03:00
Daniel Marjamäki 55e0e435bd Fixed #1959 (Do you support the oracle Pro*C ?) 2010-08-31 23:25:41 +03:00
Daniel Marjamäki 3a8e7b4bf0 Exception safety: Removed the noisy checks and keep the useful checks 2010-08-31 22:22:59 +02:00
Kimmo Varis 42dfd255e3 Fix Linux makefile after moving timer code to own files. 2010-08-31 23:22:48 +03:00
Kimmo Varis d417256c98 Move timer code to own cpp/h files. 2010-08-31 23:18:07 +03:00
Daniel Marjamäki b2a775f3e0 Fixed #1959 (Do you support the oracle Pro*C ?) 2010-08-31 21:40:51 +02:00
Kimmo Varis 9a52b35144 Merge branch 'master' of github.com:danmar/cppcheck 2010-08-31 22:05:08 +03:00
Daniel Marjamäki 688b2aefe9 Tokenizer: Fixed warnings about unsigned / signed conversion 2010-08-31 21:04:17 +02:00
Kimmo Varis ee7bc64197 Fix building CLI with VS2010. 2010-08-31 22:04:13 +03:00
Daniel Marjamäki 8ff1e71b22 Fixed #2004 (False positive in 'variable assigned a value but is never used' check) 2010-08-31 20:58:37 +02:00
Kimmo Varis e825fb1e70 Fix CLI build with VS2008. 2010-08-31 21:58:03 +03:00
Daniel Marjamäki 1d78b5072d Fixed #1996 (False positive for 'Variable foo is assigned a value that is never used') 2010-08-31 20:33:28 +02:00
Daniel Marjamäki 513826d8c2 Tokenizer::setVarId : don't give operator function variable id 'operator new []('. Ticket: #1997 2010-08-31 20:15:24 +02:00
Daniel Marjamäki fbe11b9bb9 Fixed #1999 (False positive: uninitialized variable (__published variables)) 2010-08-31 19:48:04 +02:00
Debrard Sébastien 071f7d5f34 Fixed #2005 (refactoring dangerous / obsolete functions checks) 2010-08-31 18:58:01 +02:00
Robert Reif 4463f650d0 Fixed #2003 (false positive in set functions) 2010-08-31 17:59:17 +02:00
Robert Reif 5aab602709 Fixed #2001 (No 'The function ... can be const' warnings when base class is in namespace.) 2010-08-31 17:57:42 +02:00
Robert Reif c56911ba6a Fixed #2000 (segmentation fault of cppcheck with bitfield) 2010-08-31 17:51:10 +02:00
Robert Reif 16efc9be26 Fixed #1887 (internal error in GLee) 2010-08-31 17:48:19 +02:00
Daniel Marjamäki dcc02166c6 Fixed #1998 (VS compiler warning with current HEAD) 2010-08-30 21:45:26 +02:00
Daniel Marjamäki 7ec3c72a19 Fixed #1997 (operator new [] simplified wrong) 2010-08-30 21:06:22 +02:00
Daniel Marjamäki 9c499db17b Revert "Visual Studio: Added /MP switch"
This reverts commit 2450a80556.
2010-08-30 17:51:08 +02:00
Daniel Marjamäki 527354b4be Fixed #1886 (Associate header file with code file including it) 2010-08-30 17:44:46 +02:00
Robert Reif 96d73c189c Symbol database: better handling of operator functions. Ticket: #1895 2010-08-30 17:14:20 +02:00
Robert Reif 0d530711f6 Fixed #1988 (segmentation fault of cppcheck with wrong syntax of -std=c++0x) 2010-08-30 07:25:17 +02:00
Robert Reif a862e982ff Fixed #1993 (False negatives: uninitialised variables in constructor) 2010-08-29 16:36:10 +02:00
Daniel Marjamäki edec43c913 mention the manual in the --help output 2010-08-29 13:21:35 +02:00
Daniel Marjamäki 02939c78f8 Fixed #1994 (False 'Found obsolete function' positive) 2010-08-29 12:01:32 +02:00
Daniel Marjamäki 71453871d4 Fixed #1989 (false positive: Variable 'Aux13' is assigned a value that is never used) 2010-08-28 13:32:43 +02:00
Robert Reif b1bf201a8a Symbol database: Refactorings. Ticket: #1895 2010-08-28 11:23:23 +02:00
Daniel Marjamäki 83a8879f11 Tokenizer::simplifyInitVar : Refactorings and fixes related to ticket #1989 2010-08-27 22:58:21 +02:00
Daniel Marjamäki d45186d645 Added --debug-warnings that we can use to enable various debug warnings 2010-08-27 20:28:00 +02:00
Daniel Marjamäki 8eee4cf2e8 Fixed #1984 (false positive: syntax error in for loop (< -operator)) 2010-08-26 23:24:01 +02:00
Daniel Marjamäki 57523574ef Fixed #1985 (false positive: syntax error in try catch-block with for()-loop inside) 2010-08-26 23:19:18 +02:00
Daniel Marjamäki 02088443f9 quick fix for #1969 (False positive: Uninitialized variable when exit() is called before variable is used.) 2010-08-26 23:11:04 +02:00
Daniel Marjamäki 0597c50a47 Fixed #1966 (False positive: Unused private function (virtual function in base class)) 2010-08-26 22:05:45 +02:00