CheckHeaders: Checking if included headers are needed

This commit is contained in:
Daniel Marjamäki 2007-06-11 13:56:51 +00:00
parent 9af3e36c4d
commit b0d9994210
1 changed files with 27 additions and 6 deletions

View File

@ -90,14 +90,21 @@ void WarningIncludeHeader()
indentlevel++; indentlevel++;
else if (tok1->str[0] == '}') else if (tok1->str[0] == '}')
{
if (indentlevel > 0)
indentlevel--; indentlevel--;
}
if (indentlevel != 0) if (indentlevel != 0)
continue; continue;
// namespace..
if (match(tok1,"namespace var {"))
tok1 = gettok(tok1,2);
// Class or namespace declaration.. // Class or namespace declaration..
// -------------------------------------- // --------------------------------------
if (match(tok1,"class var {") || match(tok1,"class var :") || match(tok1,"namespace var {")) else if (match(tok1,"class var {") || match(tok1,"class var :"))
classlist.push_back(getstr(tok1, 1)); classlist.push_back(getstr(tok1, 1));
// Variable declaration.. // Variable declaration..
@ -199,7 +206,21 @@ void WarningIncludeHeader()
} }
if ( ! NeedDeclaration ) if ( ! NeedDeclaration )
NeedDeclaration = (std::find(classlist.begin(),classlist.end(),tok1->str ) != classlist.end()); {
if (std::find(classlist.begin(),classlist.end(),tok1->str ) != classlist.end())
{
if ( strcmp(getstr(tok1, 1), "*") == 0 )
{
NeedDeclaration = true;
}
else
{
Needed = true;
break;
}
}
}
} }