From patchwork Fri Jul 28 03:57:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 127307 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp177356vqg; Thu, 27 Jul 2023 21:00:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlESRa4VuychFS3m1nOadCb1aQ2LV8VLN4Vdm6nxZtZHc6WygvAgc70lNptlywbCBTVTWuyb X-Received: by 2002:a2e:9316:0:b0:2b6:f009:d1b with SMTP id e22-20020a2e9316000000b002b6f0090d1bmr631770ljh.49.1690516800696; Thu, 27 Jul 2023 21:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690516800; cv=none; d=google.com; s=arc-20160816; b=fYKeKfz/Pvfbc+4RQsWXja6/EsktScv4TfjLLMlR9sYGHL08YZQJcCj1CE0ie+s6CG j1cicZlGY/wMPEGLjYflYqpTYgOEWdiqGnPKCvJJ4QASNGVEhZmayjSvc+d0tkMz65C8 C81k8jU+BAXMQURSMmm2Ee1BDlV90u2mhMD9DGLZ/CnXaMZLnjdoNyPKrv96KBaDj3uX Q2bCm8PGSgDWUWRhUQ1GaTcXQsD84fV7dY2M7ThpG+YajMkUrxEc41AXdY3TWXG3mgwK bRh1DNm9Pz2JZ7Gm9WX0LPCyGmcrpp5vby+IaRrk+wEZ8bRLuHpmx7cZwHgp1g/wo7t1 9q5g== 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=eczPtEPS/vKyL7ARcMhfhnMpNERlxhezZ4Av5vrT04Q=; fh=1CAabwJrK+ugngH18pg8mqZVlwzSJe6ffxxXK5OO7Vs=; b=u4SbAiBnngauMW4XFhsZ3mdewyApIQ5Kt41LZHJKYMCaEefk9s89gXiOJvPFquCV5Y WyVzyZwdxeItPR/LCkLbQnlZ7n5/Or7S/JKSEP+vsW5H4Cler0LqLzl3SPU0zDD+M38u W4K4i2ggI+2vgIiLJhgFvjW7+uXA6FHTA1+3hCeGJBrpThahZ7sRpQn0yBXJZo6h8xIK u/tEJdOJ2JPmDN/IrJkw91+Q1zv3F/Dd4Nc2rrOJFDoDwJXZzUWSVMDpq/iA/2P2HR/t OgR0xaeC4Nwyf8x7GUlbjUvQ4CzrvK4rKu6tRHVkRn240u0WOgY6Oqc1cJ5SjTvU8bXf nR/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="Y/JrxdMw"; 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 f11-20020a056402068b00b0051a59d81c45si1874260edy.18.2023.07.27.21.00.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 21:00:00 -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="Y/JrxdMw"; 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 86628385AF89 for ; Fri, 28 Jul 2023 03:59:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 86628385AF89 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690516799; bh=eczPtEPS/vKyL7ARcMhfhnMpNERlxhezZ4Av5vrT04Q=; 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=Y/JrxdMwD4XTBRPkcgwO96rAfyAVIGtP3LchXezpNt2ZWLJV7gIqh925GIHYajRg/ 1ek1+m/FbTPtCBxjegcbdBAGTspqbdTciJaDEOamoNSQAgP7p6O+X8lrs6awvG59eO ToIDVJ6rfG7L2crJL6OeC28jSgJCBwW35HcT6lzs= 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 E335B385C414; Fri, 28 Jul 2023 03:58:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E335B385C414 Received: from pps.filterd (m0247480.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36S3mNgF021921; Fri, 28 Jul 2023 03:58:35 GMT Received: from mxout23.cac.washington.edu (mxout23.cac.washington.edu [140.142.32.140]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3s3bv91875-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 28 Jul 2023 03:58:35 +0000 Received: from smtp.washington.edu (smtp.washington.edu [140.142.234.157]) by mxout23.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36S3wRqa030006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jul 2023 20:58:27 -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 36S3vf8m009739 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 27 Jul 2023 20:58:27 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH v3 2/2] libstdc++: Use _GLIBCXX_HAS_BUILTIN_TRAIT Date: Thu, 27 Jul 2023 20:57:36 -0700 Message-ID: <20230728035737.50181-2-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230728035737.50181-1-kmatsui@gcc.gnu.org> References: <20230719193242.59472-1-kmatsui@gcc.gnu.org> <20230728035737.50181-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: on8MQBb3H4wzboe9Du1KXzJz8AQxsNFz X-Proofpoint-ORIG-GUID: on8MQBb3H4wzboe9Du1KXzJz8AQxsNFz 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-27_10,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1034 priorityscore=1501 impostorscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 suspectscore=0 phishscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307280036 X-Spam-Status: No, score=-13.3 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: 1772635344964811922 X-GMAIL-MSGID: 1772635344964811922 This patch uses _GLIBCXX_HAS_BUILTIN_TRAIT macro instead of __has_builtin in the type_traits header. This macro supports to toggle the use of built-in traits in the type_traits header through _GLIBCXX_NO_BUILTIN_TRAITS macro, without needing to modify the source code. libstdc++-v3/ChangeLog: * include/std/type_traits (__has_builtin): Replace with ... (_GLIBCXX_HAS_BUILTIN): ... this. Signed-off-by: Ken Matsui --- libstdc++-v3/include/std/type_traits | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 9f086992ebc..12423361b6e 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1411,7 +1411,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public __bool_constant<__is_base_of(_Base, _Derived)> { }; -#if __has_builtin(__is_convertible) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__is_convertible) template struct is_convertible : public __bool_constant<__is_convertible(_From, _To)> @@ -1462,7 +1462,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 202002L #define __cpp_lib_is_nothrow_convertible 201806L -#if __has_builtin(__is_nothrow_convertible) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__is_nothrow_convertible) /// is_nothrow_convertible_v template inline constexpr bool is_nothrow_convertible_v @@ -1537,7 +1537,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { using type = _Tp; }; /// remove_cv -#if __has_builtin(__remove_cv) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__remove_cv) template struct remove_cv { using type = __remove_cv(_Tp); }; @@ -1606,7 +1606,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Reference transformations. /// remove_reference -#if __has_builtin(__remove_reference) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__remove_reference) template struct remove_reference { using type = __remove_reference(_Tp); }; @@ -2963,7 +2963,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template(_S_get())), typename = decltype(_S_conv<_Tp>(_S_get())), -#if __has_builtin(__reference_converts_from_temporary) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__reference_converts_from_temporary) bool _Dangle = __reference_converts_from_temporary(_Tp, _Res_t) #else bool _Dangle = false @@ -3420,7 +3420,7 @@ template */ #define __cpp_lib_remove_cvref 201711L -#if __has_builtin(__remove_cvref) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__remove_cvref) template struct remove_cvref { using type = __remove_cvref(_Tp); }; @@ -3515,7 +3515,7 @@ template : public bool_constant> { }; -#if __has_builtin(__is_layout_compatible) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__is_layout_compatible) /// @since C++20 template @@ -3529,7 +3529,7 @@ template constexpr bool is_layout_compatible_v = __is_layout_compatible(_Tp, _Up); -#if __has_builtin(__builtin_is_corresponding_member) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__builtin_is_corresponding_member) #define __cpp_lib_is_layout_compatible 201907L /// @since C++20 @@ -3540,7 +3540,7 @@ template #endif #endif -#if __has_builtin(__is_pointer_interconvertible_base_of) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__is_pointer_interconvertible_base_of) /// True if `_Derived` is standard-layout and has a base class of type `_Base` /// @since C++20 template @@ -3554,7 +3554,7 @@ template constexpr bool is_pointer_interconvertible_base_of_v = __is_pointer_interconvertible_base_of(_Base, _Derived); -#if __has_builtin(__builtin_is_pointer_interconvertible_with_class) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__builtin_is_pointer_interconvertible_with_class) #define __cpp_lib_is_pointer_interconvertible 201907L /// True if `__mp` points to the first member of a standard-layout type @@ -3590,8 +3590,8 @@ template template inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value; -#if __has_builtin(__reference_constructs_from_temporary) \ - && __has_builtin(__reference_converts_from_temporary) +#if _GLIBCXX_HAS_BUILTIN_TRAIT(__reference_constructs_from_temporary) \ + && _GLIBCXX_HAS_BUILTIN_TRAIT(__reference_converts_from_temporary) #define __cpp_lib_reference_from_temporary 202202L @@ -3632,7 +3632,7 @@ template template inline constexpr bool reference_converts_from_temporary_v = reference_converts_from_temporary<_Tp, _Up>::value; -#endif // __has_builtin for reference_from_temporary +#endif // _GLIBCXX_HAS_BUILTIN_TRAIT for reference_from_temporary #endif // C++23 #if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED