From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 8F8263861821 for ; Fri, 18 Dec 2020 16:04:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8F8263861821 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-b_Em_CW8Mt-fJwUKHR2tKw-1; Fri, 18 Dec 2020 11:04:11 -0500 X-MC-Unique: b_Em_CW8Mt-fJwUKHR2tKw-1 Received: by mail-qk1-f197.google.com with SMTP id a6so2339498qkd.20 for ; Fri, 18 Dec 2020 08:04:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iHmeCfdIHmGKwkpD+hBmlpKodrx2oGRQa34L2haXWvg=; b=VQAcO5XM+LJA3WoEJfDtjJ2tJ0rc4d3n/wbWAy5V90aXeteXByz3eFSU0OCDAtukNe 7I7YDDoYT4ETrV6xE5j5AnLhzuu0OhY6T3G86r9AHKLzIEHETcu5I281b1sjiQvIeP1v mbFR8TuvB1KrZty2jGyOOtmr4oF7+sSOfJ79uU0FYlGcPpBcISvB1VwjkFjWbYX42H4J GQUc80ICGzIC9JySanHREYYnVyXQuBnI2G6eX73TF8TnI5FlZvx9NhGZI94vRNCWviUa seG8CWVC0tegQXryq2q1IDwaELSbWSmf//VMB94irbAesR6QkTeZVhDl4o3/+eRiPhIM 8+3A== X-Gm-Message-State: AOAM530/YizohNJmEbtEYjGFVkqi91HBGmNTqx4xxOjOLAq6vq8QiI8k qxs8FZvDbQYz8Zc/IFp3CEUBPvKwWM2pl8LEJ3P8Bl3jQ68RkhwGlMbZV4sVHo5rbLWgmc8QZZ0 92mUNgwPfRH0z/78= X-Received: by 2002:aed:2f64:: with SMTP id l91mr4574751qtd.363.1608307451131; Fri, 18 Dec 2020 08:04:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJz78GBGN2OKP22Es4oJy1oipZSxQjkSChaeCLvUQeeW+GSHvNxGCg14qNDLpHPSktGNCEn/IQ== X-Received: by 2002:aed:2f64:: with SMTP id l91mr4574728qtd.363.1608307450948; Fri, 18 Dec 2020 08:04:10 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id s30sm5533715qte.44.2020.12.18.08.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Dec 2020 08:04:10 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH] libstdc++: Fix build failure due to missing [PR98374] Date: Fri, 18 Dec 2020 11:04:07 -0500 Message-Id: <20201218160407.1498119-1-ppalka@redhat.com> X-Mailer: git-send-email 2.30.0.rc0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-16.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2020 16:04:15 -0000 This fixes a build failure on Windows which lacks . (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 systems, 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 '.'. --- 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; -- 2.30.0.rc0