From: Alex Coplan <alex.coplan@arm.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Nathan Sidwell <nathan@acm.org>,
Iain Sandoe <iain@sandoe.co.uk>
Subject: Re: [PATCH v3] c++: Accept elaborated-enum-base with pedwarn
Date: Fri, 16 Jun 2023 15:26:52 +0100 [thread overview]
Message-ID: <ZIxxLDE/QxAMKaDr@arm.com> (raw)
In-Reply-To: <bafb83c7-3b70-bde2-d5d4-39b7107ffc25@redhat.com>
On 16/06/2023 09:07, Jason Merrill wrote:
> On 6/16/23 07:58, Alex Coplan wrote:
> > Hi,
> >
> > This is a v3 patch addressing feedback for:
> > https://gcc.gnu.org/pipermail/gcc-patches/2023-June/621714.html
> >
> > The only change since the previous version is that the new option is
> > documented in invoke.texi (and the description in c.opt was shortened as
> > requested).
> >
> > ------
> >
> > 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.
> >
> > This patch adds the -Welaborated-enum-base warning to GCC and adjusts
> > the C++ parser to emit this warning instead of rejecting this code
> > outright.
> >
> > The macro expansion in the macOS headers occurs in the case that the
> > compiler declares support for enums with underlying type using
> > __has_feature, see
> > https://gcc.gnu.org/pipermail/gcc-patches/2023-May/618450.html
> >
> > GCC rejecting this construct outright means that GCC fails to bootstrap
> > on Darwin in the case that it (correctly) implements __has_feature and
> > declares support for C++ enums with underlying type.
> >
> > With this patch, GCC can bootstrap on Darwin in combination with the
> > (WIP) __has_feature patch posted at:
> > https://gcc.gnu.org/pipermail/gcc-patches/2023-May/617878.html
> >
> > Bootstrapped/regtested on aarch64-linux-gnu and x86_64-apple-darwin.
> > OK for trunk?
>
> OK, thanks.
Thanks for the reviews, pushed as
g:b106f11dc6adb8df15cc5c268896d314c76ca35f.
>
> > Thanks,
> > Alex
> >
> > gcc/c-family/ChangeLog:
> >
> > * c.opt (Welaborated-enum-base): New.
> >
> > gcc/ChangeLog:
> >
> > * doc/invoke.texi: Document -Welaborated-enum-base.
> >
> > gcc/cp/ChangeLog:
> >
> > * parser.cc (cp_parser_enum_specifier): Don't reject
> > elaborated-type-specifier with enum-base, instead emit new
> > Welaborated-enum-base warning.
> >
> > gcc/testsuite/ChangeLog:
> >
> > * g++.dg/cpp0x/enum40.C: Adjust expected diagnostics.
> > * g++.dg/cpp0x/forw_enum6.C: Likewise.
> > * g++.dg/cpp0x/elab-enum-base.C: New test.
>
prev parent reply other threads:[~2023-06-16 14:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 11:58 Alex Coplan
2023-06-16 13:07 ` Jason Merrill
2023-06-16 14:26 ` Alex Coplan [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=ZIxxLDE/QxAMKaDr@arm.com \
--to=alex.coplan@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=iain@sandoe.co.uk \
--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).