Clarified errormessage of checkBoost
This commit is contained in:
parent
003a9be3ed
commit
3b5dabdb14
|
@ -51,6 +51,6 @@ void CheckBoost::checkBoostForeachModification()
|
||||||
void CheckBoost::boostForeachError(const Token *tok)
|
void CheckBoost::boostForeachError(const Token *tok)
|
||||||
{
|
{
|
||||||
reportError(tok, Severity::error, "boostForeachError",
|
reportError(tok, Severity::error, "boostForeachError",
|
||||||
"BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container."
|
"BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container inside."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ private:
|
||||||
" data.push_back(123);\n"
|
" data.push_back(123);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (error) BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (error) BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container inside.\n", errout.str());
|
||||||
|
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" set<int> data;\n"
|
" set<int> data;\n"
|
||||||
|
@ -69,7 +69,7 @@ private:
|
||||||
" data.insert(123);\n"
|
" data.insert(123);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (error) BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (error) BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container inside.\n", errout.str());
|
||||||
|
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" set<int> data;\n"
|
" set<int> data;\n"
|
||||||
|
@ -77,7 +77,7 @@ private:
|
||||||
" data.erase(123);\n"
|
" data.erase(123);\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (error) BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (error) BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container inside.\n", errout.str());
|
||||||
|
|
||||||
// Check single line usage
|
// Check single line usage
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
|
@ -85,7 +85,7 @@ private:
|
||||||
" BOOST_FOREACH(const int &i, data)\n"
|
" BOOST_FOREACH(const int &i, data)\n"
|
||||||
" data.clear();\n"
|
" data.clear();\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (error) BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:4]: (error) BOOST_FOREACH caches the end() iterator. It's undefined behavior if you modify the container inside.\n", errout.str());
|
||||||
|
|
||||||
// Container returned as result of a function -> Be quiet
|
// Container returned as result of a function -> Be quiet
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
|
|
Loading…
Reference in New Issue