Commit Graph

161 Commits

Author SHA1 Message Date
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki 28cfee2d4f Fixed #8250 (New check: Pointer calculation result cant be NULL unless there is overflow) 2017-10-22 14:32:54 +02:00
Daniel Marjamäki 5993c40d5b Improve 'opposite inner condition' check 2017-09-22 14:01:20 +02:00
Daniel Marjamäki 927b14b60f Fixed #8217 (Crash in isVariableChanged()) 2017-09-14 15:45:15 +02:00
Daniel Marjamäki bb20c0504e CheckCondition: Fix FP in daca (iqtree) 'in >> ch' 2017-09-13 22:46:36 +02:00
Daniel Marjamäki 9f4fc7b323 Rename sameConditionAfterEarlyExit to identicalConditionAfterEarlyExit 2017-09-10 22:59:39 +02:00
Daniel Marjamäki db321c2617 CheckCondition: Fix FP when there is increment/decrement in condition (daca icu) 2017-09-10 22:58:05 +02:00
Daniel Marjamäki c34fdd1905 CheckCondition: Fix FP for undeclared variables (daca) 2017-09-10 22:30:41 +02:00
Daniel Marjamäki 899ad8479d CheckCondition: Fixed FP when condition contains global static variable 2017-09-08 15:44:56 +02:00
Daniel Marjamäki d9adb5432a astyle formatting
[ci skip]
2017-09-08 15:41:14 +02:00
Nekto89 9cbfa0e383 Fix #7803: false negative: condition is always true 'if (flags & A)' (#938) 2017-09-08 14:30:42 +02:00
Daniel Marjamäki 58db814d72 Rephraze /Same/Identical/ 2017-09-08 12:41:33 +02:00
Daniel Marjamäki 120d0f86d0 CheckCondition: Fix FP about same condition when switch case is used (daca) 2017-09-07 22:05:01 +02:00
Daniel Marjamäki f2d56363d3 CheckCondition: Fix TODO assertion 2017-09-06 22:53:36 +02:00
Daniel Marjamäki e0c7f7f8f2 CheckCondition: Fix FP when there are method calls in condition 2017-09-06 22:26:00 +02:00
Daniel Marjamäki 35736364f8 Fixed #8199 (false negative: (warning) Same condition '...', second condition is always false) 2017-09-05 22:45:28 +02:00
Daniel Marjamäki e5e6f37e41 Fixed #7405 (false positive: (warning) Opposite conditions in nested 'if' blocks lead to a dead code block.) 2017-09-05 22:03:29 +02:00
Daniel Marjamäki c1000998f0 CheckCondition: Fix FP found in daca results (ace) 2017-09-05 09:33:35 +02:00
Daniel Marjamäki d82805b7fe CheckCondition: Improved checking for same conditions 2017-09-04 22:40:34 +02:00
Daniel Marjamäki abae5e0156 Fixed #8198 (false positive: (warning) Same condition, second condition is always false) 2017-09-04 22:25:20 +02:00
Daniel Marjamäki ad494b996c TestCondition: break out tests to functions 2017-09-04 22:11:53 +02:00
Daniel Marjamäki d838dc2129 CheckCondition::multiCondition2: Fix FN for pointers 2017-09-04 15:58:22 +02:00
Daniel Marjamäki 9465dca583 CheckCondition: Fix FPs for aliased variables (daca) 2017-09-04 09:34:03 +02:00
Daniel Marjamäki ef4a7ba7f2 Fix FP in CheckCondition::multiCondition2 2017-09-03 14:46:37 +02:00
Daniel Marjamäki b9849d9e4e CheckCondition::multiCondition2: Handle loops better 2017-09-03 11:03:01 +02:00
Daniel Marjamäki 01e65d3e00 Improved CheckCondition::multiCondition2 so deeper bugs are found 2017-09-03 10:44:22 +02:00
Daniel Marjamäki f2ec5f24ce Fixed #5845 (new check: same condition after noreturn conditional code => second condition is always false) 2017-09-03 10:34:34 +02:00
Daniel Marjamäki 0b751dcc1b Opposite conditions: Better matching when outer condition uses && 2017-09-01 23:24:15 +02:00
Daniel Marjamäki 3b4f60fd21 Updated error message 2017-09-01 13:33:47 +02:00
Daniel Marjamäki 7fad1b9a36 Improved checking for opposite conditions 2017-08-31 22:53:21 +02:00
Daniel Marjamäki dce942197c Fixed #8186 (Inner condition always false inside for loop) 2017-08-31 16:00:12 +02:00
Daniel Marjamäki 255d0410a4 Fixed #8085 (Token::expressionString: unsigned long long) 2017-07-21 09:16:42 +02:00
Daniel Marjamäki 814d2ae2a4 Fixed #7028 (False positive: opposite conditions (const method modifies variable)) 2017-07-10 23:12:45 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 040d2f0012 Use simplecpp lexer in test cases 2017-05-18 21:52:31 +02:00
Daniel Marjamäki 55cd69e290 alwaysTrueFalse: Dont warn when checking sizeof for some type. such condition might be platform dependent. 2017-05-13 19:07:24 +02:00
Daniel Marjamäki 7fd04cd8d0 Updated Token::expressionString(), write '->' instead of '.' 2017-04-30 14:22:18 +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 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
Daniel Marjamäki a53f14da25 Fixed #7925 (False Positive identical condition) 2017-02-22 21:13:36 +01:00
Stefan Weil 57b57428c2 Fix some typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +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 58eb644003 Improved Check: Warn about number and char literals in boolean expressions (#7750) 2016-10-09 13:21:00 +02:00
Daniel Marjamäki 9417425829 Fix testrunner 2016-08-29 04:26:27 +02: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
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