memsetZeroBytes: improved error message. ticket: #2421
This commit is contained in:
parent
77ed6ecb5d
commit
37b1f7c296
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue