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:
Reijo Tomperi 2009-09-02 23:51:07 +03:00
parent 7569bda227
commit 686ff425f9
2 changed files with 2 additions and 2 deletions

View File

@ -649,7 +649,7 @@ void CheckClass::noMemset()
}
// 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())
{
if (tstruct->str() == "}")

View File

@ -685,7 +685,7 @@ private:
" struct sockaddr_in6 fail;\n"
" memset(&fail, 0, sizeof(struct sockaddr_in6));\n"
"}\n");
TODO_ASSERT_EQUALS("", errout.str());
ASSERT_EQUALS("", errout.str());
checkNoMemset("struct A\n"
"{\n"