diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 4d0ab6254..8bd480f6d 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -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;