From 793d6aef011a440585ddcaf8814f0dc9abc2a210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 14 May 2023 15:14:41 +0200 Subject: [PATCH] Tokenizer: do not report unknownMacro for alignas (#5058) --- lib/tokenize.cpp | 2 ++ test/testtokenize.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 8dd6c585e..dc6438bdb 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8006,6 +8006,8 @@ static bool isNonMacro(const Token* tok) return true; if (tok->str().compare(0, 2, "__") == 0) // attribute/annotation return true; + if (Token::simpleMatch(tok, "alignas (")) + return true; return false; } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 1bf9ed682..767021a81 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6770,6 +6770,8 @@ private: const char code11[] = "struct B { B(B&&) noexcept {} ~B() noexcept {} };"; 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()