From patchwork Fri Dec 18 16:04:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 1418478 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=Y/ulLra3; dkim-atps=neutral Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CyDFj4s6Fz9sVj for ; Sat, 19 Dec 2020 03:04:24 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9B01138618AA; Fri, 18 Dec 2020 16:04:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B01138618AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1608307456; bh=iHmeCfdIHmGKwkpD+hBmlpKodrx2oGRQa34L2haXWvg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Y/ulLra34bxczl4f5DxKt85CUdqH87xGbje9otySnYcQA7vgTOjFU7kJnv1jHfjua FbY1jNqAQ9qzGe37SDiCr7MTIgR9GJ3f2M4Kijmfwd3A6wPj9fqSK1kncX4UpLjdj4 Zh2gNE5ySS7szs/l/WqWw3hzBkuUBjhjpp/I9goA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 9EB0138618AA for ; Fri, 18 Dec 2020 16:04:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9EB0138618AA Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-_L5KxXX6OFChcKuroDkoPw-1; Fri, 18 Dec 2020 11:04:12 -0500 X-MC-Unique: _L5KxXX6OFChcKuroDkoPw-1 Received: by mail-qk1-f199.google.com with SMTP id l138so2371605qke.4 for ; Fri, 18 Dec 2020 08:04:12 -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=TexG2qbhYMyVmYtQYZ9tEAbptJAvcs/IJfVWpdg9s3IubduOcrqPo/qdrrfjXgq4SA IJp6j2+oK7Rdn2ewernZhwzfmHDhH2Ros3lBTLLUMwobqENJPNWYmdOl1Z5zq8a8Spcm UtBzkx/Yz2sGlegyuoC7PgGROMLYQL2+x+KKh7a3/X07IMU/EgnRVqq++mkLO2VjyzO5 DJ63y8FWpGYxZyJf6wqB+c18DqWXK5m5N4gnXlAMfjQ0QXSO9XYlZMh+ZoMhKBSk9sVX adD/wbh4oVSe0w6GJeWKZQx+V/j40x38CKSRUZF14Pul+9s+RuQiA9MVj+k7IKMSNg/y KWPA== X-Gm-Message-State: AOAM53281cOj2YWJHApfODJRNL4YTqXv3Xvcrr4s04Ux70RjGFdcprFC gSyEJb7fOejB+wWlEq1PgnIa/pCTM+A+4pVFlFWQfz9JURrTxVM+kTikKbdnKhaZFL4aM8XNwSH MBaImSkZ6NeQgprfzZJwcPgoM6QwUT+Jh4o/nOQcKcNmAnjhVVPIt7NJdIMIu5MKfNO0= X-Received: by 2002:aed:2f64:: with SMTP id l91mr4574758qtd.363.1608307451192; 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) To: gcc-patches@gcc.gnu.org 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 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Patrick Palka via Gcc-patches From: Patrick Palka Reply-To: Patrick Palka Cc: libstdc++@gcc.gnu.org Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" 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;