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 3FE0638983B1 for ; Tue, 15 Nov 2022 15:45:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3FE0638983B1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668527126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O1XyRg6Po5PSkFr6QkUNvFTxRzd51f8PQgDg5QDJ+H0=; b=edRvOiof49tvs9c3cJykBMG4jCBcXaDwGH3uYFc+gXCkbsB89BB5cHnKDyh52jNN25iFYM 2hQ5WU0jX2PGXkB8jsIhQtzclnvty/GWsXnEbYPEHNhONO8zEW+Veo9AamNOCoS+eQZOxF +KbnRrRvuW2tBQ5H17UlGMTwpotWLFQ= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-674-mi4AH61sPxef_qVsYL0aow-1; Tue, 15 Nov 2022 10:45:25 -0500 X-MC-Unique: mi4AH61sPxef_qVsYL0aow-1 Received: by mail-ed1-f69.google.com with SMTP id l18-20020a056402255200b004633509768bso10140265edb.12 for ; Tue, 15 Nov 2022 07:45:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O1XyRg6Po5PSkFr6QkUNvFTxRzd51f8PQgDg5QDJ+H0=; b=Wd+pEOxvpyMGuupwwvtG/h0M8x9xOxwyDgf/049Eq+eDsU0U7plB7iguFywZdVq1D1 IBRE/PcuP5+lQC0w2d8AoFazw4h38MGizGULxEdCzxDp6uqbHG6eapM1RLWFYbNAuH1n iRIuYNhzGlMA6AIPI3c4/wd3siH4VQoRcL0kyON7oBUucYHePL2D4oqPQlG2/gJ1IZ/g XuakvwJF7oRaZdxXq+J82Im8JuMiIQyI+Lou44bk0xvFIfTuQfP0JlcqhL3I7U3dbe8s TjZXMgCey28uTljXhSjENyw+x2gyKXWcOd3b//aWPqSaJybSQFjknxBEyyfSrwyUKwRA uudg== X-Gm-Message-State: ANoB5pkTDIKPS5SxEtEvSlQSqX2Od+N+cAVXIe6g6MrQWMZ1YRo0HX+5 2CdPnuslE/YSBE6pMXaderZ9yV7hVeqp4y9HFYlsnQfwv1eyUKmpHZgWGWw+MoMb0l2DlCKqn6p 9PLX/BQ/9IBFDxyG+IQTZs4L1uUeG4rPRlQ== X-Received: by 2002:a17:907:2b26:b0:7ae:c460:c65f with SMTP id gc38-20020a1709072b2600b007aec460c65fmr14116221ejc.226.1668527124271; Tue, 15 Nov 2022 07:45:24 -0800 (PST) X-Google-Smtp-Source: AA0mqf7CfN5VmGrKDJvceaAxyaqCIzgeYYoYD6tVR0WAjlVZPFRD4eTKppLNQT44Y1JDX85H0q0cO3vT2HEhdGQ9B2E= X-Received: by 2002:a17:907:2b26:b0:7ae:c460:c65f with SMTP id gc38-20020a1709072b2600b007aec460c65fmr14116196ejc.226.1668527123965; Tue, 15 Nov 2022 07:45:23 -0800 (PST) MIME-Version: 1.0 References: <20221115143119.1155190-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Tue, 15 Nov 2022 15:45:13 +0000 Message-ID: Subject: Re: [committed] libstdc++: Fix detection of std::format support for __float128 [PR107693] To: Jakub Jelinek Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.8 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_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 15 Nov 2022 at 14:42, Jakub Jelinek wrote: > > On Tue, Nov 15, 2022 at 02:31:19PM +0000, Jonathan Wakely via Gcc-patches wrote: > > Tested x86_64-linux and x86_64-w64-mingw32. Pushed to trunk. > > > > -- >8 -- > > > > std::format gives linker errors on targets that define __float128 but > > do not support using it with std::to_chars. This improves the handling > > of 128-bit flaoting-point types so they are disabled if unsupportable. > > > > libstdc++-v3/ChangeLog: > > > > PR libstdc++/107693 > > * include/std/format (_GLIBCXX_FORMAT_F128): Define to 2 when > > basic_format_arg needs to use its _M_f128 member. > > (__extended_floating_point, __floating_point): Replace with ... > > (__formattable_floating_point): New concept. > > * testsuite/std/format/functions/format.cc: Check whether > > __float128 is supported. Also test _Float128. > > > --- a/libstdc++-v3/include/std/format > > +++ b/libstdc++-v3/include/std/format > > > +#elif __FLT128_DIG__ && defined(__GLIBC_PREREQ) // see floating_to_chars.cc > > I'd just use here > #elif __FLT128_DIG__ && defined(_GLIBCXX_HAVE_FLOAT128_MATH) > instead. > > The reason for defined(__GLIBC_PREREQ) in floating_{to,from}_chars.cc > is that I didn't want to make the ABI of linux libstdc++.so.6 dependent > on whether gcc was built against glibc 2.26+ or older glibc. > So, the symbols exist in libstdc++.so.6 even for older glibcs, but it will > actually only work properly (without losing precision; otherwise it will > just go through long double) if at runtime one uses glibc 2.26+. Yes, and my intention was that std::format would also support __float128, with the same imprecise behaviour. But could just limit std::format support to when std::to_chars works properly. > But in the headers, defined(_GLIBCXX_HAVE_FLOAT128_MATH) is used everywhere > else (which is true only when compiling against glibc 2.26+).