From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1888) id 2C3FE3898525; Fri, 18 Dec 2020 16:55:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C3FE3898525 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Patrick Palka To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-6259] libstdc++: Fix build failure due to missing [PR98374] X-Act-Checkin: gcc X-Git-Author: Patrick Palka X-Git-Refname: refs/heads/master X-Git-Oldrev: 266d74647567e610cc6fd6fccb7db31081f538e2 X-Git-Newrev: d7bab388b818fc21dbb9111311e114ae33e11fff Message-Id: <20201218165521.2C3FE3898525@sourceware.org> Date: Fri, 18 Dec 2020 16:55:21 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2020 16:55:21 -0000 https://gcc.gnu.org/g:d7bab388b818fc21dbb9111311e114ae33e11fff commit r11-6259-gd7bab388b818fc21dbb9111311e114ae33e11fff Author: Patrick Palka Date: Fri Dec 18 11:52:17 2020 -0500 libstdc++: Fix build failure due to missing [PR98374] This should fix a build failure on Windows which lacks , from which we use nl_langinfo() to obtain the radix character of the current locale. (We can't use the more portable localeconv() from to obtain the radix character of the current locale here because it's not thread-safe, unfortunately.) This change means that on Windows and other such platforms, we'll just always assume the radix character used by printf is '.' when formatting a long double through it. libstdc++-v3/ChangeLog: PR libstdc++/98374 * src/c++17/floating_to_chars.cc: Guard include of with __has_include. (__floating_to_chars_precision) [!defined(RADIXCHAR)]: Don't attempt to obtain the radix character of the current locale, just assume it's '.'. Diff: --- libstdc++-v3/src/c++17/floating_to_chars.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/src/c++17/floating_to_chars.cc b/libstdc++-v3/src/c++17/floating_to_chars.cc index 474e791e717..6470fbb0b95 100644 --- a/libstdc++-v3/src/c++17/floating_to_chars.cc +++ b/libstdc++-v3/src/c++17/floating_to_chars.cc @@ -33,7 +33,9 @@ #include #include #include -#include +#if __has_include() +# include // for nl_langinfo +#endif #include #include #include @@ -1113,6 +1115,7 @@ template // to handle a radix point that's different from '.'. char radix[6] = {'.', '\0', '\0', '\0', '\0', '\0'}; if (effective_precision > 0) +#ifdef RADIXCHAR // ???: Can nl_langinfo() ever return null? if (const char* const radix_ptr = nl_langinfo(RADIXCHAR)) { @@ -1121,6 +1124,7 @@ template // UTF-8 character) wide. __glibcxx_assert(radix[4] == '\0'); } +#endif // Compute straightforward upper bounds on the output length. int output_length_upper_bound;