From patchwork Sat Jun 24 13:53:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 112464 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6411108vqr; Sat, 24 Jun 2023 06:55:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5a2/Zr6rwpHniFZlFyhCPNNXVArDDY7l+ZCeNnsHgXwDkShnNl35vQfk91LSVoIMBgMsol X-Received: by 2002:a2e:918b:0:b0:2b5:68ad:291c with SMTP id f11-20020a2e918b000000b002b568ad291cmr8875080ljg.26.1687614959520; Sat, 24 Jun 2023 06:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687614959; cv=none; d=google.com; s=arc-20160816; b=WAhwcWefU23hc5wLcLmXaxu1dUoNaBXHSyFM7B7TSomfPPJq5dGBv4czdK4abpLDf1 33jhoA438r9kuYDTqI/YX7P+ZoeyZ7l0zJ7FWc+M7m17l5XKAjx2yPaaQjbFHxB7Ggfm /SgI+tb3B1BznZfHq+n8o/2ZFFhIKfbtdZA+REEr3gxGUleJxMoDTqw9dhWQFiaoEBrn JimQRZBvmaQJPs50EOcWaXMCH2DN8/jvusHx2lSIBIi157JNRlBgpNJkJUib3txVGe0M 0Wx3XMlffiNYWzYnD4iam41QBwM5RFTJMC70ARb0t56UDlQFJeO7QfSakMyudpHAibcW Au4Q== 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=r4/GnDOX9w5wZG1xbcjpXoLL8IExUI3gy2n2QSI+gas=; fh=ox+DVjjAr7YURR6UvGsFmi3AQ1YcSFrZcspu5PnHEIc=; b=orsTTI4jCZPbsd0hRxhmZQiQdh9s473zO5jNfymy+mkhaQWVvsbZDYxOdtJecgqlJO 44i9hM4pIybxJ7G4Jw+lJkfAxMUzSIlGid006yCXNkVV+p0o263/bNxi4SXiu+IgcoZq N5vB2qKBEtfofVTQ8ibZR1ENgIWkfW7lGD1z8ttowj8j5be4j2nySr/peUFTF8zOSnau gFFWSOvJe6p2BwCLBANF9i/PvNfD42tcXGR7gzJbzELoL4rJr/F96uHXoHRc/xiagMog Wk1F1C3bXycGaMIjMH9e74jSOtGVjN63jUe9dvjNaXXCFuaP7bh1lpyMc4OGamB5PuDV xx/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=DBDh1TLT; 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 l3-20020a056402124300b0051bfc800e4fsi610911edw.26.2023.06.24.06.55.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jun 2023 06:55:59 -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=DBDh1TLT; 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 3A88D3858281 for ; Sat, 24 Jun 2023 13:55:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A88D3858281 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687614958; bh=r4/GnDOX9w5wZG1xbcjpXoLL8IExUI3gy2n2QSI+gas=; 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=DBDh1TLTnamAeJ0/lTNWeZ5X0lvNLEe0cdqO0iJ73T3cP3/LAp81q56iFvM7qUwVt OeYSZAu07y7pD20xsxYL/SXTPr3UjdKSyzhEZ9OQx605L5lktfrf+iq/m1XCALpmfJ FV/R1Ry2Ihav9euYmwJNS8PhePIV2nqVJqnaI4es= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id 407383858284; Sat, 24 Jun 2023 13:55:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 407383858284 Received: from pps.filterd (m0247474.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35ODpPT8015050; Sat, 24 Jun 2023 13:55:15 GMT Received: from mxout21.s.uw.edu (mxout21.s.uw.edu [140.142.32.139]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rdqu51nxh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 24 Jun 2023 13:55:15 +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 35ODswkH027724 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Jun 2023 06:54:58 -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 35ODrqYg017671 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 24 Jun 2023 06:54:57 -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_array Date: Sat, 24 Jun 2023 06:53:48 -0700 Message-ID: <20230624135348.74428-2-kmatsui@cs.washington.edu> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230624135348.74428-1-kmatsui@cs.washington.edu> References: <20230321223957.7176-1-kmatsui@cs.washington.edu> <20230624135348.74428-1-kmatsui@cs.washington.edu> MIME-Version: 1.0 X-Proofpoint-GUID: WjpQyCilkeyQ7HD9eUJHqlaalIu56qFW X-Proofpoint-ORIG-GUID: WjpQyCilkeyQ7HD9eUJHqlaalIu56qFW 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-06-24_10,2023-06-22_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 adultscore=0 mlxscore=0 lowpriorityscore=0 priorityscore=1501 phishscore=0 mlxlogscore=731 bulkscore=0 malwarescore=0 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306240131 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761019005850603344?= X-GMAIL-MSGID: =?utf-8?q?1769592543366251964?= This patch lets libstdc++ use new built-in trait __is_array. libstdc++-v3/ChangeLog: * include/std/type_traits (is_array): Use __is_array built-in trait. (is_array_v): Likewise. Signed-off-by: Ken Matsui --- libstdc++-v3/include/std/type_traits | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 0e7a9c9c7f3..f2a3a327e7d 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -503,6 +503,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; /// is_array +#if __has_builtin(__is_array) + template + struct is_array + : public __bool_constant<__is_array(_Tp)> + { }; +#else template struct is_array : public false_type { }; @@ -514,6 +520,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct is_array<_Tp[]> : public true_type { }; +#endif template struct __is_pointer_helper @@ -3161,12 +3168,17 @@ template template inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; +#if __has_builtin(__is_array) +template + inline constexpr bool is_array_v = __is_array(_Tp); +#else template inline constexpr bool is_array_v = false; template inline constexpr bool is_array_v<_Tp[]> = true; template inline constexpr bool is_array_v<_Tp[_Num]> = true; +#endif template inline constexpr bool is_pointer_v = is_pointer<_Tp>::value;