public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iain@sandoe.co.uk>
To: Jason Merrill <jason@redhat.com>
Cc: Alex Coplan <alex.coplan@arm.com>,
	Nathan Sidwell <nathan@acm.org>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Fwd: [PATCH][RFC] c++: Accept elaborated-enum-base in system headers
Date: Thu, 8 Jun 2023 19:47:19 +0100	[thread overview]
Message-ID: <431E4F83-136F-47AA-8D94-E1E517C67644@sandoe.co.uk> (raw)
In-Reply-To: <48d02699-428f-1fa5-4478-862199e78dd6@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1479 bytes --]



> Begin forwarded message:
> 
> From: Jason Merrill <jason@redhat.com>
> Subject: Re: [PATCH][RFC] c++: Accept elaborated-enum-base in system headers
> Date: 8 June 2023 at 19:06:36 BST
> To: Alex Coplan <alex.coplan@arm.com>, gcc-patches@gcc.gnu.org
> Cc: Nathan Sidwell <nathan@acm.org>, Iain Sandoe <iain@sandoe.co.uk>
> 
> On 6/8/23 07:06, Alex Coplan wrote:
>> Hi,
>> macOS SDK headers using the CF_ENUM macro can expand to invalid C++ code
>> of the form:
>> typedef enum T : BaseType T;
>> i.e. an elaborated-type-specifier with an additional enum-base.
>> Upstream LLVM can be made to accept the above construct with
>> -Wno-error=elaborated-enum-base.
> 
> I guess we might as well follow that example, and so instead of this check:
> 
>> +	   || (underlying_type && !in_system_header_at (colon_loc)))
> 
> Make the below an on-by-default pedwarn using OPT_Welaborated_enum_base, and don't return error_mark_node.

I was also wondering about (for this and other reasons) a -fclang-compat to put some of these things behind (since std=clang++NN is not really going to work to describe other non-standard extensions etc. since most are not synchronised to std revisions.)

Iain

> 
>> +	      cp_parser_commit_to_tentative_parse (parser);
>> +	      error_at (colon_loc,
>> +			"declaration of enumeration with "
>> +			"fixed underlying type and no enumerator list is "
>> +			"only permitted as a standalone declaration");
> 
> 


      reply	other threads:[~2023-06-08 18:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08 11:06 Alex Coplan
2023-06-08 18:06 ` Jason Merrill
2023-06-08 18:47   ` Iain Sandoe [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=431E4F83-136F-47AA-8D94-E1E517C67644@sandoe.co.uk \
    --to=iain@sandoe.co.uk \
    --cc=alex.coplan@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=nathan@acm.org \
    /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).