From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 9BE7A3858D20; Mon, 14 Mar 2022 21:15:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9BE7A3858D20 Received: by mail-wm1-x32a.google.com with SMTP id q20so10095842wmq.1; Mon, 14 Mar 2022 14:15:47 -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=dqM8TLBLsKz0+GWHYUKVoKGcr1I/5Wf60uZSlN3hzcw=; b=OfPrLcMlQ0RLKgiL5RKChDqkpzItz/PcVALmEh2lbOPI8MsICLCXRiIaZTpT+AA8JB rYLbRbiD7Ebddnoj+HomS9QfbURxwRco3ogSknUyTyp3ouoy7oB6zZLBtT4v9xHkJ8Mx wt7K8Uk1TkLKHeC08P18n4YwaVj6i2jH+nHFFNXwjvO6sdkg8PdC2GyB/Kfj50zWI5ls vzD3yVGaXZiac8tXNXiQUvqE1Yph8DUWWAOMtfFOoAjMoyJhpDlXbZVIJ8EB6JlxPchH VnT8WtScGnAlCERW6k7froyY1+dDaB7PF+ebbnmmrldwCIn8ccu7dFodAwqB5kruPOIf dxjg== X-Gm-Message-State: AOAM530fbed6xTK3Olmd2JPts+nwnYLLaKAR/ZfYE6BYVOQf2MJCLEn7 CmIaBALwEvB/yKKdMCOjTGN+KQhaoDr6/VhfAYE= X-Google-Smtp-Source: ABdhPJyytZAC0waCGsnWw9IbBKbh9w02cGrnBVqIAU+g1mltfB+B8OK/Fg7UllZLT+iIF/DBMmp0nP0gyNoWDn/zWtM= X-Received: by 2002:a05:600c:298:b0:38a:f22:700e with SMTP id 24-20020a05600c029800b0038a0f22700emr821926wmk.128.1647292546209; Mon, 14 Mar 2022 14:15:46 -0700 (PDT) MIME-Version: 1.0 References: <20220311183244.1861699-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Mon, 14 Mar 2022 21:15:34 +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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Mon, 14 Mar 2022 21:15:49 -0000 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.