From baaf3213e44def467d4d11b2b867859357193b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Thu, 18 Jun 2015 13:08:53 +0200 Subject: [PATCH] checkcondition: only print style message "A && (!A || B)' is equivalent to 'A || B'" if --enable=style is given. --- lib/checkcondition.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 3cd6574b0..aaa94850c 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -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'");