Tokenizer: do not report unknownMacro for alignas (#5058)

This commit is contained in:
Daniel Marjamäki 2023-05-14 15:14:41 +02:00 committed by GitHub
parent cf4d59a835
commit 793d6aef01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -8006,6 +8006,8 @@ static bool isNonMacro(const Token* tok)
return true; return true;
if (tok->str().compare(0, 2, "__") == 0) // attribute/annotation if (tok->str().compare(0, 2, "__") == 0) // attribute/annotation
return true; return true;
if (Token::simpleMatch(tok, "alignas ("))
return true;
return false; return false;
} }

View File

@ -6770,6 +6770,8 @@ private:
const char code11[] = "struct B { B(B&&) noexcept {} ~B() noexcept {} };"; const char code11[] = "struct B { B(B&&) noexcept {} ~B() noexcept {} };";
ASSERT_NO_THROW(tokenizeAndStringify(code11)); ASSERT_NO_THROW(tokenizeAndStringify(code11));
ASSERT_NO_THROW(tokenizeAndStringify("alignas(8) alignas(16) int x;")); // alignas is not unknown macro
} }
void findGarbageCode() { // Test Tokenizer::findGarbageCode() void findGarbageCode() { // Test Tokenizer::findGarbageCode()