From patchwork Tue Jul 18 22:32:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 122280 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2050292vqt; Tue, 18 Jul 2023 15:33:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlEi3T4Vu8mq+eunRxJWqv9q2fTrVZciQl3Bd/C+sghyzyaqMmZkkKF5Nc6pMm1U0hk2FSEI X-Received: by 2002:aa7:c2da:0:b0:51d:d4c3:6858 with SMTP id m26-20020aa7c2da000000b0051dd4c36858mr989758edp.12.1689719627726; Tue, 18 Jul 2023 15:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689719627; cv=none; d=google.com; s=arc-20160816; b=OjvcLnDRGm52GRCbaY8s6TCapLiSGCX/ScgvaHfsoBCXFQCB1DUriv3LVkNyfn9Mqt myBoCBOl/dC6gvJDOUDdAvM5dEinRJOCkq6JSdCWdQqIXHlDDnUevoALFmsk04f0AdfN bS5G6llTZYPFt8g/cM1Ho8+9dAsvsg8mbphQ3vkFeOt0q3JFC4uFAfnPNTygU2sQTapU WbNatbbk92500o4W1f120EsRd8j2HPS4cwH3HuSUB7AJT3EjACP4NN5LqYTgPcpfQhAj xGk4zDcchK5cW7dlkyrXedKW5su0vqOZsnPxsqV2P3yU352hln3sAHcEGPsw58ygc531 f6pg== 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:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=m6ALpq0Hl9uGPWqOB+JVvEHsvvG9CEejYYCOaDpnbvI=; fh=1CAabwJrK+ugngH18pg8mqZVlwzSJe6ffxxXK5OO7Vs=; b=Ic21hg3oYSkWNdepnCI1MIc5GPjbdVnMzRnJlBkQqDOFU+Z4TQr3EWCA7LDZppwuSW JOs26qIgxC+FMDwgIr8J9q7ne9/8o81QmaX4IDeL3UVWiZVVaSzVnkrZe9ViIAXaDFzb UgJ1U/XCoU0LVvd/LKwCk2tiDvMK0bKTc1+y1BBLj5JzpFqut8I/xu80oerJt4hy6pze NubjFpe3hvLHBi/ae6WBpzwn3MHdIs/uuTN7VH4mETdrMAqohSEmfsJNg6e3Z5HZMV9i KeRo6c2n7ATeV45i0oceX1r0PWY/A40O0ufE7o3UVnVGj/KnzB2sRpVKRoRGgz0WCioK +BfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="Ps/Z2KB7"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id l18-20020aa7d952000000b0051df37248afsi1952365eds.323.2023.07.18.15.33.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 15:33:47 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="Ps/Z2KB7"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 D7F303856243 for ; Tue, 18 Jul 2023 22:33:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7F303856243 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689719612; bh=m6ALpq0Hl9uGPWqOB+JVvEHsvvG9CEejYYCOaDpnbvI=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Ps/Z2KB7TSUiw+Jjf5DYAEF6Mr1gpYSnnzvMdlBynWgvm/LyQpQkO3D5yMiPtSJHZ 5o9m7gGlZcQO4TyS2qV4gQGWpOfqNVTzBpbs2BQX/Zcm71wvgnSBzsD0KdFXQApRoP QW1ECaTLMCfdCI18M5jwrmL6chjaCTEi/IPBiZb0= 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 4EF8B3858D32; Tue, 18 Jul 2023 22:32:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4EF8B3858D32 Received: from pps.filterd (m0247473.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36IMMEgS023722; Tue, 18 Jul 2023 22:32:45 GMT Received: from mxout23.cac.washington.edu (mxout23.cac.washington.edu [140.142.32.140]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rwwtnu30y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Jul 2023 22:32:45 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout23.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36IMWglo021747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Jul 2023 15:32:42 -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 36IMWfFw000639 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Jul 2023 15:32:42 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH] libstdc++: Define _GLIBCXX_HAS_BUILTIN_TRAIT Date: Tue, 18 Jul 2023 15:32:33 -0700 Message-ID: <20230718223233.15328-1-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Proofpoint-GUID: dlUUYSIe1tAKwPlIOy5W_xN_F0vcwrWu X-Proofpoint-ORIG-GUID: dlUUYSIe1tAKwPlIOy5W_xN_F0vcwrWu 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-18_17,2023-07-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 phishscore=0 impostorscore=0 bulkscore=0 spamscore=0 malwarescore=0 priorityscore=1501 clxscore=1034 adultscore=0 mlxlogscore=754 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307180201 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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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: 1771799448218945195 X-GMAIL-MSGID: 1771799448218945195 This patch defines _GLIBCXX_HAS_BUILTIN_TRAIT, which will be used as a flag to toggle built-in traits in the type_traits header. Through this macro function and _GLIBCXX_NO_BUILTIN_TRAITS macro, we can switch the use of built-in traits without needing to modify the source code. libstdc++-v3/ChangeLog: * include/bits/c++config (_GLIBCXX_HAS_BUILTIN_TRAIT): Define. Signed-off-by: Ken Matsui --- libstdc++-v3/include/bits/c++config | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index dd47f274d5f..de13f61db71 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -854,7 +854,11 @@ namespace __gnu_cxx # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 #endif -#undef _GLIBCXX_HAS_BUILTIN +// Returns true if _GLIBCXX_NO_BUILTIN_TRAITS is not defined and the compiler +// has a corresponding built-in type trait. _GLIBCXX_NO_BUILTIN_TRAITS is +// defined to disable the use of built-in traits. +#define _GLIBCXX_HAS_BUILTIN_TRAIT(BT) \ + (!defined(_GLIBCXX_NO_BUILTIN_TRAITS) && _GLIBCXX_HAS_BUILTIN(BT)) // Mark code that should be ignored by the compiler, but seen by Doxygen. #define _GLIBCXX_DOXYGEN_ONLY(X)