Fixed #9476 (Tokenizer: report unknown macro)

This commit is contained in:
Daniel Marjamäki 2020-10-24 22:11:21 +02:00
parent 2fa837c716
commit 3876b601d5
2 changed files with 10 additions and 0 deletions

View File

@ -9488,6 +9488,13 @@ void Tokenizer::reportUnknownMacros()
continue;
unknownMacroError(tok->next());
}
if (Token::Match(tok, "[(,] %name% (") && Token::Match(tok->linkAt(2), ") %name% %name%|,|)")) {
if (tok->linkAt(2)->next()->isKeyword())
continue;
if (cAlternativeTokens.count(tok->linkAt(2)->next()->str()) > 0)
continue;
unknownMacroError(tok->next());
}
}
}

View File

@ -8146,6 +8146,9 @@ private:
const char code6[] = "void foo() { dostuff(a, .x=0); }";
ASSERT_THROW(tokenizeAndStringify(code6), InternalError);
const char code7[] = "void foo() { dostuff(ZEND_NUM_ARGS() TSRMLS_CC, x, y); }"; // #9476
ASSERT_THROW(tokenizeAndStringify(code7), InternalError);
}
void findGarbageCode() { // Test Tokenizer::findGarbageCode()