diff --git a/lib/checkother.cpp b/lib/checkother.cpp index cf3529de2..6e9101893 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -2819,7 +2819,7 @@ void CheckOther::catchExceptionByValueError(const Token *tok) void CheckOther::memsetZeroBytesError(const Token *tok, const std::string &varname) { - reportError(tok, Severity::warning, - "memsetZeroBytes", "memset() called to fill 0 bytes of \"" + varname + "\"" - ". Second and third arguments might be inverted."); + const std::string summary("memset() called to fill 0 bytes of \'" + varname + "\'"); + const std::string verbose(summary + ". Second and third arguments might be inverted."); + reportError(tok, Severity::warning, "memsetZeroBytes", summary + "\n" + verbose); } diff --git a/test/testother.cpp b/test/testother.cpp index 5284aa522..7992a2849 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1625,7 +1625,7 @@ private: "}\n" ); ASSERT_EQUALS("[test.cpp:2]: (warning) memset() called to fill 0" - " bytes of \"p\". Second and third arguments might be inverted.\n", errout.str()); + " bytes of \'p\'\n", errout.str()); check("void f() {\n" " memset(p, sizeof(p), 0)\n" @@ -1633,6 +1633,7 @@ private: ); TODO_ASSERT_EQUALS("[test.cpp:2]: (warning) memset() called to fill 0" " bytes of \"p\". Second and third arguments might be inverted.\n", errout.str()); + ASSERT_EQUALS("", errout.str()); } };