diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 5cb8403d3..b170b9c39 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -96,16 +96,15 @@ static bool bailoutFunctionPar(const Token *tok, const ValueFlow::Value &value, /** * Is condition always false when variable has given value? * \param condition top ast token in condition - * \param varid variable id for variable - * \param value value of variable + * \param programMemory program memory */ static bool conditionIsFalse(const Token *condition, const std::map &programMemory) { if (!condition) return false; if (condition->str() == "&&") { - bool result1 = conditionIsFalse(condition->astOperand1(), programMemory); - bool result2 = result1 ? true : conditionIsFalse(condition->astOperand2(), programMemory); + const bool result1 = conditionIsFalse(condition->astOperand1(), programMemory); + const bool result2 = result1 ? true : conditionIsFalse(condition->astOperand2(), programMemory); return result2; } std::map progmem(programMemory); @@ -118,8 +117,7 @@ static bool conditionIsFalse(const Token *condition, const std::map &programMemory) { diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 4686db433..d56ceb1f0 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -1267,9 +1267,9 @@ private: // #6106 code = " f { int i ; b2 , [ ] ( for ( i = 0 ; ; ) ) }"; valueOfTok(code, "*"); - - // 6122 survive garbage code - code = "; { int i ; for ( i = 0 ; = 123 ; ) - ; }"; + + // 6122 survive garbage code + code = "; { int i ; for ( i = 0 ; = 123 ; ) - ; }"; valueOfTok(code, "*"); } };