From dd719b41bfd323d50c18de511fa3ee67745768fd Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sat, 29 Oct 2011 00:05:29 +0200 Subject: [PATCH] Definitely check correctly 'sizeof %num%' when '%num%' has '-' sign. --- lib/checkother.cpp | 2 -- lib/tokenize.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index d6221af7b..c97c6bccf 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -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); } diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 82d3553c7..20a4a30b7 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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(); }