From patchwork Fri Mar 4 11:30:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 51562 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ECDB0385802F for ; Fri, 4 Mar 2022 11:31:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ECDB0385802F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1646393490; bh=Vr5isyNdc/qwgeMo7XPNbtKzr1P13UcNzr3KpqXMX1o=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PCdI8JMBeTioon33m6Z5RRzwPUAMl8N/3DJzBkhpbQmzKLz9V5L7yD9gxAJbj1WBp 2CW3eELODFd6BOWGYAh0spoSajNH286E9ren7X5LuO8oFF7LA7mp6AZ5cf2liWweig SxmlR6UUZIeo3tBkB27g1O8ZK+3CME83jucd+RHw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 047BA3858D39 for ; Fri, 4 Mar 2022 11:31:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 047BA3858D39 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-265-BVLZsJ1kMceIZ_vnFfIVjw-1; Fri, 04 Mar 2022 06:30:59 -0500 X-MC-Unique: BVLZsJ1kMceIZ_vnFfIVjw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 191D21854E21; Fri, 4 Mar 2022 11:30:58 +0000 (UTC) Received: from localhost (unknown [10.33.36.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7CAB1057FD2; Fri, 4 Mar 2022 11:30:57 +0000 (UTC) Date: Fri, 4 Mar 2022 11:30:56 +0000 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix -Wunused-local-typedefs warning in Message-ID: References: <20220303223829.1115727-1-jwakely@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220303223829.1115727-1-jwakely@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" On 03/03/22 22:38 +0000, Jonathan Wakely wrote: >Tested x86_64-linux (-m32/-m64), powerpc64-linux (-m32/-m64), >powerpc64le-linux, powerpc-aix (maix32/-maix64/-mlong-double-128). > >Pushed to trunk. I'm inclined to backport this to gcc-11 after some soak >time on trunk (but not gcc-10, because it needs __builtin_bit_cast). > >-- >8 -- > >This removes a FIXME in , defining the total order for >floating-point types. I originally opened PR96526 to request a new >compiler built-in to implement this, but now that we have std::bit_cast >it can be done entirely in the library. > >The implementation is based on the glibc definitions of totalorder, >totalorderf, totalorderl etc. > >I think this works for all the types that satisfy std::floating_point >today, and should also work for the types expected to be added by P1467 >except for std::bfloat16_t. It also supports some additional types that >don't currently satisfy std::floating_point, such as __float80, but we >probably do want that to satisfy the concept for non-strict modes. > >libstdc++-v3/ChangeLog: > > PR libstdc++/96526 > * libsupc++/compare (strong_order): Add missing support for > floating-point types. > * testsuite/18_support/comparisons/algorithms/strong_order_floats.cc: > New test. That commit produces a warning due to a typedef that is only needed for some targets, which caused: FAIL: g++.dg/warn/Wstringop-overflow-6.C -std=gnu++20 (test for excess errors) Here's the fix. Tested x86_64-linux, pushed to trunk. commit 289f65d643e18210433e0f08ccaaf5b08b3d6f39 Author: Jonathan Wakely Date: Fri Mar 4 10:43:29 2022 libstdc++: Fix -Wunused-local-typedefs warning in libstdc++-v3/ChangeLog: * libsupc++/compare (strong_order::_S_fp_cmp): Move typedef inside #if condition. diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare index a8747207b23..050cf7ed20d 100644 --- a/libstdc++-v3/libsupc++/compare +++ b/libstdc++-v3/libsupc++/compare @@ -850,8 +850,6 @@ namespace std return strong_ordering::equal; // All bits are equal, we're done. using enum _Fp_fmt; - using _Int = decltype(__ix); - constexpr auto __fmt = _S_fp_fmt<_Tp>(); if constexpr (__fmt == _Dbldbl) // double-double @@ -899,6 +897,8 @@ namespace std // bit to be reversed. Flip that to give desired ordering. if (__builtin_isnan(__x) && __builtin_isnan(__y)) { + using _Int = decltype(__ix); + constexpr int __nantype = __fmt == _Binary32 ? 22 : __fmt == _Binary64 ? 51 : __fmt == _Binary128 ? 111