Skip to content

Commit 793d6ae

Browse files
authored
Tokenizer: do not report unknownMacro for alignas (danmar#5058)
1 parent cf4d59a commit 793d6ae

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/tokenize.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8006,6 +8006,8 @@ static bool isNonMacro(const Token* tok)
80068006
return true;
80078007
if (tok->str().compare(0, 2, "__") == 0) // attribute/annotation
80088008
return true;
8009+
if (Token::simpleMatch(tok, "alignas ("))
8010+
return true;
80098011
return false;
80108012
}
80118013

test/testtokenize.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6770,6 +6770,8 @@ class TestTokenizer : public TestFixture {
67706770

67716771
const char code11[] = "struct B { B(B&&) noexcept {} ~B() noexcept {} };";
67726772
ASSERT_NO_THROW(tokenizeAndStringify(code11));
6773+
6774+
ASSERT_NO_THROW(tokenizeAndStringify("alignas(8) alignas(16) int x;")); // alignas is not unknown macro
67736775
}
67746776

67756777
void findGarbageCode() { // Test Tokenizer::findGarbageCode()

0 commit comments

Comments
 (0)