unused functions: fixed false positives

This commit is contained in:
Daniel Marjamäki 2009-02-27 16:36:37 +00:00
parent dddfc50dff
commit c991aded12
1 changed files with 11 additions and 8 deletions

View File

@ -53,6 +53,9 @@ void CheckFunctionUsage::parseTokens(const Tokenizer &tokenizer)
if (tok->fileIndex() != 0) if (tok->fileIndex() != 0)
continue; continue;
if (tok->str().find(":") != std::string::npos)
continue;
const Token *funcname = 0; const Token *funcname = 0;
if (Token::Match(tok, "%type% %var% (")) if (Token::Match(tok, "%type% %var% ("))
@ -95,14 +98,14 @@ void CheckFunctionUsage::parseTokens(const Tokenizer &tokenizer)
{ {
const Token *funcname = 0; const Token *funcname = 0;
if (Token::Match(tok, "[;{}.,()[=+-/&|!?:] %var% [(),;:}]") || if (Token::Match(tok->next(), "%var% ("))
Token::Match(tok, ":: %var% (") || {
Token::Match(tok, "|= %var% (") || if (tok->str() == "*" || (tok->isName() && !Token::Match(tok, "else|return")))
Token::Match(tok, "&= %var% (") || continue;
Token::Match(tok, "&& %var% (") || funcname = tok->next();
Token::Match(tok, "|| %var% (") || }
Token::Match(tok, "else %var% (") ||
Token::Match(tok, "return %var% (")) if (Token::Match(tok, "[;{}.,()[=+-/&|!?:] %var% [(),;:}]"))
funcname = tok->next(); funcname = tok->next();
// funcname ( => Assert that the end paranthesis isn't followed by { // funcname ( => Assert that the end paranthesis isn't followed by {