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 [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E271F3842405 for ; Wed, 16 Mar 2022 16:26:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E271F3842405 Received: from mail-yb1-f197.google.com (mail-yb1-f197.google.com [209.85.219.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-Blm1uKBcM8SgNelleTfc2Q-1; Wed, 16 Mar 2022 12:26:57 -0400 X-MC-Unique: Blm1uKBcM8SgNelleTfc2Q-1 Received: by mail-yb1-f197.google.com with SMTP id b11-20020a5b008b000000b00624ea481d55so2323456ybp.19 for ; Wed, 16 Mar 2022 09:26:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/8KfDQeO8FP9trJair/21PneiZqybdCiESziTkT5Lus=; b=nk3BaXlwXZ2UU7snplvl0tdf0idtbRr3h0qtY2PvEg+8RiBCe0m0n9vqlp7+NBCUpH trgKvGr8JVW1NUhFOjrAbeZJccNzuA/+zbXFHqPsynk0Jhqb56FWukpRoKCBcCtDgdIV A75TjzmD/NIr/7G52TRoysqyK/CQenwuJWuym7IFMCo8cXrQgQp3YRQYxE0wLp8OgCpa cf2nU6aDxqo3S2wMYg+HQ/BTK3FPcp/j5B7B01h0V+3LoIsSXdkNBPLvXFJRPSDWvTLw El4A2bhq2cUGbBHRgWb3xeNj0sRDfswa8HO494coYxUpzrLaeRzCQwbW//hCVnBUr5Rg cqMg== X-Gm-Message-State: AOAM532RvEQugKkXb5uMjQ28bCG1EvJIYKpxb5bFKixG42hQGJ1Mhfz8 OOlZ4nwCYggESEpLqtRVm2oyD/kQ4VhehzPe2RX553B/ulYNXNBc1FscjnwdlLIJG6utDjTNERp GR5U+7rH7gTp6w5EPZyRmT2oohD74+Gw= X-Received: by 2002:a25:8891:0:b0:624:689e:cf27 with SMTP id d17-20020a258891000000b00624689ecf27mr689411ybl.551.1647448017179; Wed, 16 Mar 2022 09:26:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjyJSj52Q5zasK2CyUuqaRI3a0f6lmsTFfP9hcQBf1DObfYiEZpkf66g/9vSqw8XSeJCbJG/2ho11G9laQkh0= X-Received: by 2002:a25:8891:0:b0:624:689e:cf27 with SMTP id d17-20020a258891000000b00624689ecf27mr689391ybl.551.1647448016984; Wed, 16 Mar 2022 09:26:56 -0700 (PDT) MIME-Version: 1.0 References: <20220311183244.1861699-1-jwakely@redhat.com> <8386f1e0-d179-3a09-16f1-0c1136247018@idea> In-Reply-To: <8386f1e0-d179-3a09-16f1-0c1136247018@idea> From: Jonathan Wakely Date: Wed, 16 Mar 2022 16:26:46 +0000 Message-ID: Subject: Re: [PATCH] libstdc++: Ensure that std::from_chars is declared when supported To: Patrick Palka Cc: Jonathan Wakely , "libstdc++" , gcc-patches X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 16 Mar 2022 16:26:59 -0000 On Tue, 15 Mar 2022 at 14:12, Patrick Palka wrote: > > On Mon, 14 Mar 2022, Jonathan Wakely wrote: > > > On Mon, 14 Mar 2022 at 14:17, Patrick Palka via Libstdc++ > > wrote: > > > > > > On Fri, 11 Mar 2022, Jonathan Wakely wrote: > > > > > > > Patrick, I think this is right, but please take a look to double check. > > > > > > > > I think we should fix the feature-test macro conditions for gcc-11 too, > > > > although it's a bit more complicated there. It should depend on IEEE > > > > float and double *and* uselocale. We don't need the other changes on the > > > > branch. > > > > > > Don't we still depend on uselocale in GCC 12 for long double from_chars, > > > at least on targets where long double != binary64? > > > > Not after this patch: > > > > from_chars(const char* first, const char* last, long double& value, > > chars_format fmt) noexcept > > { > > -#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \ > > - && ! USE_STRTOD_FOR_FROM_CHARS > > +#if ! USE_STRTOD_FOR_FROM_CHARS > > + // Either long double is the same as double, or we can't use strtold. > > + // In the latter case, this might give an incorrect result (e.g. values > > + // out of range of double give an error, even if they fit in long double). > > > > If uselocale isn't available, this defines the long double overload in > > terms of the double one, even if that doesn't always give the right > > answers. That greatly simplifies the preprocessor conditions for when > > it's supported. If the float and double forms are present, so is the > > long double one. > > Ah sorry, I had overlooked that part of the patch. Makes sense and LGTM! Pushed to trunk now.