diff options
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r-- | libcpp/macro.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c index b2f797c..95e5b8b 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -750,8 +750,10 @@ builtin_macro (cpp_reader *pfile, cpp_hashnode *node, if (node->value.builtin == BT_PRAGMA) { /* Don't interpret _Pragma within directives. The standard is - not clear on this, but to me this makes most sense. */ - if (pfile->state.in_directive) + not clear on this, but to me this makes most sense. + Similarly, don't interpret _Pragma inside expand_args, we might + need to stringize it later on. */ + if (pfile->state.in_directive || pfile->state.ignore__Pragma) return 0; return _cpp_do__Pragma (pfile, loc); @@ -2648,6 +2650,7 @@ expand_arg (cpp_reader *pfile, macro_arg *arg) size_t capacity; bool saved_warn_trad; bool track_macro_exp_p = CPP_OPTION (pfile, track_macro_expansion); + bool saved_ignore__Pragma; if (arg->count == 0 || arg->expanded != NULL) @@ -2670,6 +2673,9 @@ expand_arg (cpp_reader *pfile, macro_arg *arg) push_ptoken_context (pfile, NULL, NULL, arg->first, arg->count + 1); + saved_ignore__Pragma = pfile->state.ignore__Pragma; + pfile->state.ignore__Pragma = 1; + for (;;) { const cpp_token *token; @@ -2692,6 +2698,7 @@ expand_arg (cpp_reader *pfile, macro_arg *arg) _cpp_pop_context (pfile); CPP_WTRADITIONAL (pfile) = saved_warn_trad; + pfile->state.ignore__Pragma = saved_ignore__Pragma; } /* Returns the macro associated to the current context if we are in |