From b0d999421048f30e3c98b5d0f5f9d89e7fd63425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 11 Jun 2007 13:56:51 +0000 Subject: [PATCH] CheckHeaders: Checking if included headers are needed --- CheckHeaders.cpp | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/CheckHeaders.cpp b/CheckHeaders.cpp index d1fb7f04d..80c4ce60c 100644 --- a/CheckHeaders.cpp +++ b/CheckHeaders.cpp @@ -90,14 +90,21 @@ void WarningIncludeHeader() indentlevel++; else if (tok1->str[0] == '}') - indentlevel--; - + { + if (indentlevel > 0) + indentlevel--; + } + if (indentlevel != 0) continue; + // namespace.. + if (match(tok1,"namespace var {")) + tok1 = gettok(tok1,2); + // 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)); // Variable declaration.. @@ -126,8 +133,8 @@ void WarningIncludeHeader() tok1 = tok1->next; } } - - // function.. + + // function.. // -------------------------------------- else if (match(tok1,"type var (")) namelist.push_back(getstr(tok1, 1)); @@ -199,7 +206,21 @@ void WarningIncludeHeader() } 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; + } + } + } }