Improve the 'suspicious code sizeof sizeof' -message.
As discussed at dev-forum: https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
This commit is contained in:
parent
3068dbf22e
commit
85735e382f
|
@ -2611,7 +2611,9 @@ void CheckOther::sizeofsizeof()
|
||||||
void CheckOther::sizeofsizeofError(const Token *tok)
|
void CheckOther::sizeofsizeofError(const Token *tok)
|
||||||
{
|
{
|
||||||
reportError(tok, Severity::warning,
|
reportError(tok, Severity::warning,
|
||||||
"sizeofsizeof", "Suspicious code 'sizeof sizeof ..', most likely there should only be one sizeof. The current code is equivalent to 'sizeof(size_t)'.");
|
"sizeofsizeof", "Calling sizeof for 'sizeof'.\n"
|
||||||
|
"This is suspicious code and most likely there should be just"
|
||||||
|
"one 'sizeof'. The current code is equivalent to 'sizeof(size_t)'");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckOther::sizeofCalculation()
|
void CheckOther::sizeofCalculation()
|
||||||
|
|
|
@ -920,7 +920,7 @@ private:
|
||||||
"{\n"
|
"{\n"
|
||||||
" int i = sizeof sizeof char;\n"
|
" int i = sizeof sizeof char;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Suspicious code 'sizeof sizeof ..', most likely there should only be one sizeof. The current code is equivalent to 'sizeof(size_t)'.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:3]: (warning) Calling sizeof for 'sizeof'.\n", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void sizeofCalculation()
|
void sizeofCalculation()
|
||||||
|
|
Loading…
Reference in New Issue