Check for same expression in condition check to avoid duplicate messages (#1359)

This commit is contained in:
Paul Fultz II 2018-09-02 01:43:17 -05:00 committed by Daniel Marjamäki
parent 341dee4a07
commit ab55b9eccb
1 changed files with 2 additions and 0 deletions

View File

@ -1214,6 +1214,8 @@ void CheckCondition::alwaysTrueFalse()
continue; continue;
if (Token::Match(tok, "%oror%|&&")) if (Token::Match(tok, "%oror%|&&"))
continue; continue;
if (Token::Match(tok, "%comp%") && isSameExpression(mTokenizer->isCPP(), true, tok->astOperand1(), tok->astOperand2(), mSettings->library, true))
continue;
const bool constIfWhileExpression = const bool constIfWhileExpression =
tok->astParent() && Token::Match(tok->astTop()->astOperand1(), "if|while") && tok->astParent() && Token::Match(tok->astTop()->astOperand1(), "if|while") &&