Fix Cppcheck warning

This commit is contained in:
Daniel Marjamäki 2018-10-25 07:15:32 +02:00
parent 044c4b7fbb
commit 86782af43c
1 changed files with 4 additions and 4 deletions

View File

@ -1285,10 +1285,6 @@ void CheckCondition::alwaysTrueFalse()
const bool returnStatement = Token::simpleMatch(tok->astTop(), "return") &&
Token::Match(tok->astParent(), "%oror%|&&|return");
// FIXME checking of return statements does not work well. See #8801
if (returnStatement)
continue;
if (!(constIfWhileExpression || constValExpr || compExpr || returnStatement))
continue;
@ -1302,6 +1298,10 @@ void CheckCondition::alwaysTrueFalse()
!isVariableChanged(tok->variable(), mSettings, mTokenizer->isCPP())))
continue;
// FIXME checking of return statements does not work well. See #8801
if (returnStatement)
continue;
// Don't warn in assertions. Condition is often 'always true' by intention.
// If platform,defines,etc cause 'always false' then that is not dangerous neither.
bool assertFound = false;