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 C9CF138983B0 for ; Tue, 15 Nov 2022 15:45:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C9CF138983B0 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-488-iUaPhEnGNjqClJmcM_ZgSA-1; Tue, 15 Nov 2022 10:45:25 -0500 X-MC-Unique: iUaPhEnGNjqClJmcM_ZgSA-1 Received: by mail-ed1-f69.google.com with SMTP id v18-20020a056402349200b004622e273bbbso10182221edc.14 for ; Tue, 15 Nov 2022 07:45:24 -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=4Q5BXSxo6qmH2IQ1YSBNqLp6IRJSqgXbH/d/jNGGFBBnth+x+34wycztvN8zFiAhEC EG0PUa+7GDV5bVaf4XEHeYoQ1qmToqjCXqB11vNyLBj/rN0YaMY3HL6k7Cdebr7ByHVK xJi5NczwiC42zeHlvuKC2AgA9UCz/4TQ7bLXODoFiJkeSjkY5JAQH7WV8dE3uZdOhYNV MOXJqX8gZZ9eIQ1yM4Yc9SC130ABKzxRcq4eLt1WybZJKVLbkbrRHOnl/Z7IP6211AOd 6A+I/8CasRk/OoiOyqIptPbGOdnDLUFuP5K3+wvtSCrrKUgLb342CAkpqwf5daQ7TpPS fsGA== X-Gm-Message-State: ANoB5pknyH2BrQSkDzhv7M1lnXsiUP/4DegchPM4r6shKu+LMzaxrPRN ltX873RmQFMyHXVnFBNKklOt2SUEtPg92JUJZZWxEOJpkAUJY9AJbzPWC3+yFYm+OmOWjNYKadG kOdADZgdGF0DMJxGRyHZuuJ7fTAk0G/0= X-Received: by 2002:a17:907:2b26:b0:7ae:c460:c65f with SMTP id gc38-20020a1709072b2600b007aec460c65fmr14116212ejc.226.1668527124147; 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+).