diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-03-11 14:36:18 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-03-16 16:06:29 +0000 |
commit | 5a4e208022e7047af3a15a3dedb715ad801db160 (patch) | |
tree | b90f70e422a851cc62500bd4073b7adce848f5b1 /libgomp/secure_getenv.h | |
parent | beb12c62eaec37ed0ee5a251ca0907d965d413b2 (diff) | |
download | gcc-5a4e208022e7047af3a15a3dedb715ad801db160.zip gcc-5a4e208022e7047af3a15a3dedb715ad801db160.tar.gz gcc-5a4e208022e7047af3a15a3dedb715ad801db160.tar.bz2 |
libstdc++: Ensure that std::from_chars is declared when supported
This adjusts the declarations in <charconv> to match when the definition
is present. This solves the issue that std::from_chars is present on
Solaris 11.3 (using fast_float) but was not declared in the header
(because the declarations were guarded by _GLIBCXX_HAVE_USELOCALE).
Additionally, do not define __cpp_lib_to_chars unless both from_chars
and to_chars are supported (which is only true for IEEE float and
double). We might still provide from_chars (via strtold) but if to_chars
isn't provided, we shouldn't define the feature test macro.
Finally, this simplifies some of the preprocessor checks in the bodies
of std::from_chars in src/c++17/floating_from_chars.cc and hoists the
repeated code for the strtod version into a new function template.
N.B. the long double overload of std::from_chars will always be defined
if the float and double overloads are defined. We can always use one of
strtold or fast_float's binary64 routines (although the latter might
produce errors for some long double values if they are not representable
as binary64).
libstdc++-v3/ChangeLog:
* include/std/charconv (__cpp_lib_to_chars): Only define when
both from_chars and to_chars are supported for floating-point
types.
(from_chars, to_chars): Adjust preprocessor conditions guarding
declarations.
* include/std/version (__cpp_lib_to_chars): Adjust condition to
match <charconv> definition.
* src/c++17/floating_from_chars.cc (from_chars_strtod): New
function template.
(from_chars): Simplify preprocessor checks and use
from_chars_strtod when appropriate.
Diffstat (limited to 'libgomp/secure_getenv.h')
0 files changed, 0 insertions, 0 deletions