CheckOther: Minor updates. Removed false positives for CheckScope
This commit is contained in:
parent
815dd364ed
commit
6881a364a2
|
@ -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;
|
||||
|
||||
|
@ -669,35 +670,31 @@ void CheckCharVariable()
|
|||
|
||||
void CheckIncompleteStatement()
|
||||
{
|
||||
int parlevel = 0;
|
||||
int parlevel = 0;
|
||||
|
||||
for ( const TOKEN *tok = tokens; tok; tok = tok->next )
|
||||
{
|
||||
if ( Match(tok,"; %str%") && !Match(gettok(tok,2), ",") )
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
errmsg << FileLine(tok->next) << ": Redundant code: Found a statement that begins with string constant";
|
||||
ReportErr(errmsg.str());
|
||||
}
|
||||
for ( const TOKEN *tok = tokens; tok; tok = tok->next )
|
||||
{
|
||||
if ( tok->str[0] == '(' )
|
||||
++parlevel;
|
||||
else if ( tok->str[0] == ')' )
|
||||
--parlevel;
|
||||
|
||||
if ( Match(tok,"; %num%") && !Match(gettok(tok,2), ",") )
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
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 )
|
||||
continue;
|
||||
|
||||
if ( parlevel == 0 && Match(tok, "[;{}] %var% ;") )
|
||||
{
|
||||
if ( Match(tok,"; %str%") && !Match(gettok(tok,2), ",") )
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
errmsg << FileLine(tok->next) << ": Redundant code: Found a statement that only contains a variable";
|
||||
errmsg << FileLine(tok->next) << ": Redundant code: Found a statement that begins with string constant";
|
||||
ReportErr(errmsg.str());
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
if ( Match(tok,"; %num%") && !Match(gettok(tok,2), ",") )
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
errmsg << FileLine(tok->next) << ": Redundant code: Found a statement that begins with numeric constant";
|
||||
ReportErr(errmsg.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue