Always give a warning when 'memset' is used upon a class

This commit is contained in:
Daniel Marjamäki 2007-07-20 06:18:33 +00:00
parent 3ee0d3c9d3
commit 8af24ee783
1 changed files with 2 additions and 6 deletions

View File

@ -418,19 +418,15 @@ void CheckMemset()
if (!(type && type[0])) if (!(type && type[0]))
continue; continue;
// It will be assumed that memset can be used upon 'this'.
// Todo: Check this too
if (strcmp(getstr(tok,2),"this") == 0)
continue;
// Warn if type is a class.. // Warn if type is a class..
const char *pattern1[] = {"class","",NULL}; const char *pattern1[] = {"class","",NULL};
pattern1[1] = type; pattern1[1] = type;
if (findtoken(tokens,pattern1)) if (strcmp("this",getstr(tok,2))==0 || findtoken(tokens,pattern1))
{ {
std::ostringstream ostr; std::ostringstream ostr;
ostr << FileLine(tok) << ": Using 'memset' on class."; ostr << FileLine(tok) << ": Using 'memset' on class.";
ReportErr(ostr.str()); ReportErr(ostr.str());
continue;
} }
// Warn if type is a struct that contains any std::* // Warn if type is a struct that contains any std::*