Commit Graph

3826 Commits

Author SHA1 Message Date
PKEuS dc64ac2918 Removed unnecessary variable Function::start - The value is already stored in Function::functionScope->classStart. 2012-05-22 12:58:46 -07:00
PKEuS 26f5f08614 Initialize Function::start when the function is implemented, not when its defined. (Fixes #3826) 2012-05-22 12:30:10 -07:00
Daniel Marjamäki 77e9106ec0 Fixed #3634 (False positive: compareBoolExpressionWithInt when using boost::tuples) 2012-05-22 19:01:21 +02:00
Daniel Marjamäki 5b0551054a varid: better templates handling 2012-05-22 18:58:13 +02:00
PKEuS a8382ea553 Implemented file pointer usage checking:
- File I/O without positioning function call (#1742)
- Read/Write to a file that was opened for writing/reading (#463)
- Operations on closed file

Old fflushOnInputStream check is now part of the new check.
2012-05-22 05:30:22 -07:00
PKEuS f3f46b4861 Fixed #3820 2012-05-22 02:27:21 -07:00
PKEuS f5ef6f255e Hande try and do in initialization list usage check (#3823) 2012-05-22 01:35:56 -07:00
PKEuS e8dfe2407a Fixed crash in Variable::evaluate (#3825) 2012-05-22 01:29:33 -07:00
PKEuS 829a52dc51 Added testio.cpp (I forgot to add it in previous commit) 2012-05-20 12:26:48 -07:00
PKEuS b81eafe0dc Splitted CheckIO from CheckOther. 2012-05-20 02:57:07 -07:00
PKEuS e77f348d82 New check: Suggest to use initialization list instead of assignment in constructor. (#489) 2012-05-18 07:54:58 -07:00
PKEuS 4825f78663 Fixed #2477 and #2669 2012-05-17 02:15:21 -07:00
PKEuS 3f5712bfb8 Fixed false positive "Function can be const" when 'this' is passed to a Memberfunction 2012-05-17 01:49:52 -07:00
PKEuS 4bb2a1b27b Made some functions static or const according to cppcheck results 2012-05-17 01:33:24 -07:00
PKEuS ea601ef2b0 Fixed false positives about const correctness caused by incorrect handling of default arguments 2012-05-17 01:05:36 -07:00
Daniel Marjamäki f803a18d50 Fixed #3749 (false positive: same expression on both sides of operator) 2012-05-17 07:26:57 +02:00
PKEuS 6a05ad1cf8 Improved fix for #2698 and added test case 2012-05-16 12:36:05 -07:00
PKEuS 77df633904 Improved handling of function calls in const correctness check: Fixed #2702, #2698, #2729. 2012-05-16 11:57:12 -07:00
Daniel Marjamäki 0bb0fdedc2 Fixed #3747 (False 'boolean result in bitwise' message with 'mask' enums) 2012-05-16 18:48:33 +02:00
PKEuS c976325086 Refactorizations in test suite:
- Implement createOnly mode in givenACodeSampleToTokenize so that only createTokens is called instead of tokenize
-> Ensures that no simplifications are done which could make the testing basic functions (like Token::Match) less accurate. We often don't need this simplifications in testtoken.cpp.
-> Ensures that no validation of the source is done (Fix #2104)
- reduced overhead of givenACodeSampleToTokenize: Don't store a std::istringstream instance, avoid creation of std::string when ctor is called
2012-05-16 09:04:03 -07:00
PKEuS 279b0c59bb Don't set Preprocessor::missingIncludeFlag if missingInclude warning is suppressed (#3487). 2012-05-16 02:59:45 -07:00
PKEuS 0157f937bf Fixed #3760: Added explicit to C++ keyword list in setVarId
Made some constant arrays static
2012-05-16 01:59:52 -07:00
PKEuS e8cd119ebd Improved parsing of functions that accept nullpointers but no uninitialized data (Fixed #3811) 2012-05-16 00:56:39 -07:00
PKEuS 132a95b5f2 Fixed bug in symboldatabase: Don't ignore const or static on variables declared that are declared with both keywords. (Fixes #3805) 2012-05-15 12:03:43 -07:00
Daniel Marjamäki 4ae8e4f382 Tokenizer::setVarId: Minor fix of sizeof handling 2012-05-15 18:40:24 +02:00
PKEuS 4871cef351 Refactorized test cases for uninitMemberVar check:
- Moved all test cases to a single file (testconstructors.cpp)
- Removed some redundant test cases that became unnecessary after the symbolDatabase was established as independant from this check
2012-05-15 02:36:27 -07:00
Daniel Marjamäki a0e5fad6a9 Fixed #3776 (Tokenizer::setVarId: No varid set when unknown macro is used before variable declaration) 2012-05-15 07:17:31 +02:00
PKEuS 42fd19fb37 Refactorization in checkclass.cpp:
- Improved handling of pointers and constants in constructor checking (-> Fixed #3801)
2012-05-14 12:50:23 -07:00
PKEuS 1dee3b04b9 Bugfixes in SymbolDatabase:
- Constant pointers are now detected as variable declarations
- Probably fixed #3802
2012-05-14 12:47:02 -07:00
Edoardo Prezioso eacf74be8d Changed the order of some structures in order to improve, even if for a bit, their padding. 2012-05-14 20:49:03 +02:00
Daniel Marjamäki fc7f78244e Fixed #3708 (False positive: uninitialized variable (allocation, unknown nonpointer type)) 2012-05-14 18:34:39 +02:00
Ettl Martin 8a7b141246 added testcase for ticket 3689 2012-05-14 09:57:30 +02:00
Daniel Marjamäki 895ee61ed5 Visual Studio: Updated VS2008 project files 2012-05-13 18:07:22 +02:00
Daniel Marjamäki 62f9875f90 Fixed #3799 (Bug: Function gets varId) 2012-05-13 07:55:35 +02:00
PKEuS 06a77679d4 Refactorizations:
- Added support for pointers in self assignement check
- Removed redundant for loop in checknullpointer.cpp
- Fixed warning about signed/unsigned mismatch in cppcheck.cpp by making Settings::_maxConfig unsigned
2012-05-11 10:38:19 -07:00
PKEuS 0452b03f53 Refactorizations in SymbolDatabase:
- Moved complete evaluation of variables type into one function executed when the variable is constructed
- Moved SymbolDatabase::ArrayDimensions to Variable::ArrayDimensions
2012-05-11 17:56:47 +02:00
Daniel Marjamäki 8236cd4d50 Fixed #3785 (false positive: (style) Variable 'dinv' is assigned a value that is never used) 2012-05-08 12:04:54 -07:00
Daniel Marjamäki dad2fb6db1 Fixed #3737 (Preprocessor: __cplusplus always defined for c++ code) 2012-05-08 11:49:43 -07:00
Daniel Marjamäki 99a29eafc9 Fixed #3691 (Tokenizer::simplifyKnownVariables: continue in switch) 2012-05-07 12:11:23 -07:00
Daniel Marjamäki 2fbd77c5a1 Fixed #3715 (false positive checking a map bounds) 2012-05-07 12:03:33 -07:00
PKEuS ec00824fd3 Fixed #3357:
- Print "inconclusive" tag in cli
- Fixed inconclusive handling in checkbufferoverrun.cpp
- Merged reportInconclusiveError into reportError by adding an additional parameter "bool inconclusive" which is false per default
2012-05-06 10:37:41 -07:00
PKEuS 6ef92c4fd7 Use recently implemented new constructor of ErrorLogger::ErrorMessage in checkmemoryleak.cpp and symboldatabase.cpp
Fixed test failure introduced in f105bf75a6
2012-05-06 04:01:56 -07:00
Daniel Marjamäki 37cdb515af Generated new VS2008/VS2010 project files (testrunner) 2012-05-05 11:18:50 -07:00
PKEuS 1a5fbd61d2 Splitted class TokenList from Tokenizer 2012-05-05 09:33:26 -07:00
Daniel Marjamäki 11614021e8 Fixed #3768 (Tokenizer::setVarId: no varid for 'std::string' parameter after a 'std::string' parameter called 'string') 2012-05-05 09:59:43 +02:00
Daniel Marjamäki 005ce81689 Fixed #3640 (False positive: statement begins with numeric code) 2012-05-04 17:53:47 +02:00
Daniel Marjamäki 119b24e363 Fixed #3756 (False positive: uninitvar in malloc) 2012-05-03 19:10:51 +02:00
PKEuS 04704ac5fa Refactorizations in checkmemoryleak.cpp:
- Use symbolDatabase more often to increase performance and accuracy.
- Replaced indendation counter
- Replaced custom stringify implementation

Benchmark results (sqlite checking):
4% complete, 7% on "Memory leaks (function variables)", 9% on "Memory leaks (address not taken)" and 82% on "Memory leaks (struct members)"
2012-05-03 10:43:47 +02:00
Ettl Martin f01c244212 added testcase to ticket 3727 2012-05-01 14:36:42 +02:00
Ettl Martin 28510bdd38 added todo testcase for ticket 3597 2012-05-01 14:26:34 +02:00