From 2c91b95d2a4e9a3e18c86b6e407688bb7a2ce43f Mon Sep 17 00:00:00 2001 From: Paul Fultz II Date: Mon, 1 Oct 2018 07:34:55 -0500 Subject: [PATCH] Reenable followVar for multicondition (#1401) --- lib/checkcondition.cpp | 6 +++--- test/testcondition.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 0a13a15d9..6f8339135 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -583,10 +583,10 @@ void CheckCondition::multiCondition2() tokens1.push(firstCondition->astOperand1()); tokens1.push(firstCondition->astOperand2()); } else if (!firstCondition->hasKnownValue()) { - if (isOppositeCond(false, mTokenizer->isCPP(), firstCondition, cond2, mSettings->library, true, false, &errorPath)) { + if (isOppositeCond(false, mTokenizer->isCPP(), firstCondition, cond2, mSettings->library, true, true, &errorPath)) { if (!isAliased(vars)) oppositeInnerConditionError(firstCondition, cond2, errorPath); - } else if (isSameExpression(mTokenizer->isCPP(), true, firstCondition, cond2, mSettings->library, true, false, &errorPath)) { + } else if (isSameExpression(mTokenizer->isCPP(), true, firstCondition, cond2, mSettings->library, true, true, &errorPath)) { identicalInnerConditionError(firstCondition, cond2, errorPath); } } @@ -603,7 +603,7 @@ void CheckCondition::multiCondition2() tokens2.push(secondCondition->astOperand1()); tokens2.push(secondCondition->astOperand2()); } else if ((!cond1->hasKnownValue() || !secondCondition->hasKnownValue()) && - isSameExpression(mTokenizer->isCPP(), true, cond1, secondCondition, mSettings->library, true, false, &errorPath)) { + isSameExpression(mTokenizer->isCPP(), true, cond1, secondCondition, mSettings->library, true, true, &errorPath)) { if (!isAliased(vars)) identicalConditionAfterEarlyExitError(cond1, secondCondition, errorPath); } diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 79382478d..8d89222a7 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -1601,7 +1601,7 @@ private: " if(!b) {}\n" " }\n" "}"); - // ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:4]: (warning) Opposite inner 'if' condition leads to a dead code block.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:4]: (warning) Opposite inner 'if' condition leads to a dead code block.\n", errout.str()); check("void foo(unsigned u) {\n" " if (u != 0) {\n"