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 B7AA6386480A for ; Fri, 18 Aug 2023 19:52:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B7AA6386480A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="6.01,184,1684828800"; d="scan'208";a="14809205" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 18 Aug 2023 11:51:59 -0800 IronPort-SDR: t9TzJzFoYMmtPcGX6oedYyIG5ZikLtb2iX6QYA5yO9UYWMb+I8LG3Ns2iLupvkjaAYyKZcY5yK lfPbS6cBrMGQFL+roRYFtp0RTE9w8xPBLo4zSy+yrrJrz9FanRm14114EXK/8OjRQ7cPUKPU0/ nJbFDYvPt+FimZkygA+carj70Fxz829tRKI6IVbhvwI6VaPT3JjxCACGOi2VEyseMKASN6oKmm FGBZm7kX9wuOCDE5ruVOTkMwbM+34rXnPVEPLdYCoRPUzk4GQvRyrcRfbt/IGLg7Ez8fBc3kiB pjo= Date: Fri, 18 Aug 2023 19:51:55 +0000 From: Joseph Myers To: Richard Sandiford CC: Subject: Re: [PATCH] c: Add support for [[__extension__ ...]] In-Reply-To: Message-ID: <90c9119-ec41-5f6-dda0-8090dca0273d@codesourcery.com> References: <4ea49f3-954f-e4aa-1721-8258f1bb5f75@codesourcery.com> <50a9b1a1-9efb-a170-34a1-c1e98f69afa@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3104.7 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 18 Aug 2023, Richard Sandiford via Gcc-patches wrote: > [[]] attributes are a recent addition to C, but as a GNU extension, > GCC allows them to be used in C11 and earlier. Normally this use > would trigger a pedwarn (for -pedantic, -Wc11-c2x-compat, etc.). > > This patch allows the pedwarn to be suppressed by starting the > attribute-list with __extension__. > > Also, :: is not a single lexing token prior to C2X, so it wasn't > possible to use scoped attributes in C11, even as a GNU extension. > The patch allows two colons to be used in place of :: when > __extension__ is used. No attempt is made to check whether the > two colons are immediately adjacent. > > gcc/ > * doc/extend.texi: Document the C [[__extension__ ...]] construct. > > gcc/c/ > * c-parser.cc (c_parser_std_attribute): Conditionally allow > two colons to be used in place of ::. > (c_parser_std_attribute_list): New function, split out from... > (c_parser_std_attribute_specifier): ...here. Allow the attribute-list > to start with __extension__. When it does, also allow two colons > to be used in place of ::. > > gcc/testsuite/ > * gcc.dg/c2x-attr-syntax-6.c: New test. > * gcc.dg/c2x-attr-syntax-7.c: Likewise. OK. -- Joseph S. Myers joseph@codesourcery.com