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