diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp index f66c84377..22caed155 100644 --- a/lib/checkstl.cpp +++ b/lib/checkstl.cpp @@ -915,9 +915,12 @@ void CheckStl::missingComparison() void CheckStl::missingComparisonError(const Token *incrementToken1, const Token *incrementToken2) { std::ostringstream errmsg; - errmsg << "The iterator is incremented at line " << incrementToken1->linenr() - << " and then at line " << incrementToken2->linenr() - << ". The loop might unintentionally skip an element in the container. There is no comparison between these increments to prevent that the iterator is incremented beyond the end."; + errmsg << "Missing bounds check for extra iterator increment in loop.\n " + << "The iterator incrementing is suspicious - it is incremented at line " + << incrementToken1->linenr() << " and then at line " << incrementToken2->linenr() + << " The loop might unintentionally skip an element in the container. " + << "There is no comparison between these increments to prevent that the iterator is " + << "incremented beyond the end."; reportError(incrementToken1, Severity::warning, "StlMissingComparison", errmsg.str()); } diff --git a/test/teststl.cpp b/test/teststl.cpp index 59c1a493e..764e00e3e 100644 --- a/test/teststl.cpp +++ b/test/teststl.cpp @@ -1068,7 +1068,7 @@ private: " }\n" " }\n" "}\n"); - ASSERT_EQUALS("[test.cpp:4]: (warning) The iterator is incremented at line 4 and then at line 2. The loop might unintentionally skip an element in the container. There is no comparison between these increments to prevent that the iterator is incremented beyond the end.\n", errout.str()); + ASSERT_EQUALS("[test.cpp:4]: (warning) Missing bounds check for extra iterator increment in loop.\n", errout.str()); } void missingInnerComparison2()