Commit Graph

94 Commits

Author SHA1 Message Date
PKEuS b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +02:00
PKEuS 3c8f5b85ae Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10% 2017-03-27 18:48:34 +02:00
PKEuS 9225bff31d Added (back) support for enums to CheckCondition::checkIncorrectLogicOperator() (#7794) 2017-03-23 18:57:48 +01:00
PKEuS ca3e3b3cdb Fixed false positive multiCondition when & is used in both conditions (#7827) 2017-03-15 19:37:14 +01:00
Daniel Marjamäki 263c3596d5 known conditions: dont warn about 0 or 1 conditions as those look intentional 2017-03-08 18:39:19 +01:00
Daniel Marjamäki ecc59859e1 Don't simplify _Bool in TokenList 2017-03-04 11:13:28 +01:00
Daniel Marjamäki 1c6c209353 Fixed #7890 (1.77 false positive from knownConditionTrueFalse with function-like macros) 2017-03-03 19:53:16 +01:00
Daniel Marjamäki 16c06e5714 Fixed #7588 (Opposite conditions in nested 'if' blocks lead to a dead code block.) 2017-02-28 18:46:28 +01:00
Matthias Krüger 6f1e7e897d simplify if(tok && Token::{simple,}Match) to if(Token::{simple,}Match). 2017-02-06 15:37:12 +01:00
PKEuS 2f6350a0d0 Refactorized Library 2016-12-06 14:09:28 +01:00
PKEuS 6e8ac13325 Refactorization:
- Optimized std::string usage
- Replaced list by vector
- Moved iterator into loop head
- Ran AStyle
2016-12-05 17:45:34 +01:00
Matthias Krüger 7197456c23 CheckCondition::checkIncorrectLogicOperator(): if we encounter a condition like 'A && (!A || B)', print the actual equivalent ('A && B') in the --verbose message. 2016-12-05 13:39:20 +01:00
Matthias Krüger cf24ea5221 fix #7783: false positive knownConditionTrueFalse on assert(0 && "message"). 2016-11-23 21:54:38 +01:00
Frank Zingsheim d4f01583b6 Fixed TODO (check if function parameter is non-const reference etc..) by common function 2016-11-01 14:06:30 +01:00
Harald Scheidl 04421f5601 check if AST is not null before accessing it 2016-10-09 18:21:23 +02:00
Daniel Marjamäki e0e53cbd66 alwaysTrueFalse: Don't warn when condition is 0 or 1 2016-10-09 15:20:43 +02:00
Harald Scheidl 58eb644003 Improved Check: Warn about number and char literals in boolean expressions (#7750) 2016-10-09 13:21:00 +02:00
Daniel Marjamäki 0e48625ff4 Fixed false positive when self-checking Cppcheck 'boolean result used in bitwise operation' when using boolean variables. 2016-08-29 04:09:36 +02:00
Daniel Marjamäki 706877df2d astyle formatting
[ci skip]
2016-08-24 12:43:45 +02:00
Roberto Martelloni 4c6f4f6708 CWE mapping of functionConst, functionStatic, initializerList, badBitmaskCheck, knownConditionTrueFalse, invalidTestForOverflow, unhandledExceptionSpecification, coutCerrMisusage,
invalidPrintfArgType_int
2016-08-23 16:48:36 +01:00
Bartlomiej Grzeskowiak 09a83f2cc8 Fixed #7567 ("(a | 7) > 6U" is always true) 2016-08-07 16:58:39 +02:00
Daniel Marjamäki 5611a71820 Fixed #7543 (False positive boolean result used in bitwise operation) 2016-07-29 18:46:43 +02:00
Daniel Marjamäki 89be630156 Fixed #7543 (False positive boolean result used in bitwise operation) 2016-07-29 17:24:22 +02:00
Daniel Marjamäki 9bda97975a Fixed #7037 (32bit (-m32): testsuite fails) 2016-07-19 12:14:55 +02:00
Bartlomiej Grzeskowiak a5cfa2b12c - #7522 and #7428 revisited. ((a&7)>7U) is always false and ((X|7)>=6) is correct (X can be negative). 2016-06-17 12:12:53 +02:00
PKEuS f2ae295f1e Support char literals in CheckCondition::checkIncorrectLogicOperator() (#5912) 2016-05-24 15:08:48 +02:00
PKEuS 5d5886b464 Properly detect binary & in CheckCondition::clarifyCondition() (fixes false positives when self-checking cppcheck) 2016-05-06 17:39:41 +02:00
PKEuS 3366a74bb0 Refactorized CheckCondition::clarifyCondition():
- Reimplemented parts of the check based on ValueType
- Merged two loops

Fixed some type conversion messages
2016-05-06 15:22:45 +02:00
Daniel Marjamäki 00a584d8d1 astyle formatting 2016-04-22 06:01:34 +02:00
Bartlomiej Grzeskowiak 7e020e1d92 - fix for #7428 false negative: Statement is always false 2016-04-14 14:50:08 +02:00
Alexander Mai 0533d7bf9c Run astyle + minor refactoring 2016-02-27 16:03:50 +01:00
Roberto Martelloni d3645d874e Mapped toomanyconfigs ,AssignmentAddressToInteger
,AssignmentIntegerToAddress ,CastIntegerToAddressAtReturn
,CastAddressToIntegerAtReturn ,assertWithSideEffect ,assignmentInAssert
,uselessAssignmentArg ,uselessAssignmentPtrArg
,comparisonOfFuncReturningBoolError
,comparisonOfTwoFuncsReturningBoolError ,comparisonOfBoolWithBoolError
,incrementboolean ,comparisonOfBoolWithInt ,compareBoolExpressionWithInt
,negativeIndex ,pointerOutOfBounds ,arrayIndexThenCheck
,possibleBufferAccessOutOfBounds ,argumentSize
,arrayIndexOutOfBoundsCond ,noConstructor ,copyCtorPointerCopying
,noCopyConstructor ,uninitMemberVar ,operatorEqVarError
,unusedPrivateFunction ,memsetClassFloat ,mallocOnClassWarning
,operatorEq ,thisSubtraction ,operatorEqRetRefThis ,operatorEqToSelf
,useInitializationList ,duplInheritedMember ,assignIfError
,comparisonError ,multiCondition ,mismatchingBitAnd
,oppositeInnerCondition ,incorrectLogicOperator ,redundantCondition
,moduloAlwaysTrueFalse to their CWEs ids.
2016-02-26 23:53:52 +00:00
Daniel Marjamäki 7bd034c009 Fixed #7369 (False positive knownConditionTrueFalse - assertions) 2016-02-06 14:37:44 +01:00
Daniel Marjamäki 6faa637fc7 Fixed #6537 (False positive badBitmaskCheck - error in valueflow) 2016-01-24 13:45:44 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 8171154e12 Fixed #7230 (Confusing code snippet in error message) 2015-12-31 01:15:49 +01:00
Daniel Marjamäki 24438c326e Fixed #7233 (Fasle negative 'unknownEvaluationOrder in case of macro) 2015-12-25 18:31:21 +01:00
Daniel Marjamäki 8f27cec991 Revert "minor tweak of comment"
This reverts commit b1d1869f22.
2015-12-14 20:29:29 +01:00
Daniel Marjamäki b1d1869f22 minor tweak of comment 2015-12-14 20:03:40 +01:00
Daniel Marjamäki 1b0bb02f1d invalidTestForOverflow: Fixed some false negatives (#7184) 2015-11-30 11:12:51 +01:00
Daniel Marjamäki fb8cce647c invalidTestForOverflow: Refactor; move from checkother to checkcondition 2015-11-30 08:51:15 +01:00
PKEuS 00bdc89f98 Refactorizations:
- Rely on SymbolDatabase to detect string types
- Loop over variable list instead of token list
- Fixed two comments claiming that the AST is experimental
2015-11-20 11:20:42 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Daniel Marjamäki b9b0964dab Fixed #7006 (False positive Mismatching assignment and comparison (variable is changed in loop)) 2015-11-11 13:45:28 +01:00
Aleksandr Pikalev 2d0ecc08c1 Check pointers for NULL before utilizing and do not check it later 2015-11-06 20:24:09 +01:00
Simon Martin f273323cd0 Fixed TODO-test for CheckCondition::checkBadBitmaskCheck by handling functions return bool. 2015-09-03 21:07:03 +02:00
PKEuS 4d80df2f4a Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Dmitry-Me ce96a5e84f Run cheaper checks first 2015-08-07 16:25:47 +03:00
Daniel Marjamäki a51acc8abd minor tweak of 'Redundant condition' error message 2015-08-05 11:30:58 +02:00
Daniel Marjamäki eda5272dfd Fixed #6875 (Improve 'Redundant condition' error message) 2015-08-05 11:15:54 +02:00