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
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 a3fbad50cb
.
The ValueFlow must be updated before this can be re-added.
2015-07-16 21:10:46 +02:00
Daniel Marjamäki
a3fbad50cb
Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))
2015-07-16 20:17:57 +02:00
Daniel Marjamäki
1a872a2c9f
Fixed #6019 (false negative: Expression is always true/false '!(v!=10) && !(v!=20)')
2015-07-13 20:53:49 +02:00
amai2012
5814c3b84c
Fix some compiler warnings with VS
...
Minor refactoring on Windows SEH code.
2015-06-28 19:20:16 +02:00
Alexander Mai
56e90f95d9
Corrections for non-Microsoft compilers
2015-06-28 12:34:08 +02:00
amai2012
649a89d308
Refactoring: Expose some previously local functions to public and add Tokenizer as argument to distinguish between C and C++ code (e.g. in isSameExpression).
...
Refactoring: Improve type-safety for TestFixture::assertEquals to allow tests with types which were not handled correctly (e.g. unsigned long long)
2015-06-28 12:08:36 +02:00
Daniel Marjamäki
1d49334398
Fixed #6662 (False positive assignIfError (assignment in while condition))
2015-06-20 16:23:16 +02:00
Daniel Marjamäki
af4a4663e2
Fixed #6764 (False positive redundantCondition - !(i>1) is not i<1)
2015-06-19 19:49:05 +02:00
Alexander Mai
60f5bd97df
Refactoring: missing include added, (potential) multi-threading issue fixed, expose static method to allow unit testing
2015-06-18 19:07:51 +02:00
Matthias Krüger
baaf3213e4
checkcondition: only print style message "A && (!A || B)' is equivalent to 'A || B'" if --enable=style is given.
2015-06-18 13:23:48 +02:00
Daniel Marjamäki
d571d5db6f
Fixed compiler warning -Wfloat-equal in template when type is double and there is equality comparison
2015-06-14 20:25:52 +02:00
Daniel Marjamäki
1e1ba6b4a9
Fixed #6574 (False positive oppositeInnerCondition - unknown variable)
2015-06-14 20:06:05 +02:00