Skip to content

Commit

Permalink
Fix #13198 void reported as unknownMacro (#6872)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Oct 7, 2024
1 parent 93932ad commit be04977
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8470,7 +8470,10 @@ void Tokenizer::reportUnknownMacros() const
continue;
if (startsWith(tok->strAt(1), "__")) // attribute/annotation
continue;
unknownMacroError(tok->next());
if (tok->next()->isStandardType() && !tok->linkAt(2)->next()->isStandardType())
unknownMacroError(tok->linkAt(2)->next());
else
unknownMacroError(tok->next());
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7039,6 +7039,10 @@ class TestTokenizer : public TestFixture {
" return std::string{ g() + \"abc\" MACRO \"def\" };\n"
"}\n", /*expand*/ true, Platform::Type::Native, true), UNKNOWN_MACRO);

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

ignore_errout();
}

Expand Down

0 comments on commit be04977

Please sign in to comment.