From ab55b9eccba945754f1149d1e99f95fadf914b69 Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Sun, 2 Sep 2018 01:43:17 -0500 Subject: [PATCH] Check for same expression in condition check to avoid duplicate messages (#1359) --- lib/checkcondition.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 39f3cb8fc..3b4104040 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -1214,6 +1214,8 @@ void CheckCondition::alwaysTrueFalse() continue; if (Token::Match(tok, "%oror%|&&")) continue; + if (Token::Match(tok, "%comp%") && isSameExpression(mTokenizer->isCPP(), true, tok->astOperand1(), tok->astOperand2(), mSettings->library, true)) + continue; const bool constIfWhileExpression = tok->astParent() && Token::Match(tok->astTop()->astOperand1(), "if|while") &&