Definitely check correctly 'sizeof %num%' when '%num%' has '-' sign.
This commit is contained in:
parent
dee03a09e4
commit
dd719b41bf
|
@ -335,9 +335,7 @@ void CheckOther::checkSizeofForNumericParameter()
|
||||||
{
|
{
|
||||||
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
|
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
|
||||||
if (Token::Match(tok, "sizeof ( %num% )")
|
if (Token::Match(tok, "sizeof ( %num% )")
|
||||||
|| Token::Match(tok, "sizeof ( - %num% )")
|
|
||||||
|| Token::Match(tok, "sizeof %num%")
|
|| Token::Match(tok, "sizeof %num%")
|
||||||
|| Token::Match(tok, "sizeof - %num%")
|
|
||||||
) {
|
) {
|
||||||
sizeofForNumericParameterError(tok);
|
sizeofForNumericParameterError(tok);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1962,7 +1962,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
||||||
|
|
||||||
// Combine "- %num%" ..
|
// Combine "- %num%" ..
|
||||||
for (Token *tok = _tokens; tok; tok = tok->next()) {
|
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()->str("-" + tok->strAt(2));
|
||||||
tok->next()->deleteNext();
|
tok->next()->deleteNext();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue