Fix ticket #637 (False positive, Using 'memset' on struct that contains a 'std::string')
http://sourceforge.net/apps/trac/cppcheck/ticket/637
This commit is contained in:
parent
7569bda227
commit
686ff425f9
|
@ -649,7 +649,7 @@ void CheckClass::noMemset()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warn if type is a struct that contains any std::*
|
// Warn if type is a struct that contains any std::*
|
||||||
const std::string pattern2(std::string("struct ") + type);
|
const std::string pattern2(std::string("struct ") + type + " {");
|
||||||
for (const Token *tstruct = Token::findmatch(_tokenizer->tokens(), pattern2.c_str()); tstruct; tstruct = tstruct->next())
|
for (const Token *tstruct = Token::findmatch(_tokenizer->tokens(), pattern2.c_str()); tstruct; tstruct = tstruct->next())
|
||||||
{
|
{
|
||||||
if (tstruct->str() == "}")
|
if (tstruct->str() == "}")
|
||||||
|
|
|
@ -685,7 +685,7 @@ private:
|
||||||
" struct sockaddr_in6 fail;\n"
|
" struct sockaddr_in6 fail;\n"
|
||||||
" memset(&fail, 0, sizeof(struct sockaddr_in6));\n"
|
" memset(&fail, 0, sizeof(struct sockaddr_in6));\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
TODO_ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
checkNoMemset("struct A\n"
|
checkNoMemset("struct A\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue