Fix Cppcheck warning
This commit is contained in:
parent
044c4b7fbb
commit
86782af43c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue