Tokenizer: Fixed unwanted unknownMacro warning for decltype
This commit is contained in:
parent
1f6cb7a54b
commit
4eb829933e
|
@ -403,7 +403,7 @@ static int multiComparePercent(const Token *tok, const char*& haystack, nonneg i
|
|||
// Type (%type%)
|
||||
{
|
||||
haystack += 5;
|
||||
if (tok->isName() && tok->varId() == 0 && (tok->str() != "delete" || !tok->isKeyword())) // HACK: this is legacy behaviour, it should return false for all keywords, ecxcept types
|
||||
if (tok->isName() && tok->varId() == 0 && (tok->str() != "delete" || !tok->isKeyword())) // HACK: this is legacy behaviour, it should return false for all keywords, except types
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -9489,7 +9489,7 @@ void Tokenizer::reportUnknownMacros()
|
|||
unknownMacroError(tok->next());
|
||||
}
|
||||
if (Token::Match(tok, "[(,] %name% (") && Token::Match(tok->linkAt(2), ") %name% %name%|,|)")) {
|
||||
if (tok->linkAt(2)->next()->isKeyword())
|
||||
if (tok->next()->isKeyword() || tok->linkAt(2)->next()->isKeyword())
|
||||
continue;
|
||||
if (cAlternativeTokens.count(tok->linkAt(2)->next()->str()) > 0)
|
||||
continue;
|
||||
|
|
|
@ -120,9 +120,9 @@ void TokenList::determineCppC()
|
|||
if (mIsCpp) {
|
||||
//mKeywords.insert("bool"); // type
|
||||
mKeywords.insert("catch");
|
||||
mKeywords.insert("delete");
|
||||
mKeywords.insert("class");
|
||||
mKeywords.insert("const_cast");
|
||||
mKeywords.insert("decltype");
|
||||
mKeywords.insert("delete");
|
||||
mKeywords.insert("dynamic_cast");
|
||||
mKeywords.insert("explicit");
|
||||
|
@ -145,6 +145,7 @@ void TokenList::determineCppC()
|
|||
mKeywords.insert("try");
|
||||
mKeywords.insert("typeid");
|
||||
mKeywords.insert("typename");
|
||||
mKeywords.insert("typeof");
|
||||
mKeywords.insert("using");
|
||||
mKeywords.insert("virtual");
|
||||
//mKeywords.insert("wchar_t"); // type
|
||||
|
|
|
@ -8149,6 +8149,9 @@ private:
|
|||
|
||||
const char code7[] = "void foo() { dostuff(ZEND_NUM_ARGS() TSRMLS_CC, x, y); }"; // #9476
|
||||
ASSERT_THROW(tokenizeAndStringify(code7), InternalError);
|
||||
|
||||
const char code8[] = "void foo() { a = [](int x, decltype(vec) y){}; }";
|
||||
ASSERT_NO_THROW(tokenizeAndStringify(code8));
|
||||
}
|
||||
|
||||
void findGarbageCode() { // Test Tokenizer::findGarbageCode()
|
||||
|
|
Loading…
Reference in New Issue