CheckOther: Minor updates. Removed false positives for CheckScope

This commit is contained in:
Daniel Marjamäki 2008-09-23 16:03:39 +00:00
parent 815dd364ed
commit 6881a364a2
1 changed files with 23 additions and 26 deletions

View File

@ -423,6 +423,7 @@ void CheckVariableScope()
if (strcmp(tok1->str,"return")==0 ||
strcmp(tok1->str,"delete")==0 ||
strcmp(tok1->str,"goto")==0 ||
strcmp(tok1->str,"else")==0)
continue;
@ -673,6 +674,14 @@ void CheckIncompleteStatement()
for ( const TOKEN *tok = tokens; tok; tok = tok->next )
{
if ( tok->str[0] == '(' )
++parlevel;
else if ( tok->str[0] == ')' )
--parlevel;
if ( parlevel != 0 )
continue;
if ( Match(tok,"; %str%") && !Match(gettok(tok,2), ",") )
{
std::ostringstream errmsg;
@ -686,18 +695,6 @@ void CheckIncompleteStatement()
errmsg << FileLine(tok->next) << ": Redundant code: Found a statement that begins with numeric constant";
ReportErr(errmsg.str());
}
/*
if ( tok->str[0] == '(' )
++parlevel;
else if ( tok->str[0] == ')' )
--parlevel;
if ( parlevel == 0 && Match(tok, "[;{}] %var% ;") )
{
std::ostringstream errmsg;
errmsg << FileLine(tok->next) << ": Redundant code: Found a statement that only contains a variable";
ReportErr(errmsg.str());
}
*/
}
}