diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 8cab41f00..c55100943 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1165,6 +1165,10 @@ static void valueFlowSameExpressions(TokenList *tokenlist) static void valueFlowTerminatingCondition(TokenList *tokenlist, SymbolDatabase* symboldatabase, const Settings *settings) { + (void)tokenlist; + (void)symboldatabase; + (void)settings; + /* TODO : this is commented out until #8924 is fixed (There is a test case with the comment #8924) const bool cpp = symboldatabase->isCPP(); typedef std::pair Condition; for (const Scope * scope : symboldatabase->functionScopes) { @@ -1261,6 +1265,7 @@ static void valueFlowTerminatingCondition(TokenList *tokenlist, SymbolDatabase* } } } + */ } static bool getExpressionRange(const Token *expr, MathLib::bigint *minvalue, MathLib::bigint *maxvalue) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index ab7bfd4be..856f0e930 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -3515,7 +3515,7 @@ private: " if (i == j) return;\n" " if(i != j) {}\n" "}\n"; - ASSERT_EQUALS(true, valueOfTok(code, "!=").intvalue == 1); + TODO_ASSERT_EQUALS(true, false, valueOfTok(code, "!=").intvalue == 1); code = "void f(int i, int j) {\n" " if (i == j) return;\n" @@ -3544,7 +3544,7 @@ private: " bool x = (i != j);\n" " bool b = x;\n" "}\n"; - ASSERT_EQUALS(true, testValueOfXKnown(code, 4U, 0)); + TODO_ASSERT_EQUALS(true, false, testValueOfXKnown(code, 4U, 0)); code = "void f(int i, int j) {\n" " if (i != j) return;\n" @@ -3575,6 +3575,16 @@ private: " if(i != j) {}\n" "}\n"; ASSERT_EQUALS(false, valueOfTok(code, "!=").intvalue == 1); + + code = "void foo()\n" // #8924 + "{\n" + " if ( this->FileIndex >= 0 )\n" + " return;\n" + "\n" + " this->FileIndex = 1 ;\n" + " if ( this->FileIndex < 0 ) {}\n" + "}"; + ASSERT_EQUALS(false, valueOfTok(code, "<").intvalue == 1); } static std::string isPossibleContainerSizeValue(const std::list &values, MathLib::bigint i) {