Skip to content

Commit

Permalink
Filter ValueFlow messages
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Jun 24, 2023
1 parent 143b948 commit e22572e
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions test/testfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ class TestFunctions : public TestFixture {
std::istringstream istr(code);
ASSERT_LOC(tokenizer.tokenize(istr, filename), file, line);

// filter out ValueFlow messages..
const std::string debugwarnings = errout.str();
errout.str("");
std::istringstream istr2(debugwarnings);
std::string errline;
while (std::getline(istr2, errline)) {
if (errline.find("valueflow.cpp") == std::string::npos)
errout << errline << "\n";
}

runChecks<CheckFunctions>(&tokenizer, settings_, this);
}

Expand Down Expand Up @@ -1947,10 +1957,7 @@ class TestFunctions : public TestFixture {
" for (it = l.begin(); it != l.end(); ++it)\n"
" it->g(0);\n"
"}\n", "test.cpp", &s);
TODO_ASSERT_EQUALS("",
"[test.cpp:4]: (debug) valueflow.cpp:6270:(valueFlow) bailout: variable 'it' used in loop\n"
"[test.cpp:4]: (debug) valueflow.cpp:6294:(valueFlow) bailout: variable 'l.end()' used in loop\n",
errout.str());
ASSERT_EQUALS("", errout.str());

check("auto f() {\n"
" return std::runtime_error(\"abc\");\n"
Expand All @@ -1977,9 +1984,7 @@ class TestFunctions : public TestFixture {
" const auto& t = N::S::s;\n"
" if (t.find(\"abc\") != t.end()) {}\n"
"}\n", "test.cpp", &s);
TODO_ASSERT_EQUALS("",
"[test.cpp:6]: (debug) valueflow.cpp:6571:(valueFlow) bailout: valueFlowAfterCondition: bailing in conditional block\n",
errout.str());
ASSERT_EQUALS("", errout.str());

check("void f(std::vector<std::unordered_map<int, std::unordered_set<int>>>& v, int i, int j) {\n"
" auto& s = v[i][j];\n"
Expand Down Expand Up @@ -2026,11 +2031,7 @@ class TestFunctions : public TestFixture {
" auto t = h();\n"
" if (t.at(0)) {}\n"
"};\n", "test.cpp", &s);
TODO_ASSERT_EQUALS("",
"[test.cpp:2]: (debug) valueflow.cpp:5246:valueFlowConditionExpressions bailout: Skipping function due to incomplete variable string\n"
"[test.cpp:4]: (debug) valueflow.cpp:6571:(valueFlow) bailout: valueFlowAfterCondition: bailing in conditional block\n"
"[test.cpp:7]: (debug) valueflow.cpp:6571:(valueFlow) bailout: valueFlowAfterCondition: bailing in conditional block\n",
errout.str());
ASSERT_EQUALS("", errout.str());
}

void checkUseStandardLibrary1() {
Expand Down

0 comments on commit e22572e

Please sign in to comment.