From 053b0d1654ce6d83f599e86488865c410e51d0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 9 Oct 2018 20:10:43 +0200 Subject: [PATCH] STL: enable inconclusive warnings with --inconclusive --- lib/checkstl.cpp | 2 ++ test/teststl.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index e49db3fba..4fc010646 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -237,6 +237,8 @@ void CheckStl::iterators() bool inconclusiveType=false; if (!isIterator(var, inconclusiveType)) continue; + if (inconclusiveType && !mSettings->inconclusive) + continue; const unsigned int iteratorId = var->declarationId(); diff --git a/test/teststl.cpp b/test/teststl.cpp index 25d2b4e99..35e12480d 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -1837,7 +1837,7 @@ private: "int foo() {\n" " iterator i;\n" " return i.foo();;\n" - "}"); + "}", true); ASSERT_EQUALS("", errout.str()); check("class iterator {\n" @@ -1848,7 +1848,7 @@ private: "int foo() {\n" " iterator i;\n" " return i.foo();;\n" - "}"); + "}", true); ASSERT_EQUALS("[test.cpp:8]: (error, inconclusive) Invalid iterator 'i' used.\n", errout.str()); } @@ -1859,7 +1859,7 @@ private: " {\n" " }\n" " }\n" - "}"); + "}", true); ASSERT_EQUALS("", errout.str()); } @@ -3172,7 +3172,7 @@ private: " iterator it; \n" " it->m_place = 0;\n" " return it; \n" - "}\n"); + "}\n", true); ASSERT_EQUALS("[test.cpp:18]: (error, inconclusive) Invalid iterator 'it' used.\n", errout.str()); }