Skip to content

Commit be04977

Browse files
Fix #13198 void reported as unknownMacro (#6872)
1 parent 93932ad commit be04977

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/tokenize.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8470,7 +8470,10 @@ void Tokenizer::reportUnknownMacros() const
84708470
continue;
84718471
if (startsWith(tok->strAt(1), "__")) // attribute/annotation
84728472
continue;
8473-
unknownMacroError(tok->next());
8473+
if (tok->next()->isStandardType() && !tok->linkAt(2)->next()->isStandardType())
8474+
unknownMacroError(tok->linkAt(2)->next());
8475+
else
8476+
unknownMacroError(tok->next());
84748477
}
84758478
}
84768479

test/testtokenize.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7039,6 +7039,10 @@ class TestTokenizer : public TestFixture {
70397039
" return std::string{ g() + \"abc\" MACRO \"def\" };\n"
70407040
"}\n", /*expand*/ true, Platform::Type::Native, true), UNKNOWN_MACRO);
70417041

7042+
ASSERT_THROW_INTERNAL_EQUALS(tokenizeAndStringify("static void handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS, int var) {}\n"), // #13198
7043+
UNKNOWN_MACRO,
7044+
"There is an unknown macro here somewhere. Configuration is required. If PROTO_XT_CALLBACK_ARGS is a macro then please configure it.");
7045+
70427046
ignore_errout();
70437047
}
70447048

0 commit comments

Comments
 (0)