parent
9cbfa0e383
commit
d9adb5432a
|
@ -1164,7 +1164,7 @@ void CheckCondition::alwaysTrueFalse()
|
|||
&& !tok->isBoolean();
|
||||
const bool constValExpr = Token::Match(tok, "%num%|%char%") && tok->astParent() && Token::Match(tok->astParent(),"&&|%oror%|?"); // just one number or char in boolean expression
|
||||
const bool compExpr = Token::Match(tok, "%comp%|!"); // a compare expression
|
||||
|
||||
|
||||
if (!(constIfWhileExpression || constValExpr || compExpr))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -2207,9 +2207,9 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:2]: (style) Condition 'a' is always true\n", errout.str());
|
||||
|
||||
check("void f() {\n"
|
||||
" int a = 5;"
|
||||
" while(a + 1) { a--; }\n"
|
||||
"}");
|
||||
" int a = 5;"
|
||||
" while(a + 1) { a--; }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f() {\n"
|
||||
|
|
Loading…
Reference in New Issue