Commit Graph

161 Commits

Author SHA1 Message Date
Daniel Marjamäki 89be630156 Fixed #7543 (False positive boolean result used in bitwise operation) 2016-07-29 17:24:22 +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
Bartlomiej Grzeskowiak 7e020e1d92 - fix for #7428 false negative: Statement is always false 2016-04-14 14:50:08 +02:00
Daniel Marjamäki 7bd034c009 Fixed #7369 (False positive knownConditionTrueFalse - assertions) 2016-02-06 14:37:44 +01:00
Daniel Marjamäki 40e14f401f CheckCondition::alwaysTrueFalse: Move to normal checking to catch more problems 2016-01-26 10:08:21 +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 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
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
Alexander Mai 2554674f4b Add regression test for previously fixed #6064, and TODO test for #6081 2015-11-07 11:17:44 +01:00
Daniel Marjamäki ac9cb87e04 ValueType: Handle bit operations, sizeof better. Use ValueType in astIsFloat(). 2015-10-11 12:20:40 +02:00
PKEuS 0a34b206e8 Refactorization: Reduced code duplication in test suite 2015-10-08 11:35:51 +02:00
PKEuS 3a5cef8a7e Refactorization: Improved usage of Settings instances in test suite 2015-10-07 18:40:03 +02:00
Simon Martin f273323cd0 Fixed TODO-test for CheckCondition::checkBadBitmaskCheck by handling functions return bool. 2015-09-03 21:07:03 +02:00
Daniel Marjamäki 6865724c4e Fixed #6914 (Token::expressionString: parenthesis missing in expression (*it)->stats.corpse_ticks) 2015-08-12 10:55:25 +02:00
Daniel Marjamäki eda5272dfd Fixed #6875 (Improve 'Redundant condition' error message) 2015-08-05 11:15:54 +02:00
Matthias Krüger 73eefa46fc testcondition: update testcase that was added since I did the changes. 2015-07-31 15:31:43 +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
Daniel Marjamäki 251f6d2a15 Fixed #6898 (Token::expressionString: wrong output when first token is post-incremented) 2015-07-31 07:03:52 +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
amai2012 c5673612e2 #6069 False positive incorrectLogicOperator due to dynamic_cast. Run CheckCondition::checkIncorrectLogicOperator on non-simplified tokenlist. 2015-07-30 10:30:30 +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 64b72bd6e5 Fixed #6227 (False positive (oppositeInnerCondition) - if (!dynamic_cast<>)) 2015-07-27 10:43:52 +02:00
PKEuS 176b3925b3 Removed "verify" code in testrunner. Fixing its messages reduces the accuracy of the test suite. 2015-07-25 14:18:41 +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
orbitcowboy 1d910bc3bc #6313: Added test case for oppositeInnerCondition. 2015-07-16 08:44:38 +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
Alexander Mai 6e03e7dca2 Remove some code checking for invalid class hierarchy which got obsolete since 480a5672b0. Run astyle 2015-07-01 07:50:13 +02:00
amai2012 108b035af2 Adjust two checks which have different results on Windows/Visual Studio than on Linux: one succeeds already, another fails. Analysis/fix is under development. Temporary repair allows to detect further regressions. 2015-06-30 21:21:26 +02:00
Daniel Marjamäki 1d49334398 Fixed #6662 (False positive assignIfError (assignment in while condition)) 2015-06-20 16:23:16 +02:00
Alexander Mai 272cc55ab8 #5309 False positive: redundantCondition - comparing large integer values (unsigned long long). Testcase added, issue got fixed before. 2015-06-20 12:18:24 +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
Daniel Marjamäki 1e1ba6b4a9 Fixed #6574 (False positive oppositeInnerCondition - unknown variable) 2015-06-14 20:06:05 +02:00
Alexander Mai a7b82b5c28 Refactoring to address some issues from #5895 (handling of unsigned numbers). Also adding a TODO testcase since the real issue (FP) is still not fixed 2015-06-13 18:08:13 +02:00
Dmitry-Me cae605b1ec New warning: warn about redundant code in condition. 2015-06-10 18:53:55 +02:00
PKEuS bc5132e0ac Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style 2015-03-11 22:54:43 +01:00
Alexander Mai b9cc5b5c6b #6543 crash: CheckCondition::checkBadBitmaskCheck ; wine dlls/gdi32/dibdrv/primitives.c. Run astyle. 2015-02-23 22:06:55 +01:00
PKEuS bedc935ab0 New check: Warn about constant expression if ( unknown | non_null_constant) (#6519) 2015-02-22 13:09:39 +01:00
Daniel Marjamäki eec938dbad Fixed #6249 (False positive: Incorrect detection of (assignment + comparison) inside for-clause) 2015-02-05 20:17:30 +01:00
Daniel Marjamäki d6c94e3828 isOppositeCond: Fixed FN 2015-02-01 13:03:38 +01:00
Daniel Marjamäki d091639080 Fixed #6482 (False positive multiCondition) 2015-02-01 12:58:06 +01:00
PKEuS 21cb0cfd60 Take simplifyIfNotNull and simplifyIfNot out of simplifyTokenList1 (first step for #6072) 2015-01-31 20:12:02 +01:00
Aneesh Azhakesan S fe5d2fc245 Fixed #5906 (false negative: 'else if' expression is always false (use library to determine if function is pure)) 2015-01-10 12:21:55 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Alexander Mai d2caf89706 #6385 crash in Variable::getFlag(). Catch token without variable in fix for #6095. 2014-12-31 18:19:10 +01:00
Daniel Marjamäki 5c2a2a5c22 Fixed #6095 (False positive oppositeInnerCondition - neglecting statements with side-effects) 2014-12-31 15:14:22 +01:00
Daniel Marjamäki 051d42ae6b astyle formatting 2014-11-20 14:20:09 +01:00
orbitcowboy f5d804f71a running astyle 2014-11-20 10:13:03 +01:00
Dmitry-Me 1e298a31cf Refactoring tests. Use utility function to warn about unsimplified code in tests. 2014-09-13 12:59:32 +02:00
Alexander Mai a690f5856f Fix erroneous call to check() method. That is issues was not find by cppcheck itself, so #6109 has been created 2014-08-30 18:17:18 +02:00
PKEuS 06a92e8981 Moved several condition checks from checkOther to checkCondition (former checkAssignIf) 2014-08-29 17:06:46 +02:00