Message ID | 20240208102011.821339-1-kmatsui@gcc.gnu.org |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp68415dyd; Thu, 8 Feb 2024 02:21:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEObZswonnjLi1+iRQVUS6jiWr0BueFZ02oSdt2etlZS0ne642S4iD7uy1FfuiOZVntD+Nu X-Received: by 2002:a05:620a:46a5:b0:785:a61c:571 with SMTP id bq37-20020a05620a46a500b00785a61c0571mr2029865qkb.39.1707387709267; Thu, 08 Feb 2024 02:21:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707387709; cv=pass; d=google.com; s=arc-20160816; b=ix98/SqMU+wx+8l9q/jedHdwGc9EfbbeMMF0ZIbiP1ueCYzNvTwcNMp5Hhsxkylu/s lQ+39jA5JUcrEtW4d9Wrm9qJiPS4s+N0WpyU8Fq89xMX7YrOaXsY7786s418Lm1nGoVT rmChB5JP32WGTmADh/Zz+30QmNXRjOjUVs5hLd4TY3rpk5/6uk3g0xcV3P6UlCPK8Hkg MjK5NmXRzn0DyBuvLNzENG9GoeuXl5dzVQcu0iwZULBY706vMJXERsT5wreuaXpEawSY IuvzbpvDdwUL44qt9AiMvrAmBB0U9iDVpzmeqHyiRPcK2cbihTv2NSXqxjP1t1ZSYXpq RU9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=NBkcaBqf+u2vc8Dmw3+uMOTGhc3U/H5OMUP+Tc0MI+4=; fh=2Gtos3mrENu57ZAngiZGc/ehyQatnRt3VgPW844vTsk=; b=qk0oQ9207pFDZVgtb3YiswtTh6BIxr0/sndbIFEOIJsehNvrGcuTg45SN312pWg/DK vdNyTRwkh4jwNPtAbzPMhfAmqe68MCOABddWIl4xKkJPhdcZlO7aU/YYf0NKCASWN4Vk RyAmPMCh/yYlZajphD1hroT503DZAuWuFqMz58zT37Rdh/bO4C7JOR67VBgFC3W6Yu1Q diJ8O/XatrUbKFhacK2yMxz4rpUQlLUmMFQhpJe6RtlRnriKUSnsuCZU2Oqvwy1TErGX tt25G7xqbybcBHrMju4Z9ssMlGzfKu4xSg5xEHjptal0DXGoCEP1JQ+EsjfLF7OnAR+G lCqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=tq8Fjkud; arc=pass (i=1); 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 X-Forwarded-Encrypted: i=2; AJvYcCXFAwL0FZxLtAzSFz5VTq5B/lLW2VlHNWzuzvjIPKFDpTJLmUpqNGzjb5QBwRA+gnLNvjtazeVLQDF3drdVNlb0pkXgSQ== Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id t6-20020a05620a004600b00783ab5f86adsi2885301qkt.265.2024.02.08.02.21.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 02:21:49 -0800 (PST) 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=tq8Fjkud; arc=pass (i=1); 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 BE9D9385841F for <ouuuleilei@gmail.com>; Thu, 8 Feb 2024 10:21:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BE9D9385841F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707387708; bh=NBkcaBqf+u2vc8Dmw3+uMOTGhc3U/H5OMUP+Tc0MI+4=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=tq8FjkudFa8oyeNd8yNACf4x/5nHSSKaYrnfbj3+EONar0tIdEzxRmkzg7E3WarOD wQcNVcVWbJDFrOPwT7WHGQa8xR4xSJB0N+IvLW2uoNfBByiIKXzjQ3/v3bEEbmrmfl e6LpgGFkjdAF4ZX2zfL6wT5+tEiPM8SJwAjY2+z0= 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 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 <kmatsui@gcc.gnu.org> To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui <kmatsui@gcc.gnu.org> 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790325774807530591 X-GMAIL-MSGID: 1790325774807530591 |
Series |
libstdc++: Use _GLIBCXX_USE_BUILTIN_TRAIT for is_same
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Ken Matsui
Feb. 8, 2024, 10:20 a.m. UTC
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 <kmatsui@gcc.gnu.org>
---
libstdc++-v3/include/bits/c++config | 4 ----
libstdc++-v3/include/std/type_traits | 9 +++++----
2 files changed, 5 insertions(+), 8 deletions(-)
Comments
On Thu, 8 Feb 2024, Ken Matsui wrote: > 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. LGTM > > Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org> > --- > 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<typename _Tp, typename _Up> > struct is_same > -#ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME > : public __bool_constant<__is_same(_Tp, _Up)> > + { }; > #else > + template<typename _Tp, typename _Up> > + struct is_same > : public false_type > -#endif > { }; > > -#ifndef _GLIBCXX_HAVE_BUILTIN_IS_SAME > template<typename _Tp> > struct is_same<_Tp, _Tp> > : public true_type > @@ -3496,7 +3497,7 @@ template <typename _Tp> > template <typename _Tp, unsigned _Idx> > 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 <typename _Tp, typename _Up> > inline constexpr bool is_same_v = __is_same(_Tp, _Up); > #else > -- > 2.43.0 > >
On Fri, 9 Feb 2024 at 16:02, Patrick Palka <ppalka@redhat.com> wrote: > On Thu, 8 Feb 2024, Ken Matsui wrote: > > > 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. > > LGTM > Me too, OK for trunk, thanks. +Reviewed-by: Jonathan Wakely <jwakely@redhat.com> > > > > > Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org> > > --- > > 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<typename _Tp, typename _Up> > > struct is_same > > -#ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME > > : public __bool_constant<__is_same(_Tp, _Up)> > > + { }; > > #else > > + template<typename _Tp, typename _Up> > > + struct is_same > > : public false_type > > -#endif > > { }; > > > > -#ifndef _GLIBCXX_HAVE_BUILTIN_IS_SAME > > template<typename _Tp> > > struct is_same<_Tp, _Tp> > > : public true_type > > @@ -3496,7 +3497,7 @@ template <typename _Tp> > > template <typename _Tp, unsigned _Idx> > > 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 <typename _Tp, typename _Up> > > inline constexpr bool is_same_v = __is_same(_Tp, _Up); > > #else > > -- > > 2.43.0 > > > > > >
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<typename _Tp, typename _Up> struct is_same -#ifdef _GLIBCXX_HAVE_BUILTIN_IS_SAME : public __bool_constant<__is_same(_Tp, _Up)> + { }; #else + template<typename _Tp, typename _Up> + struct is_same : public false_type -#endif { }; -#ifndef _GLIBCXX_HAVE_BUILTIN_IS_SAME template<typename _Tp> struct is_same<_Tp, _Tp> : public true_type @@ -3496,7 +3497,7 @@ template <typename _Tp> template <typename _Tp, unsigned _Idx> 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 <typename _Tp, typename _Up> inline constexpr bool is_same_v = __is_same(_Tp, _Up); #else