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