diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index c55100943..3efa7e645 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1019,7 +1019,9 @@ static void valueFlowArray(TokenList *tokenlist) !tok->variable()->isStlType()) { ValueFlow::Value value{1}; value.setKnown(); - setTokenValue(tok, value, tokenlist->getSettings()); + // TODO : this leads to too many false positives so it is commented out. + // See for instance https://github.com/danmar/cppcheck/commit/025881cf35fdde1299d16a09059e7305f8c9bd13 + // setTokenValue(tok, value, tokenlist->getSettings()); } const std::map::const_iterator it = constantArrays.find(tok->varId()); if (it != constantArrays.end()) { diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 9d0cee3ab..e7c66862c 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -2158,7 +2158,8 @@ private: " X(do);\n" " if (x > 100) {}\n" "}"); - ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:4]: (style) Condition 'x>100' is always false\n", errout.str()); + // TODO: we should probably throw unknownMacro InternalError. Complain that the macro X must be defined. We cant check the code well without the definition. + TODO_ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:4]: (style) Condition 'x>100' is always false\n", "", errout.str()); check("void f(const int *i) {\n" " if (!i) return;\n" @@ -2524,7 +2525,7 @@ private: " int buf[42];\n" " if( buf != 0) {}\n" "}\n"); - ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'buf!=0' is always true\n", errout.str()); + TODO_ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'buf!=0' is always true\n", "", errout.str()); // #8924 // Avoid FP when condition comes from macro check("#define NOT !\n"