We'd let annotation tokens from '#pragma pack' and the like get inside a
function-like macro. This would lead to terror and mayhem; stop the
madness early.
This fixes PR22037.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224896
91177308-0d34-0410-b5e6-
96231b3b80d8
InGroup<CXX98CompatPedantic>, DefaultIgnore;
def ext_named_variadic_macro : Extension<
"named variadic macros are a GNU extension">, InGroup<VariadicMacros>;
-def err_embedded_include : Error<
+def err_embedded_directive : Error<
"embedding a #%0 directive within macro arguments is not supported">;
def ext_embedded_directive : Extension<
"embedding a directive within macro arguments has undefined behavior">,
case tok::pp_import:
case tok::pp_include_next:
case tok::pp___include_macros:
- Diag(Result, diag::err_embedded_include) << II->getName();
+ case tok::pp_pragma:
+ Diag(Result, diag::err_embedded_directive) << II->getName();
DiscardUntilEndOfDirective();
return;
default:
a);
_Static_assert(n == 5, "");
+#define M(A)
+M(
+#pragma pack(pop) // expected-error {{embedding a #pragma directive within macro arguments is not supported}}
+)
+
// header1.h
void fail(const char *);
#define MUNCH(...) \