GCC supports an old, pre-C99 designated initializer syntax in C, where array designators need not be followed by '=' and members may use 'member_name :' rather than '.member_name ='.
I hoped to obsolete that syntax more forcefully (making the pedwarns for it unconditional) back in 2000 as mentioned in <https://gcc.gnu.org/legacy-ml/gcc-patches/2000-11/msg00177.html>, but at the time it was still widely used. I'd like to know how widely used it still is. Is someone able to do a distribution rebuild with a patch such as the one below (untested) and see how much the warnings (especially the second one in the patch, for array initializer) appear? Specific motivation: there's a C2x proposal for a form of C++ lambdas. The syntax for lambdas is ambiguous with that for the old style of array designated initializers in certain cases, when combined with other GCC extensions, so if lambdas are accepted for C2x it would not be possible to accept all cases of the old array designated initializer syntax any more, at least not in C2x mode. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 5cdeb21a458..f8905090caf 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -5300,7 +5300,7 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack) c_parser_peek_token (parser)->location, braced_init_obstack); /* Use the colon as the error location. */ - pedwarn (c_parser_peek_2nd_token (parser)->location, OPT_Wpedantic, + pedwarn (c_parser_peek_2nd_token (parser)->location, 0, "obsolete use of designated initializer with %<:%>"); c_parser_consume_token (parser); c_parser_consume_token (parser); @@ -5465,7 +5465,7 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack) else { if (des_seen == 1) - pedwarn (c_parser_peek_token (parser)->location, OPT_Wpedantic, + pedwarn (c_parser_peek_token (parser)->location, 0, "obsolete use of designated initializer without %<=%>"); else { -- Joseph S. Myers jos...@codesourcery.com