This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
- From: "Tulio Magno Quites Machado Filho" <tuliom at linux dot vnet dot ibm dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Cc: wschmidt at linux dot vnet dot ibm dot com, segher at kernel dot crashing dot org
- Date: Thu, 1 Mar 2018 15:47:19 -0300
- Subject: [PATCH] PR libstdc++/84654 Do not use __float128 if it is disabled by the compiler
- Authentication-results: sourceware.org; auth=none
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