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 A56AD3896C09 for ; Tue, 15 Nov 2022 14:42:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A56AD3896C09 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=1668523371; h=from:from:reply-to: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=jHeknIEzO/TgYrqf8fPiSFlhxcVCASx/4WfTC5t70Vg=; b=gzUM8Yqq9rbNqvEHY14fRZR6YZ1mjy+eXaC/wEluixJktESCyYFj1+fmTh2Ubh+f7ySFfL zwHx/HqvhSs2BvvArH8WQAwf+txf7mJoI/5LGydmMBcn05OH1KXLH7Heoep0f6b6ZOiqqf YwGxQLEubh6MCwMlax3AzGXfhIGDeH4= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-574-Zk281wukPDKdgwLdQ7z_nA-1; Tue, 15 Nov 2022 09:42:47 -0500 X-MC-Unique: Zk281wukPDKdgwLdQ7z_nA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9BD341C08987; Tue, 15 Nov 2022 14:42:47 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5DD3740C845C; Tue, 15 Nov 2022 14:42:47 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 2AFEggkW570112 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 15 Nov 2022 15:42:43 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2AFEgghv570111; Tue, 15 Nov 2022 15:42:42 +0100 Date: Tue, 15 Nov 2022 15:42:42 +0100 From: Jakub Jelinek To: Jonathan Wakely Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [committed] libstdc++: Fix detection of std::format support for __float128 [PR107693] Message-ID: Reply-To: Jakub Jelinek References: <20221115143119.1155190-1-jwakely@redhat.com> MIME-Version: 1.0 In-Reply-To: <20221115143119.1155190-1-jwakely@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.9 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, 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+. But in the headers, defined(_GLIBCXX_HAVE_FLOAT128_MATH) is used everywhere else (which is true only when compiling against glibc 2.26+). Jakub