diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2023-06-05 16:14:29 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2023-06-06 16:29:22 +0100 |
commit | 6261d10521f9fdc2a43d54b4dc365025288aa8e9 (patch) | |
tree | f96ad957cbaf8b1d6b76704ca9f32b6751181df0 /libstdc++-v3/testsuite/18_support | |
parent | 97a5e8a2a48d162744a5bd60a012ce6fca13cbbe (diff) | |
download | gcc-6261d10521f9fdc2a43d54b4dc365025288aa8e9.zip gcc-6261d10521f9fdc2a43d54b4dc365025288aa8e9.tar.gz gcc-6261d10521f9fdc2a43d54b4dc365025288aa8e9.tar.bz2 |
libstdc++: Make std::numeric_limits<__float128> more portable [PR104772]
This redefines std::numeric_limits<__float128> so that it works with
non-GCC compilers. The previous definition didn't work with Clang, due
to it not supporting __builtin_high_valq, __builtin_nanq, and
__builtin_nansq. It also didn't work in strict modes, due to using Q
literal suffixes.
The new definition uses the Q suffixes when supported, or calculates the
correct values using __float128 arithmetic from double values. Ideally
the values would be defined as hexadecimal-floating-point-literals, but
that won't work for C++14 and older.
The only member that can't be defined this way is signaling_NaN() which
still requires a built-in. If __builtin_nansq is not supported, try to
use __builtin_nansf128 (with a possibly-redundant bit_cast) and if that
isn't supported, return a quiet NaN and define has_signaling_NaN and
is_iec754 to be false.
libstdc++-v3/ChangeLog:
PR libstdc++/104772
* include/std/limits: (numeric_limits<__float128>): Define
for __STRICT_ANSI__ as well.
* testsuite/18_support/numeric_limits/128bit.cc: Remove
check for __STRICT_ANSI__.
Co-authored-by: Jakub Jelinek <jakub@redhat.com>
Diffstat (limited to 'libstdc++-v3/testsuite/18_support')
-rw-r--r-- | libstdc++-v3/testsuite/18_support/numeric_limits/128bit.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/128bit.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/128bit.cc index e8ea568..b13d837 100644 --- a/libstdc++-v3/testsuite/18_support/numeric_limits/128bit.cc +++ b/libstdc++-v3/testsuite/18_support/numeric_limits/128bit.cc @@ -2,7 +2,7 @@ #include <limits> -#if __SIZEOF_FLOAT128__ && !defined __STRICT_ANSI__ +#if __SIZEOF_FLOAT128__ __extension__ template class std::numeric_limits<__float128>; #endif |