From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 435533854800 for ; Fri, 12 Mar 2021 22:25:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 435533854800 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: UuzzJc5B2VhG1kKD3ERocqKyTseeT9D7u1kmN0HAXJuC7O3g4KAkGtRRgR8N7XZU13/UDTH/Go 44hOdLBZYDEZIDGS0GsKBNKW9/abQiGaSA4QTEb4/IRr0HYVLaATHJNG00xTJGqFoqBj3bEf0m dfO/g/qcFcTelhCNMgt7RxfakxHe3qm9rZLgPPEzRkCTsP5PxJvA7ZcrpkeIpi8TyRo6BPE3Fp qA8qF5J79j9FPkIsN27jOSU0zygARioJc/qbSSBtPZ0KrXcJ0KvZU96e4w8q4rxuksfxV6E7yP 0y8= X-IronPort-AV: E=Sophos;i="5.81,244,1610438400"; d="scan'208";a="59183494" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 12 Mar 2021 14:25:39 -0800 IronPort-SDR: sDddzuuzdwGvewq7CtYU5zy1bDJq0tQEjzc3Zf/HA+0efj9JD8Y0RH6C7cUkK31bL5ZDbyBdSL 3Nxor+U7aPUTZFQeDCUz11rliuUxd9EL9s1KNkaOgHKFOgu8PB312z1kh1YexlLJMvkS9LrAfM t4HK61YLekUKIgSMFWMrrBEeWBiRkpFNHV4vduxv+1dhVDR0jzPkRv6Uj/ZnHnKQEJ0KPH7liJ cZcbpq+j1RFLhM+Svn7qWP7Kn/9f7N2phTcMs4EkA5cOaP0QQDjUH2TFoq6Bqm8iZPWBlAFNN/ OXQ= Date: Fri, 12 Mar 2021 22:25:33 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Subject: The old designated initializer syntax Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3128.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 22:25:42 -0000 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 , 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 joseph@codesourcery.com