Definitely check correctly 'sizeof %num%' when '%num%' has '-' sign.

This commit is contained in:
Edoardo Prezioso 2011-10-29 00:05:29 +02:00
parent dee03a09e4
commit dd719b41bf
2 changed files with 1 additions and 3 deletions

View File

@ -335,9 +335,7 @@ void CheckOther::checkSizeofForNumericParameter()
{
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
if (Token::Match(tok, "sizeof ( %num% )")
|| Token::Match(tok, "sizeof ( - %num% )")
|| Token::Match(tok, "sizeof %num%")
|| Token::Match(tok, "sizeof - %num%")
) {
sizeofForNumericParameterError(tok);
}

View File

@ -1962,7 +1962,7 @@ bool Tokenizer::tokenize(std::istream &code,
// Combine "- %num%" ..
for (Token *tok = _tokens; tok; tok = tok->next()) {
if (Token::Match(tok, "?|:|,|(|[|=|return|case|%op% - %num%")) {
if (Token::Match(tok, "?|:|,|(|[|=|return|case|sizeof|%op% - %num%")) {
tok->next()->str("-" + tok->strAt(2));
tok->next()->deleteNext();
}