CheckOther::checkDuplicateExpression(): be lazier if style-reports are not enabled. NFCI.

This commit is contained in:
Matthias Krüger 2017-05-19 00:33:48 +02:00
parent 899615c1e4
commit a2c716fa3b
1 changed files with 2 additions and 3 deletions

View File

@ -1939,7 +1939,7 @@ void CheckOther::checkDuplicateExpression()
const bool assignment = tok->str() == "="; const bool assignment = tok->str() == "=";
if (assignment && warningEnabled) if (assignment && warningEnabled)
selfAssignmentError(tok, tok->astOperand1()->expressionString()); selfAssignmentError(tok, tok->astOperand1()->expressionString());
else { else if (styleEnabled) {
if (_tokenizer->isCPP() && _settings->standards.cpp==Standards::CPP11 && tok->str() == "==") { if (_tokenizer->isCPP() && _settings->standards.cpp==Standards::CPP11 && tok->str() == "==") {
const Token* parent = tok->astParent(); const Token* parent = tok->astParent();
while (parent && parent->astParent()) { while (parent && parent->astParent()) {
@ -1949,8 +1949,7 @@ void CheckOther::checkDuplicateExpression()
continue; continue;
} }
} }
if (styleEnabled) duplicateExpressionError(tok, tok, tok->str());
duplicateExpressionError(tok, tok, tok->str());
} }
} }
} else if (!Token::Match(tok, "[-/%]")) { // These operators are not associative } else if (!Token::Match(tok, "[-/%]")) { // These operators are not associative