From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id 0CCD93858C5F; Thu, 8 Feb 2024 10:20:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0CCD93858C5F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=gcc.gnu.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0CCD93858C5F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=205.220.165.146 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707387647; cv=none; b=sD0yKZ16YEFYb/0yCO3AXIYYuHZD32nSC8jsYC0eIGEhYshbh51nl4E8gRp76j+X1FKWBSj3lUeZOMdCGtPKZGjLLCJ6xGuXJMMwalFp9dKIafLUjluBcZvSUTrxDaAiTsSyY6uQLX0HcL0PjWxHyy2uU3LXD0hssPPvmOazjJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707387647; c=relaxed/simple; bh=JramHjVIkVYKGqlAmUt+mvVtz9Ncm7Sq+zr0v19enXk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=OOWyJDKxDlVufdQttwD3fpNp4x1kHhfcPQUWdyvNyVWbxwq+D88Jfap9OItKyxDkupuu62iSOzr4BTG2FMkqK3GU1j1V3Tovcf+IozlTaOg/MuWeeSOCW867ArgJfL8qbOqGtuYYS4CcuMAaHu9FhIYqmq5fihltKHunhcwE46c= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0247472.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 418AJVNS002047; Thu, 8 Feb 2024 10:20:45 GMT Received: from mxout25.s.uw.edu (mxout25.s.uw.edu [140.142.234.175]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3w4kvmahj9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Feb 2024 10:20:44 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout25.s.uw.edu (8.14.4+UW20.07/8.14.4+UW24.02) with ESMTP id 418AKJX4004765 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Feb 2024 02:20:19 -0800 X-Auth-Received: from kmatsui-ThinkPad-X1-Carbon-Gen-9.dhcp4.washington.edu ([10.154.74.143]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW24.02) with ESMTPSA id 418AKI9c004272 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 8 Feb 2024 02:20:18 -0800 X-UW-Orig-Sender: kmatsui@smtp.washington.edu From: Ken Matsui To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH] libstdc++: Use _GLIBCXX_USE_BUILTIN_TRAIT for is_same Date: Thu, 8 Feb 2024 02:20:11 -0800 Message-ID: <20240208102011.821339-1-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: O00wCIy76SeBCFJMfSGEtlHVciClOO8T X-Proofpoint-ORIG-GUID: O00wCIy76SeBCFJMfSGEtlHVciClOO8T X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-08_01,2024-02-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 mlxlogscore=949 priorityscore=1501 clxscore=1034 phishscore=0 impostorscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402080053 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,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 List-Id: Since is_same has a fallback native implementation, and _GLIBCXX_HAVE_BUILTIN_IS_SAME does not support toggling which implementation to use, we remove the _GLIBCXX_HAVE_BUILTIN_IS_SAME definition and use _GLIBCXX_USE_BUILTIN_TRAIT instead. libstdc++-v3/ChangeLog: * include/bits/c++config (_GLIBCXX_HAVE_BUILTIN_IS_SAME): Removed. * include/std/type_traits (is_same): Use _GLIBCXX_USE_BUILTIN_TRAIT instead of _GLIBCXX_HAVE_BUILTIN_IS_SAME. (is_same_v): Likewise. Signed-off-by: Ken Matsui --- libstdc++-v3/include/bits/c++config | 4 ---- libstdc++-v3/include/std/type_traits | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config index ad07ce92d5f..b57e3f338e9 100644 --- a/libstdc++-v3/include/bits/c++config +++ b/libstdc++-v3/include/bits/c++config @@ -845,10 +845,6 @@ namespace __gnu_cxx # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 #endif -#if _GLIBCXX_HAS_BUILTIN(__is_same) -# define _GLIBCXX_HAVE_BUILTIN_IS_SAME 1 -#endif - #if _GLIBCXX_HAS_BUILTIN(__builtin_launder) # define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 #endif diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index a9bb2806ca9..21402fd8c13 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -1470,16 +1470,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Type relations. /// is_same +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same) template struct is_same -#ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME : public __bool_constant<__is_same(_Tp, _Up)> + { }; #else + template + struct is_same : public false_type -#endif { }; -#ifndef _GLIBCXX_HAVE_BUILTIN_IS_SAME template struct is_same<_Tp, _Tp> : public true_type @@ -3496,7 +3497,7 @@ template template inline constexpr size_t extent_v<_Tp[], _Idx> = extent_v<_Tp, _Idx - 1>; -#ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME +#if _GLIBCXX_USE_BUILTIN_TRAIT(__is_same) template inline constexpr bool is_same_v = __is_same(_Tp, _Up); #else -- 2.43.0