CheckCondition::alwaysTrueFalse: Move to normal checking to catch more problems
This commit is contained in:
parent
a391bca060
commit
40e14f401f
|
@ -51,6 +51,7 @@ public:
|
||||||
checkCondition.oppositeInnerCondition();
|
checkCondition.oppositeInnerCondition();
|
||||||
checkCondition.checkIncorrectLogicOperator();
|
checkCondition.checkIncorrectLogicOperator();
|
||||||
checkCondition.checkInvalidTestForOverflow();
|
checkCondition.checkInvalidTestForOverflow();
|
||||||
|
checkCondition.alwaysTrueFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Run checks against the simplified token list */
|
/** @brief Run checks against the simplified token list */
|
||||||
|
@ -60,7 +61,6 @@ public:
|
||||||
checkCondition.checkBadBitmaskCheck();
|
checkCondition.checkBadBitmaskCheck();
|
||||||
checkCondition.comparison();
|
checkCondition.comparison();
|
||||||
checkCondition.checkModuloAlwaysTrueFalse();
|
checkCondition.checkModuloAlwaysTrueFalse();
|
||||||
checkCondition.alwaysTrueFalse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** mismatching assignment / comparison */
|
/** mismatching assignment / comparison */
|
||||||
|
|
|
@ -1596,7 +1596,9 @@ private:
|
||||||
" A(x++ == 1);\n"
|
" A(x++ == 1);\n"
|
||||||
" A(x++ == 2);\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
|
// Avoid FP when condition comes from macro
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
|
|
Loading…
Reference in New Issue