Hi!

On 2023-11-17T14:50:45+0000, Alex Coplan <alex.cop...@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?


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 <tho...@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

Reply via email to