From patchwork Mon Apr 20 16:52:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1273565 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=tzB+oxEG; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 495Xn81C8yz9sP7 for ; Tue, 21 Apr 2020 02:52:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3FD25384B439; Mon, 20 Apr 2020 16:52:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FD25384B439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587401560; bh=F8kBsM+iIFGyhkfQ4kLTNctp5C+fKYC7p85I+Yp0hmc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=tzB+oxEGDqLIbSfd17Pugz8AdvF9SVzyWxtA06w7ZOINNSF8ceMNeoCQpZI6Ln2pZ rPpJQU7lmYlRf39aNSr2j1s4ACYc+w9Npu2odhIlRQijnd/FBhOfYzTuqR0Yx918z6 BMN9dSqQRiwYjt69kOZpfhDM1Fejqk9JGCA7N8Lw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id C160D3858D35 for ; Mon, 20 Apr 2020 16:52:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C160D3858D35 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-302-Ijq9kqChOXeh1mDLv6LDBA-1; Mon, 20 Apr 2020 12:52:34 -0400 X-MC-Unique: Ijq9kqChOXeh1mDLv6LDBA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E824519357B0; Mon, 20 Apr 2020 16:52:32 +0000 (UTC) Received: from localhost (unknown [10.33.36.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95EA05C1C5; Mon, 20 Apr 2020 16:52:32 +0000 (UTC) Date: Mon, 20 Apr 2020 17:52:31 +0100 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Update __cpp_lib_three_way_comparison macro Message-ID: <20200420165231.GA2114132@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-29.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@gcc.gnu.org Sender: "Gcc-patches" With P1614R2 fully implemented (except for the types which we don't support at all) we can define the feature test macro to the new value. * include/std/version (__cpp_lib_three_way_comparison): Update value. * libsupc++/compare (__cpp_lib_three_way_comparison): Likewise. Tested powerpc64le-linux, committed to master. After committing it I noticed I'd also accidentally added a change to __synth3way as well, which I meant to do in a separate commit. I'll update the changelog entry to reflect that. commit 73a0a21d22da7db9687853a4ee7d55fc9aa818a4 Author: Jonathan Wakely Date: Mon Apr 20 17:50:10 2020 +0100 libstdc++: Update __cpp_lib_three_way_comparison macro With P1614R2 fully implemented (except for the types which we don't support at all) we can define the feature test macro to the new value. * include/std/version (__cpp_lib_three_way_comparison): Update value. * libsupc++/compare (__cpp_lib_three_way_comparison): Likewise. diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version index d9a47ee8e8a..6d7dcc46023 100644 --- a/libstdc++-v3/include/std/version +++ b/libstdc++-v3/include/std/version @@ -200,7 +200,7 @@ #endif #define __cpp_lib_span 202002L #if __cpp_impl_three_way_comparison >= 201907L && __cpp_lib_concepts -# define __cpp_lib_three_way_comparison 201711L +# define __cpp_lib_three_way_comparison 201907L #endif #define __cpp_lib_to_array 201907L #endif diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare index e5fb322ed9e..28dfe843ee7 100644 --- a/libstdc++-v3/libsupc++/compare +++ b/libstdc++-v3/libsupc++/compare @@ -39,7 +39,7 @@ #include #if __cpp_lib_concepts -# define __cpp_lib_three_way_comparison 201711L +# define __cpp_lib_three_way_comparison 201907L #endif namespace std @@ -866,12 +866,23 @@ namespace std namespace __detail { - // [expos.only.func] + // [expos.only.func] synth-three-way inline constexpr struct _Synth3way { + template + static constexpr bool + _S_noexcept(const _Tp* __t = nullptr, const _Up* __u = nullptr) + { + if constexpr (three_way_comparable_with<_Tp, _Up>) + return noexcept(*__t <=> *__u); + else + return noexcept(*__t < *__u) && noexcept(*__u < *__t); + } + template constexpr auto operator()(const _Tp& __t, const _Up& __u) const + noexcept(_S_noexcept<_Tp, _Up>()) requires requires { { __t < __u } -> __boolean_testable; @@ -892,6 +903,7 @@ namespace std } } __synth3way = {}; + // [expos.only.func] synth-three-way-result template using __synth3way_t = decltype(__detail::__synth3way(std::declval<_Tp&>(),