Tokenizer: Remove 'unlikely' keyword in simplifyTokenList;
Don't check for it in CheckMemoryLeak.
This commit is contained in:
parent
ee5c1845a4
commit
5d8f506d6b
|
@ -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()));
|
||||
}
|
||||
|
|
|
@ -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++)
|
||||
{
|
||||
tok->deleteNext();
|
||||
if (tok->next()->str() == unwantedWords[ui])
|
||||
{
|
||||
tok->deleteNext();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue