Fixed #3892 (False positive: 'if (var >= 0.0) then if (var >= 0.0) always returns true

This commit is contained in:
Daniel Marjamäki 2012-06-15 16:54:02 +02:00
parent 2e2eece085
commit 89b1b4ea6e
2 changed files with 2 additions and 2 deletions

View File

@ -1126,7 +1126,7 @@ void CheckOther::checkIncorrectLogicOperator()
{ 0, { First, "<=" }, "&&", { NA, "!=" }, 0, Less, SecondTrue }, // (x <= 1) && (x != 3) <- second expression always true
{ "!!&&", { First, ">|>=" }, "%oror%", { First, ">|>=" }, "!!&&", LessEqual, SecondTrue }, // (x > 4) || (x > 5) <- second expression always true
{ "!!&&", { First, "<|<=" }, "%oror%", { First, "<|<=" }, "!!&&", MoreEqual, SecondTrue }, // (x < 5) || (x < 4) <- second expression always true
{ 0, { First, ">|>=" }, "&&", { First, ">|>=" }, 0, LessEqual, SecondTrue }, // (x > 4) && (x > 5) <- second expression always true
{ 0, { First, ">|>=" }, "&&", { First, ">|>=" }, 0, MoreEqual, SecondTrue }, // (x > 4) && (x > 5) <- second expression always true
{ 0, { First, "<|<=" }, "&&", { First, "<|<=" }, 0, MoreEqual, SecondTrue }, // (x < 5) && (x < 4) <- second expression always true
};

View File

@ -3001,7 +3001,7 @@ private:
" b = x < 6 && x < 5;\n"
" b = x < 5 || x < 6;\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (style) Redundant condition: If x > 5, the comparison x > 6 is always true.\n"
ASSERT_EQUALS("[test.cpp:2]: (style) Redundant condition: If x > 6, the comparison x > 5 is always true.\n"
"[test.cpp:3]: (style) Redundant condition: If x > 5, the comparison x > 6 is always true.\n"
"[test.cpp:4]: (style) Redundant condition: If x < 6, the comparison x < 5 is always true.\n"
"[test.cpp:5]: (style) Redundant condition: If x < 6, the comparison x < 5 is always true.\n", errout.str());