Tokenizer: Remove 'unlikely' keyword in simplifyTokenList;

Don't check for it in CheckMemoryLeak.
This commit is contained in:
Nicolas Le Cam 2009-01-20 21:21:12 +00:00
parent ee5c1845a4
commit 5d8f506d6b
2 changed files with 8 additions and 6 deletions

View File

@ -333,8 +333,6 @@ bool CheckMemoryLeakClass::notvar(const Token *tok, const char *varnames[])
return bool(Token::Match(tok, std::string("! " + varname + " [;)&|]").c_str()) ||
Token::simpleMatch(tok, std::string("! ( " + varname + " )").c_str()) ||
Token::simpleMatch(tok, std::string("unlikely ( ! " + varname + " )").c_str()) ||
Token::simpleMatch(tok, std::string("unlikely ( " + varname + " == 0 )").c_str()) ||
Token::Match(tok, std::string("0 == " + varname + " [;)&|]").c_str()) ||
Token::simpleMatch(tok, std::string(varname + " == 0").c_str()));
}

View File

@ -541,13 +541,17 @@ void Tokenizer::setVarId()
void Tokenizer::simplifyTokenList()
{
// Remove the keyword 'unsigned'
// Remove unwanted keywords
static const char* unwantedWords[] = { "unsigned", "unlikely" };
for (Token *tok = _tokens; tok; tok = tok->next())
{
if (tok->next() && (tok->next()->str() == "unsigned"))
for (unsigned ui = 0; ui < sizeof(unwantedWords) / sizeof(unwantedWords[0]) && tok->next(); ui++)
{
if (tok->next()->str() == unwantedWords[ui])
{
tok->deleteNext();
break;
}
}
}