#7285 wrong var name: memset() called to fill 0 bytes of '&' memset with pointer: remove var name from message. Correct some entries in posix.cfg.
This commit is contained in:
parent
8f84f139d7
commit
7802517a69
|
@ -2516,7 +2516,6 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
||||||
</function>
|
</function>
|
||||||
<!-- char *realpath(const char *path, char *resolved_path); -->
|
<!-- char *realpath(const char *path, char *resolved_path); -->
|
||||||
<function name="realpath">
|
<function name="realpath">
|
||||||
<use-retval/>
|
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
@ -2527,7 +2526,6 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
||||||
</function>
|
</function>
|
||||||
<!-- int remove(const char *pathname); -->
|
<!-- int remove(const char *pathname); -->
|
||||||
<function name="remove">
|
<function name="remove">
|
||||||
<use-retval/>
|
|
||||||
<noreturn>false</noreturn>
|
<noreturn>false</noreturn>
|
||||||
<leak-ignore/>
|
<leak-ignore/>
|
||||||
<arg nr="1">
|
<arg nr="1">
|
||||||
|
|
|
@ -1115,7 +1115,7 @@ void CheckOther::checkMemsetZeroBytes()
|
||||||
|
|
||||||
void CheckOther::memsetZeroBytesError(const Token *tok, const std::string &varname)
|
void CheckOther::memsetZeroBytesError(const Token *tok, const std::string &varname)
|
||||||
{
|
{
|
||||||
const std::string summary("memset() called to fill 0 bytes of '" + varname + "'.");
|
const std::string summary("memset() called to fill 0 bytes.");
|
||||||
const std::string verbose(summary + " The second and third arguments might be inverted."
|
const std::string verbose(summary + " The second and third arguments might be inverted."
|
||||||
" The function memset ( void * ptr, int value, size_t num ) sets the"
|
" The function memset ( void * ptr, int value, size_t num ) sets the"
|
||||||
" first num bytes of the block of memory pointed by ptr to the specified value.");
|
" first num bytes of the block of memory pointed by ptr to the specified value.");
|
||||||
|
|
|
@ -3265,12 +3265,12 @@ private:
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" memset(p, 10, 0x0);\n"
|
" memset(p, 10, 0x0);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:2]: (warning) memset() called to fill 0 bytes of 'p'.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:2]: (warning) memset() called to fill 0 bytes.\n", errout.str());
|
||||||
|
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" memset(p, sizeof(p), 0);\n"
|
" memset(p, sizeof(p), 0);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("[test.cpp:2]: (warning) memset() called to fill 0 bytes of 'p'.\n", errout.str());
|
ASSERT_EQUALS("[test.cpp:2]: (warning) memset() called to fill 0 bytes.\n", errout.str());
|
||||||
|
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" memset(p, sizeof(p), i);\n"
|
" memset(p, sizeof(p), i);\n"
|
||||||
|
@ -3286,6 +3286,12 @@ private:
|
||||||
"};");
|
"};");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// #7285
|
||||||
|
check("void f() {\n"
|
||||||
|
" memset(&tm, sizeof(tm), 0);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("[test.cpp:2]: (warning) memset() called to fill 0 bytes.\n", errout.str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void memsetInvalid2ndParam() {
|
void memsetInvalid2ndParam() {
|
||||||
|
|
Loading…
Reference in New Issue