]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix preprocessor conditions for std::from_chars [PR109921]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 25 May 2023 09:32:33 +0000 (10:32 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 19 Jul 2023 20:38:08 +0000 (21:38 +0100)
commitcd2f934bb09c04e62beb8eb5421467184598983b
tree406984a44f7aae310130065d104d2b70a9afe404
parent92f6240baf80f998ca6c1408c3ee09d5d2ae68d7
libstdc++: Fix preprocessor conditions for std::from_chars [PR109921]

We use the from_chars_strtod function with __strtof128 to read a
_Float128 value, but from_chars_strtod is not defined unless uselocale
is available. This can lead to compilation failures for some targets,
because we try to define the _Float128 overload in terms of a
non-existing from_chars_strtod function.

Only try to use __strtof128 if uselocale is available and therefore we
can use the from_chars_strtod function template.

This is a simpler change than r14-1431-g7037e7b6e4ac41 on trunk, because
that caused unwanted ABI regressions (PR libstdc++/110077).

libstdc++-v3/ChangeLog:

PR libstdc++/109921
* src/c++17/floating_from_chars.cc (USE_STRTOF128_FOR_FROM_CHARS):
Only define when USE_STRTOD_FOR_FROM_CHARS is also defined.
(USE_STRTOD_FOR_FROM_CHARS): Do not undefine when long double is
binary64.
(from_chars(const char*, const char*, double&, chars_format)):
Check __LDBL_MANT_DIG__ == __DBL_MANT_DIG__ here.
libstdc++-v3/src/c++17/floating_from_chars.cc