cleanup: removed spaces
This commit is contained in:
parent
a282495c2a
commit
81bcde9ed0
118
CheckOther.cpp
118
CheckOther.cpp
|
@ -124,9 +124,9 @@ void WarningRedundantCode()
|
|||
if (varname1==NULL || tok2==NULL)
|
||||
continue;
|
||||
|
||||
if ( tok2->str[0] == '{' )
|
||||
tok2 = tok2->next;
|
||||
|
||||
if ( tok2->str[0] == '{' )
|
||||
tok2 = tok2->next;
|
||||
|
||||
bool err = false;
|
||||
if (Match(tok2,"delete %var% ;"))
|
||||
err = (strcmp(getstr(tok2,1),varname1)==0);
|
||||
|
@ -240,7 +240,7 @@ void WarningIf()
|
|||
ostr << (i < 3 ? "True" : "False");
|
||||
}
|
||||
ReportErr(ostr.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
@ -533,7 +533,6 @@ static void CheckVariableScope_LookupVar( const TOKEN *tok1, const char varname[
|
|||
ReportErr( errmsg.str() );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -573,65 +572,64 @@ void CheckConstantFunctionParameter()
|
|||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
// Check that all struct members are used
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void CheckStructMemberUsage()
|
||||
{
|
||||
const char *structname = 0;
|
||||
|
||||
for ( const TOKEN *tok = tokens; tok; tok = tok->next )
|
||||
{
|
||||
if ( tok->FileIndex != 0 )
|
||||
continue;
|
||||
if ( tok->str[0] == '}' )
|
||||
structname = 0;
|
||||
if ( Match(tok, "struct %type% {") )
|
||||
structname = getstr(tok, 1);
|
||||
|
||||
if (structname && Match(tok, "[{;]"))
|
||||
{
|
||||
const char *varname = 0;
|
||||
if (Match(tok->next, "%type% %var% [;[]"))
|
||||
varname = getstr( tok, 2 );
|
||||
else if (Match(tok->next, "%type% %type% %var% [;[]"))
|
||||
varname = getstr( tok, 2 );
|
||||
else if (Match(tok->next, "%type% * %var% [;[]"))
|
||||
varname = getstr( tok, 3 );
|
||||
else if (Match(tok->next, "%type% %type% * %var% [;[]"))
|
||||
varname = getstr( tok, 4 );
|
||||
else
|
||||
continue;
|
||||
|
||||
const char *varnames[2];
|
||||
varnames[0] = varname;
|
||||
varnames[1] = 0;
|
||||
bool used = false;
|
||||
for ( const TOKEN *tok2 = tokens; tok2; tok2 = tok2->next )
|
||||
{
|
||||
if ( tok->FileIndex != 0 )
|
||||
continue;
|
||||
|
||||
if (Match(tok2, ". %var%", varnames))
|
||||
{
|
||||
if ( strcmp("=", getstr(tok2,2)) == 0 )
|
||||
continue;
|
||||
used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! used )
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
errmsg << FileLine(tok) << ": struct member '" << structname << "::" << varname << "' is never read";
|
||||
ReportErr(errmsg.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
void CheckStructMemberUsage()
|
||||
{
|
||||
const char *structname = 0;
|
||||
|
||||
for ( const TOKEN *tok = tokens; tok; tok = tok->next )
|
||||
{
|
||||
if ( tok->FileIndex != 0 )
|
||||
continue;
|
||||
if ( tok->str[0] == '}' )
|
||||
structname = 0;
|
||||
if ( Match(tok, "struct %type% {") )
|
||||
structname = getstr(tok, 1);
|
||||
|
||||
if (structname && Match(tok, "[{;]"))
|
||||
{
|
||||
const char *varname = 0;
|
||||
if (Match(tok->next, "%type% %var% [;[]"))
|
||||
varname = getstr( tok, 2 );
|
||||
else if (Match(tok->next, "%type% %type% %var% [;[]"))
|
||||
varname = getstr( tok, 2 );
|
||||
else if (Match(tok->next, "%type% * %var% [;[]"))
|
||||
varname = getstr( tok, 3 );
|
||||
else if (Match(tok->next, "%type% %type% * %var% [;[]"))
|
||||
varname = getstr( tok, 4 );
|
||||
else
|
||||
continue;
|
||||
|
||||
const char *varnames[2];
|
||||
varnames[0] = varname;
|
||||
varnames[1] = 0;
|
||||
bool used = false;
|
||||
for ( const TOKEN *tok2 = tokens; tok2; tok2 = tok2->next )
|
||||
{
|
||||
if ( tok->FileIndex != 0 )
|
||||
continue;
|
||||
|
||||
if (Match(tok2, ". %var%", varnames))
|
||||
{
|
||||
if ( strcmp("=", getstr(tok2,2)) == 0 )
|
||||
continue;
|
||||
used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! used )
|
||||
{
|
||||
std::ostringstream errmsg;
|
||||
errmsg << FileLine(tok) << ": struct member '" << structname << "::" << varname << "' is never read";
|
||||
ReportErr(errmsg.str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1107,7 +1107,7 @@ void DeallocateTokens()
|
|||
free(dsymlist->name);
|
||||
free(dsymlist->value);
|
||||
delete dsymlist;
|
||||
dsymlist = next;
|
||||
dsymlist = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue