checkcondition: only print style message "A && (!A || B)' is equivalent to 'A || B'" if --enable=style is given.

This commit is contained in:
Matthias Krüger 2015-06-18 13:08:53 +02:00
parent 13c1c2c035
commit baaf3213e4
1 changed files with 1 additions and 1 deletions

View File

@ -629,7 +629,7 @@ void CheckCondition::checkIncorrectLogicOperator()
}
else if (Token::Match(tok, "&&|%oror%")) {
if (tok->str() == "||" && tok->astOperand1() && tok->astOperand2() && tok->astOperand2()->str() == "&&") {
if (printStyle && (tok->str() == "||") && tok->astOperand1() && tok->astOperand2() && tok->astOperand2()->str() == "&&") {
const Token* tok2 = tok->astOperand2()->astOperand1();
if (isOppositeCond(tok->astOperand1(), tok2, _settings->library.functionpure)) {
redundantConditionError(tok, tok2->expressionString() + ". 'A && (!A || B)' is equivalent to 'A || B'");