diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index 3d6a4ef02..063eaff5b 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -585,7 +585,7 @@ void CheckCondition::multiCondition2() } else if (isOppositeCond(false, _tokenizer->isCPP(), firstCondition, cond2, _settings->library, true)) { if (!isAliased(vars)) oppositeInnerConditionError(firstCondition, cond2); - } else if(isSameExpression(_tokenizer->isCPP(), true, firstCondition, cond2, _settings->library, true)) { + } else if (isSameExpression(_tokenizer->isCPP(), true, firstCondition, cond2, _settings->library, true)) { identicalInnerConditionError(firstCondition, cond2); } } diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 03190306f..fddf77433 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -2535,9 +2535,9 @@ static void valueFlowAfterCondition(TokenList *tokenlist, SymbolDatabase* symbol bool bail = false; - for(int i=0;i<2;i++) { + for (int i=0; i<2; i++) { Token * startToken = startTokens[i]; - if(startToken) { + if (startToken) { std::list & values = (i==0 ? true_values : false_values); if (values.size() == 1U && Token::Match(tok, "==|!")) { const Token *parent = tok->astParent(); @@ -2558,7 +2558,7 @@ static void valueFlowAfterCondition(TokenList *tokenlist, SymbolDatabase* symbol } } } - if(bail) + if (bail) continue; // After conditional code.. diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 8229f4942..cca1c6124 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -1878,7 +1878,7 @@ private: check("void f1(const std::string v[10]) { if(v[0].size() > 42) if(v[1].empty()) {}} "); ASSERT_EQUALS("", errout.str()); } - + void identicalInnerCondition() { check("void f1(int a, int b) { if(a==b) if(a==b) {}}"); ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (warning) Identical inner 'if' condition is always true.\n", errout.str());