From patchwork Thu Jul 13 01:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 119467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1530569vqm; Wed, 12 Jul 2023 18:46:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHY+I58XUX2XBRR+ZybmcQa2e2JTxP6wMT98C5FN5LEiXP8BzYddUBqzezZQ7jt6kfkBDE1 X-Received: by 2002:a05:651c:d6:b0:2b7:310:65da with SMTP id 22-20020a05651c00d600b002b7031065damr64660ljr.24.1689212795809; Wed, 12 Jul 2023 18:46:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689212795; cv=none; d=google.com; s=arc-20160816; b=ISy4/5ApnePgLH9M/4D1sPrh/+ILqyKMlaRtQLIAi6KlSWecaHZGFa84/UwDrfSyMi WoLgB5bylH5+62w9MrQpXwLVEubUsq91iWYHRH0R7LX3yxrJ/Dmjmab4Gf3BQKklu7J6 fTdsQXOc/wf0Q6ZqTGPMDOZe7FYmnzXUH4pOGewJess3Gy2eASiEt8yUx2vWlGNtcCOQ Z6/gsRR3s1IOXWEbnoIACb139eb79s4B1drXVL3mQsoqYCM4xzvEkGHcCb5B7473Q8Se xYXjr3zptCtwaCe8vz7NcYnm8oAWHSWEAykiHaoo4bmWkSoe8kOe//9azcjw+EDdNg4V v5Bg== 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:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=eWjAAZqIqkmtwYHumKYur5yTt+6Lg+HYF+9OD71YcMw=; fh=1CAabwJrK+ugngH18pg8mqZVlwzSJe6ffxxXK5OO7Vs=; b=A1ZEcmHVG5Kvhwg+2MVTVEehU+rc6YTxXpVU6wp9ffNgGsfE2D4S0wKCJ4Pas5AYxI 6zr6LLIFCdQowVOpDPFRKAJ+opvJ51QCpW+GZsP4mTmwfb2bOZl7gTjegi3xRF2z+Gxl 5lMOENlWCD8Rfq0IFoPKjHlnHs7S2pfQvaYi45/5+ZZPI1KhHofx84i5Q6npswJ73ehM tMrUgyquHaGQMT72aTezZ/FTQYTE6piQ27R256euhteMsfHAKRby7QHkXB6+7XFFTVsg QEteOo29s2zcWFLDADtCznE9tnVXMsfzUs6UHFYBJyDJi5k5+KQk4bNUbU1gXe40DTNO Bj6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=eUlTqv4g; 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id t5-20020a170906948500b00988c81e980dsi6282753ejx.1039.2023.07.12.18.46.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 18:46:35 -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=eUlTqv4g; 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 CCD32385B51F for ; Thu, 13 Jul 2023 01:45:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCD32385B51F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689212752; bh=eWjAAZqIqkmtwYHumKYur5yTt+6Lg+HYF+9OD71YcMw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=eUlTqv4grOBr+ZlvieqASz+B3E8aHmSjlj7S2+s/mhEgzE6TOhDnBMiDuE9poJUhq 5ZHw29N9ivwMW8WZlNms4NqFXH0jyF6FofHsarYiczgDdmFulIzBgc4yGq1XNwOOs2 NDFpvv/5GpDlW+Ar0pV1T0cKMicG3j7LUaK/jYcU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-00641c01.pphosted.com (mx0b-00641c01.pphosted.com [205.220.177.146]) by sourceware.org (Postfix) with ESMTPS id 691D33856DF1; Thu, 13 Jul 2023 01:45:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 691D33856DF1 Received: from pps.filterd (m0247478.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36D1Tl4V013357; Thu, 13 Jul 2023 01:45:03 GMT Received: from mxout21.s.uw.edu (mxout21.s.uw.edu [140.142.32.139]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rt1s8amxc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 01:45:02 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout21.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36D1idaO030028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jul 2023 18:44:39 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.234]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 36D1hqid021486 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 12 Jul 2023 18:44:39 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH v2 2/2] libstdc++: Use new built-in trait __is_signed Date: Wed, 12 Jul 2023 18:43:51 -0700 Message-ID: <20230713014351.6442-2-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713014351.6442-1-kmatsui@gcc.gnu.org> References: <20230713014351.6442-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: cwVHZ6SYtQTewo4TmGzxTSLPeaNVB1H_ X-Proofpoint-ORIG-GUID: cwVHZ6SYtQTewo4TmGzxTSLPeaNVB1H_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-12_17,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=926 impostorscore=0 clxscore=1034 spamscore=0 lowpriorityscore=0 adultscore=0 priorityscore=1501 phishscore=0 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307130014 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NEUTRAL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771267996424113647 X-GMAIL-MSGID: 1771267996424113647 This patch lets libstdc++ use new built-in trait __is_signed. libstdc++-v3/ChangeLog: * include/std/type_traits (is_signed): Use __is_signed built-in trait. (is_signed_v): Likewise. Signed-off-by: Ken Matsui --- libstdc++-v3/include/std/type_traits | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 0e7a9c9c7f3..23ab5a4b1e5 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -865,6 +865,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public __bool_constant<__is_abstract(_Tp)> { }; + /// is_signed +#if __has_builtin(__is_signed) + template + struct is_signed + : public __bool_constant<__is_signed(_Tp)> + { }; +#else /// @cond undocumented template::value> @@ -877,11 +884,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; /// @endcond - /// is_signed template struct is_signed : public __is_signed_helper<_Tp>::type { }; +#endif /// is_unsigned template @@ -3240,8 +3247,14 @@ template template inline constexpr bool is_final_v = __is_final(_Tp); +#if __has_builtin(__is_signed) +template + inline constexpr bool is_signed_v = __is_signed(_Tp); +#else template inline constexpr bool is_signed_v = is_signed<_Tp>::value; +#endif + template inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;