https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103165
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Simpler to read example:
#define inner(...) #__VA_ARGS__ _Pragma("GCC diagnostic pop")
#define outer(...) inner(__VA_ARGS__)
outer(inner(1,2))
the expected result is something like:
"\"1,2\" _Pragma(\"foo bar\")"
#pragma GCC diagnostic pop
I guess. That's what 'clang-11 -E' gives.
→ When running '-E' with GCC, one runs into the issue described in PR90400; see
also for issues with diagnostic pragmas PR91669.
Without -E, the 'GCC diagnostic' is known (registered) and when
#__VA_ARGS__
is stringified for '"1,2" _Pragma("GCC diagnostic pop")' it fails because
cpp_spell_token does not handle _Pragma.
* * *
Before r12-4797-g0078a058a5693871, _Pragma was not really handled but just
output before the macro was processed – leading to something like:
#pragma GCC diagnostic pop
"\"1,2\"
#pragma GCC diagnostic pop