https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88766
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- A C proof of concept: --- gcc/c/c-parser.c.jj 2019-01-07 09:47:33.187515618 +0100 +++ gcc/c/c-parser.c 2019-01-09 19:15:05.216756760 +0100 @@ -4624,6 +4624,11 @@ c_parser_braced_init (c_parser *parser, } else really_start_incremental_init (type); + + /* Accept #pragmas at braced init scope. */ + while (c_parser_next_token_is (parser, CPP_PRAGMA)) + c_parser_pragma (parser, pragma_struct, NULL); + if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE)) { pedwarn (brace_loc, OPT_Wpedantic, "ISO C forbids empty initializer braces"); @@ -4634,6 +4639,10 @@ c_parser_braced_init (c_parser *parser, comma. */ while (true) { + /* Accept #pragmas at braced init scope. */ + while (c_parser_next_token_is (parser, CPP_PRAGMA)) + c_parser_pragma (parser, pragma_struct, NULL); + c_parser_initelt (parser, &braced_init_obstack); if (parser->error) break; @@ -4644,10 +4653,20 @@ c_parser_braced_init (c_parser *parser, } else break; + + /* Accept #pragmas at braced init scope. */ + while (c_parser_next_token_is (parser, CPP_PRAGMA)) + c_parser_pragma (parser, pragma_struct, NULL); + if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE)) break; } } + + /* Accept #pragmas at braced init scope. */ + while (c_parser_next_token_is (parser, CPP_PRAGMA)) + c_parser_pragma (parser, pragma_struct, NULL); + c_token *next_tok = c_parser_peek_token (parser); if (next_tok->type != CPP_CLOSE_BRACE) { Of course, this one parses all pragmas, rather than just GCC diagnostic, and for most pragmas handling them in this context is undesirable (either meaningful, or e.g. OpenMP/OpenACC forbids them there).