public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: Richard Sandiford <richard.sandiford@arm.com>
Cc: <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c: Add support for [[__extension__ ...]]
Date: Fri, 18 Aug 2023 19:51:55 +0000	[thread overview]
Message-ID: <90c9119-ec41-5f6-dda0-8090dca0273d@codesourcery.com> (raw)
In-Reply-To: <mptedk0he4y.fsf@arm.com>

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

      reply	other threads:[~2023-08-18 19:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 15:56 [WIP RFC] Add support for keyword-based attributes Richard Sandiford
2023-07-14 17:17 ` Jakub Jelinek
2023-07-16 10:50   ` Richard Sandiford
2023-07-17 13:39     ` Jason Merrill
2023-07-17 14:06       ` Richard Sandiford
2023-07-14 21:14 ` Nathan Sidwell
2023-07-16 10:18   ` Richard Sandiford
2023-07-17  6:38 ` Richard Biener
2023-07-17  8:21   ` Richard Sandiford
2023-07-17  9:05     ` Richard Biener
2023-07-17 13:53     ` Michael Matz
2023-07-21 23:25       ` Joseph Myers
2023-08-16 10:36         ` Richard Sandiford
2023-08-16 13:22           ` Joseph Myers
2023-08-17 11:24             ` [PATCH] c: Add support for [[__extension__ ...]] Richard Sandiford
2023-08-17 17:07               ` Richard Biener
2023-08-17 18:36                 ` Richard Sandiford
2023-08-18  9:51               ` Richard Sandiford
2023-08-18 19:51                 ` Joseph Myers [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90c9119-ec41-5f6-dda0-8090dca0273d@codesourcery.com \
    --to=joseph@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.sandiford@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).