81 Commits

Author SHA1 Message Date
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 b1d1869f22fe24423ee740cb87179028e130bfce.
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
Daniel Marjamäki
e598b07a6d Moved functions to astutils 2015-08-03 09:20:50 +02:00
Alexander Mai
96c3c111fc Refactoring: Move some AST related functions to distinct source file 2015-08-02 21:57:32 +02:00
Matthias Krüger
87891b4128 CheckCondition::checkIncorrectLogicOperator put conditions in single quotes 2015-07-31 15:28:48 +02:00
Matthias Krüger
21ed807f8d CheckCondition::alwaysTrueFalseError: put condition in single quotes. 2015-07-31 15:28:37 +02:00
amai2012
249a05126b #6895 segmentation fault (invalid code) in CheckCondition::isOppositeCond 2015-07-30 17:19:19 +02:00
Daniel Marjamäki
1752c4f4f0 Avoid 'Condition always true/false' FP when part of the condition is an expanded macro 2015-07-30 13:30:16 +02:00
Daniel Marjamäki
120f3072eb alwaysTrueFalse: Dont write warning when comparison is made in macro 2015-07-29 12:51:00 +02:00
Daniel Marjamäki
afd9f071c0 simplified the code for ValueFlow Known/Possible values 2015-07-25 19:36:29 +02:00
Daniel Marjamäki
eda3fdc96a CheckCondition: Refactoring function parameter lookup 2015-07-23 12:06:33 +02:00
Daniel Marjamäki
f711520892 Fixed #6852 (false negative: logical conjunction 'x == 0') 2015-07-21 22:26:22 +02:00
Daniel Marjamäki
1b8252181d Tokenizer: Removed Tokenizer::simplifyIfNotNull (#6072) 2015-07-21 17:58:44 +02:00
Daniel Marjamäki
cb04dfbd37 Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition)) 2015-07-17 15:30:23 +02:00
Daniel Marjamäki
15a8e4d2df Temporarily revert "Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))"
This reverts commit a3fbad50cb2d21d88f51b105a73ef89773dfda6b.

The ValueFlow must be updated before this can be re-added.
2015-07-16 21:10:46 +02:00