CheckCondition::alwaysTrueFalse: Move to normal checking to catch more problems

This commit is contained in:
Daniel Marjamäki 2016-01-26 10:08:21 +01:00
parent a391bca060
commit 40e14f401f
2 changed files with 4 additions and 2 deletions

View File

@ -51,6 +51,7 @@ public:
checkCondition.oppositeInnerCondition();
checkCondition.checkIncorrectLogicOperator();
checkCondition.checkInvalidTestForOverflow();
checkCondition.alwaysTrueFalse();
}
/** @brief Run checks against the simplified token list */
@ -60,7 +61,6 @@ public:
checkCondition.checkBadBitmaskCheck();
checkCondition.comparison();
checkCondition.checkModuloAlwaysTrueFalse();
checkCondition.alwaysTrueFalse();
}
/** mismatching assignment / comparison */

View File

@ -1596,7 +1596,9 @@ private:
" A(x++ == 1);\n"
" A(x++ == 2);\n"
"}");
ASSERT_EQUALS("[test.cpp:4]: (style) Condition 'x++==2' is always false\n", errout.str());
ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'x++==1' is always false\n"
"[test.cpp:4]: (style) Condition 'x++==2' is always false\n",
errout.str());
// Avoid FP when condition comes from macro
check("void f() {\n"