public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
@ 2018-03-01 18:47 Tulio Magno Quites Machado Filho
  2018-03-01 18:54 ` Marc Glisse
  2018-03-01 19:10 ` [PATCH] " Jakub Jelinek
  0 siblings, 2 replies; 10+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2018-03-01 18:47 UTC (permalink / raw)
  To: libstdc++, gcc-patches; +Cc: wschmidt, segher

In order to use the __float128 in C++ it's necessary to check if
it is supported in libstdc++ (i.e. via _GLIBCXX_USE_FLOAT128) and if the
compiler enabled its support too, e.g. -mfloat128 or -mno-float128.

2018-03-01 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>

	PR libstdc++/84654
	* include/bits/std_abs.h: Avoid to use __float128 when the
	compiler disabled it.
	* include/std/type_traits: Likewise.
---
 libstdc++-v3/include/bits/std_abs.h  | 3 ++-
 libstdc++-v3/include/std/type_traits | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/std_abs.h b/libstdc++-v3/include/bits/std_abs.h
index 6e4551d..3ad1c2b 100644
--- a/libstdc++-v3/include/bits/std_abs.h
+++ b/libstdc++-v3/include/bits/std_abs.h
@@ -96,7 +96,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   abs(__GLIBCXX_TYPE_INT_N_3 __x) { return __x >= 0 ? __x : -__x; }
 #endif
 
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
+#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) \
+    && defined(__FLOAT128__)
   inline _GLIBCXX_CONSTEXPR
   __float128
   abs(__float128 __x)
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 711d6c5..4e2e4f7 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -342,7 +342,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     struct __is_floating_point_helper<long double>
     : public true_type { };
 
-#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)
+#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128) \
+    && defined(__FLOAT128__)
   template<>
     struct __is_floating_point_helper<__float128>
     : public true_type { };
-- 
2.9.5

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
  2018-03-01 18:47 [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler Tulio Magno Quites Machado Filho
@ 2018-03-01 18:54 ` Marc Glisse
  2018-03-01 22:04   ` Jonathan Wakely
  2018-03-01 19:10 ` [PATCH] " Jakub Jelinek
  1 sibling, 1 reply; 10+ messages in thread
From: Marc Glisse @ 2018-03-01 18:54 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho; +Cc: libstdc++, gcc-patches, wschmidt, segher

On Thu, 1 Mar 2018, Tulio Magno Quites Machado Filho wrote:

> In order to use the __float128 in C++ it's necessary to check if
> it is supported in libstdc++ (i.e. via _GLIBCXX_USE_FLOAT128) and if the
> compiler enabled its support too, e.g. -mfloat128 or -mno-float128.

Shouldn't we ensure that _GLIBCXX_USE_FLOAT128 is undefined instead?

By the way, __FLOAT128__ is power-only. x86 has __SIZEOF_FLOAT128__ 
instead (why did power pick a different name?).

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
  2018-03-01 18:47 [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler Tulio Magno Quites Machado Filho
  2018-03-01 18:54 ` Marc Glisse
@ 2018-03-01 19:10 ` Jakub Jelinek
  2018-03-01 20:52   ` Jakub Jelinek
  1 sibling, 1 reply; 10+ messages in thread
From: Jakub Jelinek @ 2018-03-01 19:10 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, Michael Meissner
  Cc: libstdc++, gcc-patches, wschmidt, segher

On Thu, Mar 01, 2018 at 03:47:19PM -0300, Tulio Magno Quites Machado Filho wrote:
> In order to use the __float128 in C++ it's necessary to check if
> it is supported in libstdc++ (i.e. via _GLIBCXX_USE_FLOAT128) and if the
> compiler enabled its support too, e.g. -mfloat128 or -mno-float128.
> 
> 2018-03-01 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>

Two spaces between date and name and name and email address.

> 	PR libstdc++/84654
> 	* include/bits/std_abs.h: Avoid to use __float128 when the
> 	compiler disabled it.
> 	* include/std/type_traits: Likewise.

That is incorrect.  Only powerpc* defines __FLOAT128__ macro, but it isn't
the only one with __float128 type, e.g. x86_64-linux provides __float128
too, but doesn't define __FLOAT128__.

On x86_64-linux one can check for defined(__SIZEOF_FLOAT128__) instead.

One could argue that what powerpc does is wrong, defining __SIZEOF_*__ is
consistent with all the other __SIZEOF_*__ macros.

Also (up to libstdc++ maintainers) I'd say that _GLIBCXX_USE_FLOAT128
macro should depend on this macro, rather than uglifying all the uses.
So, #undef somewhere _GLIBCXX_USE_FLOAT128 if __SIZEOF_FLOAT128__ is
not defined.

	Jakub

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
  2018-03-01 19:10 ` [PATCH] " Jakub Jelinek
@ 2018-03-01 20:52   ` Jakub Jelinek
  2018-03-01 20:56     ` Marc Glisse
  0 siblings, 1 reply; 10+ messages in thread
From: Jakub Jelinek @ 2018-03-01 20:52 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho, Michael Meissner
  Cc: libstdc++, gcc-patches, wschmidt, segher

On Thu, Mar 01, 2018 at 08:10:03PM +0100, Jakub Jelinek wrote:
> On Thu, Mar 01, 2018 at 03:47:19PM -0300, Tulio Magno Quites Machado Filho wrote:
> > In order to use the __float128 in C++ it's necessary to check if
> > it is supported in libstdc++ (i.e. via _GLIBCXX_USE_FLOAT128) and if the
> > compiler enabled its support too, e.g. -mfloat128 or -mno-float128.
> > 
> > 2018-03-01 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
> 
> Two spaces between date and name and name and email address.
> 
> > 	PR libstdc++/84654
> > 	* include/bits/std_abs.h: Avoid to use __float128 when the
> > 	compiler disabled it.
> > 	* include/std/type_traits: Likewise.
> 
> That is incorrect.  Only powerpc* defines __FLOAT128__ macro, but it isn't
> the only one with __float128 type, e.g. x86_64-linux provides __float128
> too, but doesn't define __FLOAT128__.
> 
> On x86_64-linux one can check for defined(__SIZEOF_FLOAT128__) instead.
> 
> One could argue that what powerpc does is wrong, defining __SIZEOF_*__ is
> consistent with all the other __SIZEOF_*__ macros.
> 
> Also (up to libstdc++ maintainers) I'd say that _GLIBCXX_USE_FLOAT128
> macro should depend on this macro, rather than uglifying all the uses.
> So, #undef somewhere _GLIBCXX_USE_FLOAT128 if __SIZEOF_FLOAT128__ is
> not defined.

Note ia64, pa and powerpcspe likely need to be fixed too to predefine
__SIZEOF_FLOAT128__=16 if they provide __float128.

	Jakub

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
  2018-03-01 20:52   ` Jakub Jelinek
@ 2018-03-01 20:56     ` Marc Glisse
  0 siblings, 0 replies; 10+ messages in thread
From: Marc Glisse @ 2018-03-01 20:56 UTC (permalink / raw)
  To: Jakub Jelinek
  Cc: Tulio Magno Quites Machado Filho, Michael Meissner, libstdc++,
	gcc-patches, wschmidt, segher

On Thu, 1 Mar 2018, Jakub Jelinek wrote:

> Note ia64, pa and powerpcspe likely need to be fixed too to predefine
> __SIZEOF_FLOAT128__=16 if they provide __float128.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56540
(it only mentions ia64)

-- 
Marc Glisse

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
  2018-03-01 18:54 ` Marc Glisse
@ 2018-03-01 22:04   ` Jonathan Wakely
  2018-03-12 19:02     ` [PATCHv2] " Tulio Magno Quites Machado Filho
  0 siblings, 1 reply; 10+ messages in thread
From: Jonathan Wakely @ 2018-03-01 22:04 UTC (permalink / raw)
  To: libstdc++
  Cc: Tulio Magno Quites Machado Filho, gcc-patches, wschmidt,
	Segher Boessenkool

On 1 March 2018 at 18:54, Marc Glisse wrote:
> On Thu, 1 Mar 2018, Tulio Magno Quites Machado Filho wrote:
>
>> In order to use the __float128 in C++ it's necessary to check if
>> it is supported in libstdc++ (i.e. via _GLIBCXX_USE_FLOAT128) and if the
>> compiler enabled its support too, e.g. -mfloat128 or -mno-float128.
>
>
> Shouldn't we ensure that _GLIBCXX_USE_FLOAT128 is undefined instead?

Yes, a better approach might be to add this to
libstdc++-v3/include/bits/c++config.h:

#define _GLIBCXX_USE_FLOAT128
#if !defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)
#undef _GLIBCXX_USE_FLOAT128
#endif

Then change libstdc++-v3/acinclude.m4 so that instead of defining
_GLIBCXX_USE_FLOAT128 it does:

GLIBCXX_CONDITIONAL(ENABLE_FLOAT128, ...)

and then have libstdc++-v3/include/Makefile modify <bits/c++config.h>
based on that, setting _GLIBCXX_USE_FLOAT128 to 0 or 1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCHv2] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
  2018-03-01 22:04   ` Jonathan Wakely
@ 2018-03-12 19:02     ` Tulio Magno Quites Machado Filho
  2018-03-26 15:23       ` Tulio Magno Quites Machado Filho
  2018-05-01 14:34       ` Jonathan Wakely
  0 siblings, 2 replies; 10+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2018-03-12 19:02 UTC (permalink / raw)
  To: Jonathan Wakely, libstdc++; +Cc: gcc-patches, wschmidt, Segher Boessenkool

Changes since v1:
 - Completely rewrite of the patch to set ENABLE_FLOAT128 at libstdc++
   build time and undef _GLIBCXX_USE_FLOAT128 when building user code.

--- 8< ---

In order to use __float128 in C++ it's necessary to check if the
compiler enabled its support too when building user code.
This patch changes the behavior at libstdc++ build by setting
ENABLE_FLOAT128, which is used to set the value of the exported macro
_GLIBCXX_USE_FLOAT128.

2018-03-12  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	PR libstdc++/84654
	* acinclude.m4: Set ENABLE_FLOAT128 instead of _GLIBCXX_USE_FLOAT128.
	* config.h.in: Remove references to _GLIBCXX_USE_FLOAT128.
	* configure: Regenerate.
	* include/Makefile.am: Replace the value of _GLIBCXX_USE_FLOAT128
	based on ENABLE_FLOAT128.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config: Define _GLIBCXX_USE_FLOAT128.
	[!defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)]: Undefine
	_GLIBCXX_USE_FLOAT128.
---
 libstdc++-v3/acinclude.m4           |  5 ++---
 libstdc++-v3/config.h.in            |  3 ---
 libstdc++-v3/include/Makefile.am    | 13 ++++++++++++-
 libstdc++-v3/include/bits/c++config |  6 ++++++
 4 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 3bd669a..4f37b6a 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -3062,7 +3062,7 @@ dnl Note: also checks that the types aren't standard types.
 dnl
 dnl Defines:
 dnl  _GLIBCXX_USE_INT128
-dnl  _GLIBCXX_USE_FLOAT128
+dnl  ENABLE_FLOAT128
 dnl
 AC_DEFUN([GLIBCXX_ENABLE_INT128_FLOAT128], [
 
@@ -3117,13 +3117,12 @@ EOF
 
     AC_MSG_CHECKING([for __float128])
     if AC_TRY_EVAL(ac_compile); then
-      AC_DEFINE(_GLIBCXX_USE_FLOAT128, 1,
-      [Define if __float128 is supported on this host.])
       enable_float128=yes
     else
       enable_float128=no
     fi
     AC_MSG_RESULT($enable_float128)
+    GLIBCXX_CONDITIONAL(ENABLE_FLOAT128, test $enable_float128 = yes)
     rm -f conftest*
 
   AC_LANG_RESTORE
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 5a0f067..765cedc 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -918,9 +918,6 @@
 /* Define if fchmodat is available in <sys/stat.h>. */
 #undef _GLIBCXX_USE_FCHMODAT
 
-/* Define if __float128 is supported on this host. */
-#undef _GLIBCXX_USE_FLOAT128
-
 /* Defined if gettimeofday is available. */
 #undef _GLIBCXX_USE_GETTIMEOFDAY
 
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 70a662f..ba5adda 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -1230,6 +1230,14 @@ stamp-allocator-new:
 	echo 0 > stamp-allocator-new
 endif
 
+if ENABLE_FLOAT128
+stamp-float128:
+	echo 1 > stamp-float128
+else
+stamp-float128:
+	echo 0 > stamp-float128
+endif
+
 # NB: The non-empty default ldbl_compat works around an AIX sed
 # oddity, see libstdc++/31957 for details.
 ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
@@ -1241,7 +1249,8 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
 			      stamp-extern-template \
 			      stamp-dual-abi \
 			      stamp-cxx11-abi \
-			      stamp-allocator-new
+			      stamp-allocator-new \
+			      stamp-float128
 	@date=`cat ${toplevel_srcdir}/gcc/DATESTAMP` ;\
 	release=`sed 's/^\([0-9]*\).*$$/\1/' ${toplevel_srcdir}/gcc/BASE-VER` ;\
 	ns_version=`cat stamp-namespace-version` ;\
@@ -1250,6 +1259,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
 	dualabi=`cat stamp-dual-abi` ;\
 	cxx11abi=`cat stamp-cxx11-abi` ;\
 	allocatornew=`cat stamp-allocator-new` ;\
+	float128=`cat stamp-float128` ;\
 	ldbl_compat='s,g,g,' ;\
 	grep "^[	 ]*#[	 ]*define[	 ][	 ]*_GLIBCXX_LONG_DOUBLE_COMPAT[	 ][	 ]*1[	 ]*$$" \
 	${CONFIG_HEADER} > /dev/null 2>&1 \
@@ -1262,6 +1272,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
 	-e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \
 	-e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \
 	-e "s,define _GLIBCXX_USE_ALLOCATOR_NEW, define _GLIBCXX_USE_ALLOCATOR_NEW $$allocatornew," \
+	-e "s,define _GLIBCXX_USE_FLOAT128, define _GLIBCXX_USE_FLOAT128 $$float128," \
 	-e "$$ldbl_compat" \
 	    < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
 	sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index 1eb4679..e345241 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -609,4 +609,10 @@ namespace std
 # endif
 #endif
 
+/* Define if __float128 is supported on this host. */
+#define _GLIBCXX_USE_FLOAT128
+#if !defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)
+#undef _GLIBCXX_USE_FLOAT128
+#endif
+
 // End of prewritten config; the settings discovered at configure time follow.
-- 
2.9.5

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
  2018-03-12 19:02     ` [PATCHv2] " Tulio Magno Quites Machado Filho
@ 2018-03-26 15:23       ` Tulio Magno Quites Machado Filho
  2018-05-01 14:34       ` Jonathan Wakely
  1 sibling, 0 replies; 10+ messages in thread
From: Tulio Magno Quites Machado Filho @ 2018-03-26 15:23 UTC (permalink / raw)
  To: Jonathan Wakely, libstdc++; +Cc: gcc-patches, wschmidt, Segher Boessenkool

Ping?

Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com> writes:

> Changes since v1:
>  - Completely rewrite of the patch to set ENABLE_FLOAT128 at libstdc++
>    build time and undef _GLIBCXX_USE_FLOAT128 when building user code.
>
> --- 8< ---
>
> In order to use __float128 in C++ it's necessary to check if the
> compiler enabled its support too when building user code.
> This patch changes the behavior at libstdc++ build by setting
> ENABLE_FLOAT128, which is used to set the value of the exported macro
> _GLIBCXX_USE_FLOAT128.
>
> 2018-03-12  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>
>
> 	PR libstdc++/84654
> 	* acinclude.m4: Set ENABLE_FLOAT128 instead of _GLIBCXX_USE_FLOAT128.
> 	* config.h.in: Remove references to _GLIBCXX_USE_FLOAT128.
> 	* configure: Regenerate.
> 	* include/Makefile.am: Replace the value of _GLIBCXX_USE_FLOAT128
> 	based on ENABLE_FLOAT128.
> 	* include/Makefile.in: Regenerate.
> 	* include/bits/c++config: Define _GLIBCXX_USE_FLOAT128.
> 	[!defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)]: Undefine
> 	_GLIBCXX_USE_FLOAT128.

-- 
Tulio Magno

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
  2018-03-12 19:02     ` [PATCHv2] " Tulio Magno Quites Machado Filho
  2018-03-26 15:23       ` Tulio Magno Quites Machado Filho
@ 2018-05-01 14:34       ` Jonathan Wakely
  2018-05-07 20:03         ` Jonathan Wakely
  1 sibling, 1 reply; 10+ messages in thread
From: Jonathan Wakely @ 2018-05-01 14:34 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho
  Cc: Jonathan Wakely, libstdc++, gcc-patches, wschmidt, Segher Boessenkool

On 12/03/18 16:02 -0300, Tulio Magno Quites Machado Filho wrote:
>Changes since v1:
> - Completely rewrite of the patch to set ENABLE_FLOAT128 at libstdc++
>   build time and undef _GLIBCXX_USE_FLOAT128 when building user code.
>
>--- 8< ---
>
>In order to use __float128 in C++ it's necessary to check if the
>compiler enabled its support too when building user code.
>This patch changes the behavior at libstdc++ build by setting
>ENABLE_FLOAT128, which is used to set the value of the exported macro
>_GLIBCXX_USE_FLOAT128.

Now that we're in stage 1 we can make this change. The patch looks
right so I'll go ahead and commit it to trunk (it shouldn't interfere
with testing any last-minute fixes needed for gcc-8).

Thanks for fixing this, Tulio.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
  2018-05-01 14:34       ` Jonathan Wakely
@ 2018-05-07 20:03         ` Jonathan Wakely
  0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Wakely @ 2018-05-07 20:03 UTC (permalink / raw)
  To: Tulio Magno Quites Machado Filho
  Cc: libstdc++,
	gcc-patches, wschmidt, Segher Boessenkool, John David Anglin,
	Marc Glisse

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

On 01/05/18 15:34 +0100, Jonathan Wakely wrote:
>On 12/03/18 16:02 -0300, Tulio Magno Quites Machado Filho wrote:
>>Changes since v1:
>>- Completely rewrite of the patch to set ENABLE_FLOAT128 at libstdc++
>>  build time and undef _GLIBCXX_USE_FLOAT128 when building user code.
>>
>>--- 8< ---
>>
>>In order to use __float128 in C++ it's necessary to check if the
>>compiler enabled its support too when building user code.
>>This patch changes the behavior at libstdc++ build by setting
>>ENABLE_FLOAT128, which is used to set the value of the exported macro
>>_GLIBCXX_USE_FLOAT128.
>
>Now that we're in stage 1 we can make this change. The patch looks
>right so I'll go ahead and commit it to trunk (it shouldn't interfere
>with testing any last-minute fixes needed for gcc-8).
>
>Thanks for fixing this, Tulio.

Previously _GLIBCXX_USE_FLOAT128 would either be defined to 1 or
undefined, but after this change it can be defined to 0, and the
checks in <type_traits> and <bits/std_abs.h> were not adjusted to
account for that.

This patch restores the previous behaviour, so that when __float128
support is not found by configure the macro will be undefined instead
of defined to 0.

I plan to commit this tomorrow after some more testing.


[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 2471 bytes --]

commit aed5af13903fa21632919269c9e7f7c4e02e8887
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon May 7 20:46:21 2018 +0100

    PR libstdc++/85672 #undef _GLIBCXX_USE_FLOAT128 when not supported
    
    Restore the behaviour in GCC 8 and earlier where _GLIBCXX_USE_FLOAT128
    is not defined when configure detects support is missing. This avoids
    having three states where the macro is either 1, 0, or undefined.
    
            PR libstdc++/85672
            * include/Makefile.am [!ENABLE_FLOAT128]: Change c++config.h entry
            to #undef _GLIBCXX_USE_FLOAT128 instead of defining it to zero.
            * include/Makefile.in: Regenerate.
            * include/bits/c++config (_GLIBCXX_USE_FLOAT128): Move definition
            within conditional block.

diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index ba5adda95bd..77e6dc2f6be 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -1232,10 +1232,10 @@ endif
 
 if ENABLE_FLOAT128
 stamp-float128:
-	echo 1 > stamp-float128
+	echo 'define _GLIBCXX_USE_FLOAT128 1' > stamp-float128
 else
 stamp-float128:
-	echo 0 > stamp-float128
+	echo 'undef _GLIBCXX_USE_FLOAT128' > stamp-float128
 endif
 
 # NB: The non-empty default ldbl_compat works around an AIX sed
@@ -1272,7 +1272,7 @@ ${host_builddir}/c++config.h: ${CONFIG_HEADER} \
 	-e "s,define _GLIBCXX_USE_DUAL_ABI, define _GLIBCXX_USE_DUAL_ABI $$dualabi," \
 	-e "s,define _GLIBCXX_USE_CXX11_ABI, define _GLIBCXX_USE_CXX11_ABI $$cxx11abi," \
 	-e "s,define _GLIBCXX_USE_ALLOCATOR_NEW, define _GLIBCXX_USE_ALLOCATOR_NEW $$allocatornew," \
-	-e "s,define _GLIBCXX_USE_FLOAT128, define _GLIBCXX_USE_FLOAT128 $$float128," \
+	-e "s,define _GLIBCXX_USE_FLOAT128,$$float128," \
 	-e "$$ldbl_compat" \
 	    < ${glibcxx_srcdir}/include/bits/c++config > $@ ;\
 	sed -e 's/HAVE_/_GLIBCXX_HAVE_/g' \
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index e34524117d6..bfe268da825 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -610,9 +610,8 @@ namespace std
 #endif
 
 /* Define if __float128 is supported on this host. */
+#if defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
 #define _GLIBCXX_USE_FLOAT128
-#if !defined(__FLOAT128__) && !defined(__SIZEOF_FLOAT128__)
-#undef _GLIBCXX_USE_FLOAT128
 #endif
 
 // End of prewritten config; the settings discovered at configure time follow.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-05-07 20:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-01 18:47 [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler Tulio Magno Quites Machado Filho
2018-03-01 18:54 ` Marc Glisse
2018-03-01 22:04   ` Jonathan Wakely
2018-03-12 19:02     ` [PATCHv2] " Tulio Magno Quites Machado Filho
2018-03-26 15:23       ` Tulio Magno Quites Machado Filho
2018-05-01 14:34       ` Jonathan Wakely
2018-05-07 20:03         ` Jonathan Wakely
2018-03-01 19:10 ` [PATCH] " Jakub Jelinek
2018-03-01 20:52   ` Jakub Jelinek
2018-03-01 20:56     ` Marc Glisse

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).