From patchwork Mon Sep 5 15:44:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 998 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp234757wrt; Mon, 5 Sep 2022 08:45:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR4UxoaZUelZFf4uEUtjK+Cye0zYQiukeoCRls9Dqv8ZDqJPgTQsTR+zg1tBuScSG/k3Cto0 X-Received: by 2002:a17:907:7b8d:b0:741:9c4d:a48 with SMTP id ne13-20020a1709077b8d00b007419c4d0a48mr24997948ejc.746.1662392720893; Mon, 05 Sep 2022 08:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662392720; cv=none; d=google.com; s=arc-20160816; b=SBgyR1vPc0xq0dK+Oqu1OQMt4jvCIiznj+ScQlqT0Ky1FZjK31qOSs6JW6raiUjHGk hUheKugBugQ2XPfUN7HpCeeNzmPksrjHocHeMMO9kKViXk5ZWmM0S3sHyB1DZqIyi+Wv 57wy9P/L4Zyaqz2Crcd0rQ2DhRj5A4Zz3m31X1yjm7aQJ1cCHEC0AqT19lPZ/LR8cL7O Wgp5lhEtu0icYPfuoylgfc9MWmSNU5+JB9SybIPJBpwuLl73VS++LCoMoNUjnDSTQvtP Hm5MxoYZgnAsacyM3J1y+tatAJ5VUy6EpQptHMh+Iu+9AMnmsyBZyXyTWVespG2qRpOW hZGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=LCpgC2YZ6zHXAJGmOLoLt2GNsfs9a2h52e/JkN9Egqs=; b=TC9TlkrSa8L6FjiP6+X0wA1Lkya06oqW22RPgimD96OL0GKlTpKyELvc0Hdo65zjOV vRL1jg6nT86xuHmlyikcZwHEG+A6FUJQ+/mk1CDEugPk+BSzDe2Xdv6loIUTPJpTszxL KEx1KuDsf8uQRvbjKOLVDOOpMPdlxKswvBW8/pxx8ZXuY96Bd2lbHyM+8XFGwV9C0+UP Cqw+juSmIVjnU3UWbuhTshNzSklIMpJ8lPx9TIenP1D5W8+StpGZzHK0Q+3HkyGyXyPG c5PHWfP3LLlRY1EGGzZFVoI5+XKuDst6R2eFWnfP/LUJmE1rjUnTfV1QaanhfPmt+Cmw kyGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fy0iofCZ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id w1-20020a056402268100b0043ccb3ed80asi8444031edd.18.2022.09.05.08.45.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 08:45:20 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fy0iofCZ; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4622B3856DD4 for ; Mon, 5 Sep 2022 15:45:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4622B3856DD4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662392712; bh=LCpgC2YZ6zHXAJGmOLoLt2GNsfs9a2h52e/JkN9Egqs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=fy0iofCZ8bDd2qlBto7wicUZ6o1Rl4Z3g7R9kLrPJm++KoCsxAGvEPuRO4kO7qXpl ApzQ3dqwrJitfk4RJZc6p+KKuIgwSeuscOGhfWpQEQNfd5b7I9voGZ/tIRySTnCJcA I+u6qEA8j0Z5AaVZolgDZTZ04F2ENeCeNZVnvWKk= 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 B133D3858CDA for ; Mon, 5 Sep 2022 15:44:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B133D3858CDA 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-635-ldgI1gaUNvGbvfXrWVAFmw-1; Mon, 05 Sep 2022 11:44:23 -0400 X-MC-Unique: ldgI1gaUNvGbvfXrWVAFmw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4110A38041C0; Mon, 5 Sep 2022 15:44:23 +0000 (UTC) Received: from localhost (unknown [10.33.36.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 060852166B26; Mon, 5 Sep 2022 15:44:22 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Use built-ins for more variable templates Date: Mon, 5 Sep 2022 16:44:22 +0100 Message-Id: <20220905154422.663502-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.8 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, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743145109481998834?= X-GMAIL-MSGID: =?utf-8?q?1743145109481998834?= Tested powerpc64le-linux, pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * include/std/type_traits (is_trivial_v, is_trivially_copyable_v) (is_standard_layout_v, is_pod_v, is_literal_type_v): Use built-in instead of class template. (is_same_v): Add partial specialization for true case. --- libstdc++-v3/include/std/type_traits | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index c7a96079ebf..e19d964fa9c 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -3077,22 +3077,19 @@ template inline constexpr bool is_volatile_v = false; template inline constexpr bool is_volatile_v = true; + template - inline constexpr bool is_trivial_v = is_trivial<_Tp>::value; + inline constexpr bool is_trivial_v = __is_trivial(_Tp); template - inline constexpr bool is_trivially_copyable_v = - is_trivially_copyable<_Tp>::value; + inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp); template - inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); template _GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead") - inline constexpr bool is_pod_v = is_pod<_Tp>::value; + inline constexpr bool is_pod_v = __is_pod(_Tp); template _GLIBCXX17_DEPRECATED - inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; -#pragma GCC diagnostic pop + inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); template inline constexpr bool is_empty_v = __is_empty(_Tp); template @@ -3101,6 +3098,7 @@ template inline constexpr bool is_abstract_v = __is_abstract(_Tp); template inline constexpr bool is_final_v = __is_final(_Tp); + template inline constexpr bool is_signed_v = is_signed<_Tp>::value; template @@ -3183,9 +3181,11 @@ template template inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; + template - inline constexpr bool has_virtual_destructor_v = - has_virtual_destructor<_Tp>::value; + inline constexpr bool has_virtual_destructor_v + = __has_virtual_destructor(_Tp); + template inline constexpr size_t alignment_of_v = alignment_of<_Tp>::value; @@ -3212,7 +3212,9 @@ template inline constexpr bool is_same_v = __is_same(_Tp, _Up); #else template - inline constexpr bool is_same_v = std::is_same<_Tp, _Up>::value; + inline constexpr bool is_same_v = false; +template + inline constexpr bool is_same_v<_Tp, _Tp> = true; #endif template inline constexpr bool is_base_of_v = __is_base_of(_Base, _Derived);