STL: enable inconclusive warnings with --inconclusive

This commit is contained in:
Daniel Marjamäki 2018-10-09 20:10:43 +02:00
parent babafd75e3
commit 053b0d1654
2 changed files with 6 additions and 4 deletions

View File

@ -237,6 +237,8 @@ void CheckStl::iterators()
bool inconclusiveType=false; bool inconclusiveType=false;
if (!isIterator(var, inconclusiveType)) if (!isIterator(var, inconclusiveType))
continue; continue;
if (inconclusiveType && !mSettings->inconclusive)
continue;
const unsigned int iteratorId = var->declarationId(); const unsigned int iteratorId = var->declarationId();

View File

@ -1837,7 +1837,7 @@ private:
"int foo() {\n" "int foo() {\n"
" iterator i;\n" " iterator i;\n"
" return i.foo();;\n" " return i.foo();;\n"
"}"); "}", true);
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
check("class iterator {\n" check("class iterator {\n"
@ -1848,7 +1848,7 @@ private:
"int foo() {\n" "int foo() {\n"
" iterator i;\n" " iterator i;\n"
" return i.foo();;\n" " return i.foo();;\n"
"}"); "}", true);
ASSERT_EQUALS("[test.cpp:8]: (error, inconclusive) Invalid iterator 'i' used.\n", errout.str()); ASSERT_EQUALS("[test.cpp:8]: (error, inconclusive) Invalid iterator 'i' used.\n", errout.str());
} }
@ -1859,7 +1859,7 @@ private:
" {\n" " {\n"
" }\n" " }\n"
" }\n" " }\n"
"}"); "}", true);
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
@ -3172,7 +3172,7 @@ private:
" iterator it; \n" " iterator it; \n"
" it->m_place = 0;\n" " it->m_place = 0;\n"
" return it; \n" " return it; \n"
"}\n"); "}\n", true);
ASSERT_EQUALS("[test.cpp:18]: (error, inconclusive) Invalid iterator 'it' used.\n", errout.str()); ASSERT_EQUALS("[test.cpp:18]: (error, inconclusive) Invalid iterator 'it' used.\n", errout.str());
} }