libstdc++: Disable floating-point std::to_chars on unsupported targets
authorPatrick Palka <ppalka@redhat.com>
Mon, 21 Dec 2020 20:15:36 +0000 (15:15 -0500)
committerPatrick Palka <ppalka@redhat.com>
Mon, 21 Dec 2020 20:15:36 +0000 (15:15 -0500)
commit6a31d47e271d066ea85b3716f7b77f18e6b55242
tree02684ce11cb6b5026d2c1cd62b7b753dd5d960f2
parente798f081925b5085de3c9d0f330eb6e255a377bf
libstdc++: Disable floating-point std::to_chars on unsupported targets

This patch conditionally disables the floating-point std::to_chars
implementation on targets whose float and double aren't IEEE binary32
and binary64, until a proper fallback can be added for such targets.
This fixes a bootstrap failure on non-IEEE-754 FP targets such as
vax-netbsdelf.

The new preprocessor tests in c++config that detect the binary32 and
binary64 formats were copied from gcc/testsuite/gcc.dg/float-exact-1.c.

libstdc++-v3/ChangeLog:

* include/bits/c++config (_GLIBCXX_FLOAT_IS_IEEE_BINARY_32):
Define this macro.
(_GLIBCXX_DOUBLE_IS_IEEE_BINARY_64): Likewise.
* include/std/charconv (to_chars): Use these macros to
conditionally hide the overloads for floating-point types.
* src/c++17/floating_to_chars.cc: Use the macros to
conditionally disable this file.
(floating_type_traits<float>): Remove redundant static assert.
(floating_type_traits<double>): Likewise.
* testsuite/20_util/to_chars/double.cc: Run this test only on
ieee-floats effective targets.
* testsuite/20_util/to_chars/float.cc: Likewise.
* testsuite/20_util/to_chars/long_double.cc: Likewise.
* testsuite/lib/libstdc++.exp
(check_effective_target_ieee-floats): Define new proc for
detecting whether float and double have the IEEE binary32 and
binary64 formats.
libstdc++-v3/include/bits/c++config
libstdc++-v3/include/std/charconv
libstdc++-v3/src/c++17/floating_to_chars.cc
libstdc++-v3/testsuite/20_util/to_chars/double.cc
libstdc++-v3/testsuite/20_util/to_chars/float.cc
libstdc++-v3/testsuite/20_util/to_chars/long_double.cc
libstdc++-v3/testsuite/lib/libstdc++.exp