libstdc++: Check FE_TONEAREST is defined before using it
authorPatrick Palka <ppalka@redhat.com>
Fri, 18 Dec 2020 16:52:14 +0000 (11:52 -0500)
committerPatrick Palka <ppalka@redhat.com>
Fri, 18 Dec 2020 16:52:14 +0000 (11:52 -0500)
commit266d74647567e610cc6fd6fccb7db31081f538e2
treef502a772a75789d68644d0f0c62f5867a4bf6ef4
parent3af02d32cce2ff1ff11d078cf8094305f57ca179
libstdc++: Check FE_TONEAREST is defined before using it

We need to test that FE_TONEAREST is defined before we may use it along
with fegetround/fesetround to adjust the floating-point rounding mode.
This fixes a build failure with older versions of newlib.

libstdc++-v3/ChangeLog:

* src/c++17/floating_from_chars.cc (from_chars_impl)
[!defined(FE_TONEAREST)]: Don't adjust the rounding mode.
* src/c++17/floating_to_chars.cc (__floating_to_chars_precision):
Likewise.
libstdc++-v3/src/c++17/floating_from_chars.cc
libstdc++-v3/src/c++17/floating_to_chars.cc