From: Alex Coplan <alex.coplan@arm.com>
To: Thomas Schwinge <thomas@codesourcery.com>
Cc: <gcc-patches@gcc.gnu.org>, Marek Polacek <polacek@redhat.com>,
Jason Merrill <jason@redhat.com>, Nathan Sidwell <nathan@acm.org>,
Joseph Myers <joseph@codesourcery.com>,
Iain Sandoe <iain@sandoe.co.uk>
Subject: Re: [PATCH v5] c-family: Implement __has_feature and __has_extension [PR60512]
Date: Tue, 28 Nov 2023 16:53:28 +0000 [thread overview]
Message-ID: <ZWYbCEf1RVj811Cw@arm.com> (raw)
In-Reply-To: <87v89l6f1h.fsf@euler.schwinge.homeip.net>
On 28/11/2023 17:03, Thomas Schwinge wrote:
> Hi!
>
> On 2023-11-17T14:50:45+0000, Alex Coplan <alex.coplan@arm.com> wrote:
> > --- a/gcc/cp/cp-objcp-common.cc
> > +++ b/gcc/cp/cp-objcp-common.cc
>
> > +/* Table of features for __has_{feature,extension}. */
> > +
> > +static constexpr cp_feature_info cp_feature_table[] =
> > +{
> > + { "cxx_exceptions", &flag_exceptions },
> > + { "cxx_rtti", &flag_rtti },
> > + { "cxx_access_control_sfinae", { cxx11, cxx98 } },
>
> Here we see that 'cxx_exceptions', 'cxx_rtti' are dependent on
> '-fexceptions', '-frtti'. Certain GCC configurations may decide to
> default to '-fno-exceptions' and/or '-fno-rtti'...
>
> > --- /dev/null
> > +++ b/gcc/testsuite/g++.dg/ext/has-feature.C
> > @@ -0,0 +1,206 @@
> > +// { dg-do compile }
> > +// { dg-options "" }
> > +
> > +#define FEAT(x) (__has_feature(x) && __has_extension(x))
> > +#define CXX11 (__cplusplus >= 201103L)
> > +#define CXX14 (__cplusplus >= 201402L)
> > +
> > +#if !FEAT(cxx_exceptions) || !FEAT(cxx_rtti)
> > +#error
> > +#endif
>
> ..., but here, they are assumed available unconditionally. OK to push
> "Adjust 'g++.dg/ext/has-feature.C' for default-'-fno-exceptions', '-fno-rtti' configurations",
> see attached?
LGTM, but I can't approve the patch.
Sorry for the breakage and thanks for the fix.
Alex
>
>
> Grüße
> Thomas
>
>
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
> From 89482e73066fcd6da5dbc93402e77e28f948a96c Mon Sep 17 00:00:00 2001
> From: Thomas Schwinge <thomas@codesourcery.com>
> Date: Tue, 28 Nov 2023 15:57:09 +0100
> Subject: [PATCH] Adjust 'g++.dg/ext/has-feature.C' for
> default-'-fno-exceptions', '-fno-rtti' configurations
>
> ..., where you currently get:
>
> FAIL: g++.dg/ext/has-feature.C -std=gnu++98 (test for excess errors)
> [...]
>
> Minor fix-up for recent commit 06280a906cb3dc80cf5e07cf3335b758848d488d
> "c-family: Implement __has_feature and __has_extension [PR60512]".
>
> gcc/testsuite/
> * g++.dg/ext/has-feature.C: Adjust for default-'-fno-exceptions',
> '-fno-rtti' configurations.
> ---
> gcc/testsuite/g++.dg/ext/has-feature.C | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/testsuite/g++.dg/ext/has-feature.C b/gcc/testsuite/g++.dg/ext/has-feature.C
> index 52191b78fd6..bcfe82469ae 100644
> --- a/gcc/testsuite/g++.dg/ext/has-feature.C
> +++ b/gcc/testsuite/g++.dg/ext/has-feature.C
> @@ -5,7 +5,11 @@
> #define CXX11 (__cplusplus >= 201103L)
> #define CXX14 (__cplusplus >= 201402L)
>
> -#if !FEAT(cxx_exceptions) || !FEAT(cxx_rtti)
> +#if FEAT(cxx_exceptions) != !!__cpp_exceptions
> +#error
> +#endif
> +
> +#if FEAT(cxx_rtti) != !!__cpp_rtti
> #error
> #endif
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2023-11-28 16:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 14:50 Alex Coplan
2023-11-20 22:29 ` Jason Merrill
2023-11-23 17:41 ` Marek Polacek
2023-11-27 10:58 ` Alex Coplan
2023-11-28 8:22 ` [PATCH] c++: Fix up __has_extension (cxx_init_captures) Jakub Jelinek
2023-11-28 16:45 ` Alex Coplan
2023-11-28 17:12 ` Jakub Jelinek
2023-11-28 17:18 ` Jason Merrill
2023-11-28 17:08 ` Jason Merrill
2023-11-28 16:03 ` [PATCH v5] c-family: Implement __has_feature and __has_extension [PR60512] Thomas Schwinge
2023-11-28 16:53 ` Alex Coplan [this message]
2023-11-28 17:08 ` Jason Merrill
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=ZWYbCEf1RVj811Cw@arm.com \
--to=alex.coplan@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=iain@sandoe.co.uk \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.com \
--cc=nathan@acm.org \
--cc=polacek@redhat.com \
--cc=thomas@codesourcery.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).