Commit Graph

613 Commits

Author SHA1 Message Date
PKEuS b81eafe0dc Splitted CheckIO from CheckOther. 2012-05-20 02:57:07 -07:00
PKEuS be7b104a8e Added missing checks to CheckClass::classInfo()
Replaced tokAt(1) with next() in checkother.cpp
2012-05-19 01:51:47 -07:00
Andy Maloney 4686294d7e Fix compiler warning about empty for body 2012-05-18 14:00:10 -04:00
PKEuS a9cfe2814a Made some functions const according to cppcheck results 2012-05-17 02:54:17 -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 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 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
Ettl Martin bb8342fbb4 fixed misspelled word 'Comparision' --> 'Comparison' 2012-04-26 23:04:55 +02:00
PKEuS 92737578ac Refactorizations:
- removed unused function CheckOther::concatNames
- Replaced one indendation counter by Token::link() in checkother.cpp
- Forward declaration of Settings in threadexecutor.h
2012-04-26 15:29:39 +02:00
PKEuS 5ac7552e4e New check: Comparision of modulo results that are always true/false. 2012-04-26 15:23:47 +02:00
PKEuS dd5e9aa454 Make use of recently implemented Token::type() functionality 2012-04-25 09:56:07 +02:00
PKEuS 6a37c36ee8 Fixed #3741
Removed redundant nullpointer check (cppcheck catch)
2012-04-18 16:35:04 +02:00
PKEuS 8e5949c6ce Added several C++11 algorithms and containers to CheckStl
Added pattern "> %varid%" to CheckStl::stlBoundries()
Fixed message in checkOther (#1320)
2012-04-17 12:54:01 +02:00
PKEuS bac8ed7127 Refactorized stringification of tokens:
- Function that stringifies one token: Token::stringify()
- Functions that stringify a list of tokens: Token::stringifyList()
-- Single and powerful "base" function, used by several "light" functions
Refactorized
- testtokenize.cpp and testsimplifytokens.cpp: Use improved stringification functions instead of several local implementations
- Avoided redundand creation of std::string when using TestTokenizer::tokenizeAndStringify and in cmdlineparser.cpp
2012-04-16 19:51:07 +02:00
Daniel Marjamäki 66227c4da0 Fixed #3609 (clarifyCondition delivers false positives when using Windows-Traits as a template) 2012-04-08 18:07:11 +02:00
Daniel Marjamäki 6360afdcfa CheckOther: Use reportInconclusiveError to report inconclusive error 2012-04-08 10:47:01 +02:00
PKEuS b0f571b25c Fixed #3383: If there is an empty line between subsequent break statements, only issue a message for inconclusive checking 2012-04-05 10:38:29 +02:00
PKEuS c1fc7a2218 Improved CheckOther::checkComparisonOfBoolWithInt and CheckOther::checkComparisonOfBoolExpressionWithInt:
- Added support for comparision of bool constant with number constant (-> fixed #1877) and integer variable with boolean expression
- Moved a check from checkComparisonOfBoolWithInt to checkComparisonOfBoolExpressionWithInt
- Generalized some patterns
- Made error message more accurate concnerning the "neither 0 nor 1" part.
- Reduced number of Token::Match calls
2012-04-02 15:45:51 +02:00
PKEuS 033e4a2c1f Fixed #3676. 2012-04-02 11:21:04 +02:00
PKEuS 989ac449e4 Made invalidPointerCast message inconclusive for casting from floating point type* to char* (Fixed #3639) 2012-03-25 12:55:39 +02:00
Daniel Marjamäki 1d95416840 astyle formatting 2012-03-25 11:51:59 +02:00
Daniel Marjamäki ca6a93816b Merge pull request #89 from HeisSpiter/master
Merged two checks to get a better one regarding sizeof
2012-03-25 02:38:04 -07:00
PKEuS e4d92055e7 Improved sizeofCalculation check:
- Bailout on expanded macros for conclusive checking
- Support for more operators
- Removed indendation counter
Improved checkSignOfUnsignedVariable:
- Made the patterns more generic
- Improved verbose error message (-> Fixed #3080)
2012-03-25 11:32:00 +02:00
Pierre Schweitzer 2b5ddb7858 Merge the strncmp & malloc sizeof checks into a more generic test that handles several cases where sizeof is misused, or could be misused 2012-03-23 21:47:13 +01:00
PKEuS e938235385 Store functions which are declared but not implemented in the function list of the containing scope -> Fixed #3679
Refactorizations:
- Simplified some code
- Improved condition in findVariableType to reduce unnecessary comparisions of empty strings.
2012-03-23 17:59:51 +01:00
Pierre Schweitzer ec44967e13 Add a new test to check improper sizeof usage. It's for the moment limited to malloc calls. 2012-03-21 21:13:09 +01:00
PKEuS 4587a1a06c Fixed recently introduced assertion failure in debug mode 2012-03-15 21:06:24 +01:00
PKEuS b6057a1148 Improved CheckOther::checkIncorrectLogicOperator:
- Added a lot of additional pattern
- Rewrote error messages to make them more understandable and better fitting to the situation. (Fixed #3664)
- Cleanup in unit tests
Improved message of static string comparision check
2012-03-15 20:38:28 +01:00
PKEuS 7cfffc9c9d Improved CheckOther::checkIncorrectLogicOperator:
- Implemented automatic swapping of conditions and operands
- Added several patterns
- Added support for conditions outside of if/while
2012-03-12 19:06:30 +01:00
PKEuS 6f164de609 Improved static string comparision check: Implemented #3214
Fixed false negative on argument count of fnprintf/snprintf when first variable argument is a string. (#3655)
Uncommented call of virtualDestructorError in getErrorMessages in checkclass.h
Refactorizations:
- Rearranged code in checkother.h to make ordering more consistent and to increase encapsulation of private data
- Replaced some single-token-patterns
2012-03-11 11:01:39 +01:00
Daniel Marjamäki 3f1ab5af9b charvar: dont write warning about char type array index when array is small and the full valid range is accessible with the char type. If there are out of bounds access then, it is not because the type of the variable. 2012-03-10 12:19:28 +01:00
Simon Martin 190cba519d Fixed shadowing warning 2012-03-09 08:06:58 +01:00
PKEuS ef6e381d47 Improved bitwise on boolean check to make it working on more code patterns
Refactorizations in checkother.cpp:
- Make use of symboldabase instead of: indentation counters, manual detection of variable declarations
- Removed some indexing variables to reduce calls to tokAt and the numbers given to this function
- Use tok->nextArgument() to jump to a specific argument
2012-03-03 21:14:20 +01:00
PKEuS 1ef99e2f21 Improved checkautovariables:
- Added support for checking a few more code patterns
- Simplified code by using more information from the symboldatabase
- Moved redundant part of c_str-check to checkstl
Two fixes according to output of pvs studio in testsimplifytokens.cpp
2012-03-01 18:38:20 +01:00
Ettl Martin 2ac907b40a fixed compiler warning (gcc-4.6.1) 2012-02-27 14:13:34 +01:00
PKEuS 1747813a8b Added check for invalid pointer casts (#1255)
Detect sign extension problems when variable is a reference (#3637)
Refactorizations:
- Tokenizer::getFiles returns a reference instead of a pointer, because its guaranteed that no nullpointer is returned
- Remove signed/unsigned in one step for "%type% signed|unsigned"
- Fixed recently introduced compiler warning in symboldatabase.cpp
2012-02-26 11:56:32 +01:00
Zachary Blair 9d75641ef8 Fixed #3598 (false positive: (error) Memory pointed to by 'a' is freed twice.) 2012-02-16 21:03:38 -08:00
Zachary Blair 8f827aa65f FIxed #3581 (double free false positive when exception rethrown) 2012-02-04 11:24:40 -08:00
PKEuS d5c2c7db88 - Moved checkCatchExceptionByValue from CheckOther to CheckExceptionSafety
- Fixed false positive: throw outerCatchVar; in inner catch is now correctly handled
- Added eTry and eCatch to Scope::isLocal -> Scopes inside catch are now detected by symbol database
2012-02-02 16:17:42 +01:00
PKEuS 22c1ce8a68 Fixes for #3480 and #3568. 2012-01-31 15:49:34 +01:00
Edoardo Prezioso bb703f4d0b Fixed: (warning) Found simple pattern inside Token::Match() call. 2012-01-28 20:31:12 +01:00
PKEuS 91a01a0a0d - checkUnsignedDivision checks for variable/variable (inconclusive). General bailout for if-statements.
- Make use of recently implemented symboldatabase functions (catch-support, reference-support)
- Other refactorizations
2012-01-28 12:32:28 +01:00
Zachary Blair 589a2461bd Fixed ticket #3550 (false positive: (error) Memory pointed to by 'pxpm' is freed twice) 2012-01-24 22:43:44 -08:00
PKEuS 36479499e7 - Solved FIXME: Made detection of code that is no pointer-dereference more robust, uncommented code (checknullpointer.cpp)
- Removed more indendation level counters
- Make use of symbol database more often
- Other refactorizations
2012-01-21 19:55:32 +01:00
PKEuS 96ae010e48 - Correctly set Scope::function variable in symboldatabase
- Refactorizations
- Fixed some cppcheck warnings
2012-01-21 10:08:09 +01:00
Zachary Blair 0415444e28 Merge branch 'master' of github.com:danmar/cppcheck 2012-01-19 23:02:33 -08:00
Zachary Blair b89adff9fd Fixed Ticket #3300 (false negative: doublefree of pointer) 2012-01-19 22:59:54 -08:00
Daniel Marjamäki 525e7fba20 Fixed #3490 (False positive: sscanf with %c) 2012-01-18 23:57:08 +01:00
Stefan Weil 7607e4c68d Fixed #3519 (Wrong line number in warning charBitOpError) 2012-01-18 13:09:46 +01:00
PKEuS c294b15360 Removed more indendation counters. 2012-01-15 12:31:49 +01:00