From a2c716fa3b73311bf162cdf930471a793902bb8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 19 May 2017 00:33:48 +0200 Subject: [PATCH] CheckOther::checkDuplicateExpression(): be lazier if style-reports are not enabled. NFCI. --- lib/checkother.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index b5595dfec..25900433f 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -1939,7 +1939,7 @@ void CheckOther::checkDuplicateExpression() const bool assignment = tok->str() == "="; if (assignment && warningEnabled) selfAssignmentError(tok, tok->astOperand1()->expressionString()); - else { + else if (styleEnabled) { if (_tokenizer->isCPP() && _settings->standards.cpp==Standards::CPP11 && tok->str() == "==") { const Token* parent = tok->astParent(); while (parent && parent->astParent()) { @@ -1949,8 +1949,7 @@ void CheckOther::checkDuplicateExpression() continue; } } - if (styleEnabled) - duplicateExpressionError(tok, tok, tok->str()); + duplicateExpressionError(tok, tok, tok->str()); } } } else if (!Token::Match(tok, "[-/%]")) { // These operators are not associative