From patchwork Wed Mar 22 23:41: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: 73697 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2629812wrt; Wed, 22 Mar 2023 16:42:54 -0700 (PDT) X-Google-Smtp-Source: AK7set+djXnzmXu+KCP4mKJlh+CsAdBtMMskXaRSMo2YP0yOl3yjoCAsN/zPEvokUpZoUEtx6+QX X-Received: by 2002:a05:6402:344d:b0:4fc:d331:515 with SMTP id l13-20020a056402344d00b004fcd3310515mr4190089edc.5.1679528573886; Wed, 22 Mar 2023 16:42:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679528573; cv=none; d=google.com; s=arc-20160816; b=JoynzgeG8Tknbb0yHtuXayyFRrF/N6H6/pNKUXWG305NxaWjmM94+T5KTxGttaRRw3 bDlpRLKucRMhCZ7bH4EwPzv/QjZLkFyjAl915VI2egzz7tJ8II6HQga/HA9vMZNEKpoz asxlNV3r4eoyvRSYRkdbPzkPYXwvtxcxOor7XCOEPhagPgZJa4z5d4inK5WLfr1+mEkQ oDSnPmIM3ZsH8ntv8VX8NEuUF7LfQdLyiTWNdxSRwTHmwNacics8FEvav3FkvAueHGKt hPPBwC3pXxDnxKr0HY2aU2efpD78HUF/xTsNHQEtr/893aqNXvV0IyRps6iIBbge6gus mYnA== 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=e4OzID+k3nejhCPePKmNTePyjAlfNY33Kp9VNbLcwys=; b=ERXG3b2bWqiRkXEe34gcZtbVY1UTSNHelXUjG7GHgJLycsiqdbTDVsAv6lFVYBcGA7 RoYSBWBzu+t2AN5y7wXTpDKCM8/FgSjErBIq+yh/DH51INQwyI50zMcXaHd9ZKhBheXq SBNeTJfvapi1a8PuJwYe5brUI0/TNcb2W1GATalArf8n5ZJndlYRUyLnL4mRpxiznOb2 9l686JbIuXWeK+n69Xy6Z3MH2Er8yrh3cOGXevN459vxF3neVLJ3v80SLeabV+WeBW5t PjjveuD0bLoaVO70NLMiFdnexUy+tdenBoJpwQRJsuP3YEBQNsup7pAkU880vLyYoH3i OOGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Qczc2Txd; 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 sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s25-20020aa7c559000000b004acbf5579casi18184197edr.472.2023.03.22.16.42.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 16:42:53 -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=Qczc2Txd; 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 7129D384F000 for ; Wed, 22 Mar 2023 23:42:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7129D384F000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679528555; bh=e4OzID+k3nejhCPePKmNTePyjAlfNY33Kp9VNbLcwys=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Qczc2Txd/ANjaDYUo1mQqOdeQO8TQOvYGQdPTlxI5yQeL9aKhdFmEVnqAq4fTm9ZM LFN5h1+FTc7BwHW+e07OnIKhHAPlm/AKDbC9w5+eEACWnjXxB7aDsWegnNBIfxCs1t zEe0iNzoiyRJJMyutTmdaSsJvvAi36PjfkAlcYzk= 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 9A9583858436; Wed, 22 Mar 2023 23:41:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9A9583858436 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 32MNe2Aq024625; Wed, 22 Mar 2023 23:41:49 GMT Received: from mxout22.s.uw.edu (mxout22.s.uw.edu [128.95.242.222]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3pg88chk98-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Mar 2023 23:41:49 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.132]) by mxout22.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 32MNfdaQ000885 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Mar 2023 16:41:39 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.245]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 32MNfdjq023734 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 22 Mar 2023 16:41:39 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH 1/2] c++: implement __is_volatile built-in trait Date: Wed, 22 Mar 2023 16:41:33 -0700 Message-Id: <20230322234134.14578-1-kmatsui@cs.washington.edu> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: yGJGJYgqEY3wx9pk5uB1UtPY2dtb-U5_ X-Proofpoint-GUID: yGJGJYgqEY3wx9pk5uB1UtPY2dtb-U5_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-22_18,2023-03-22_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 phishscore=0 mlxlogscore=959 clxscore=1015 malwarescore=0 priorityscore=1501 impostorscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303220172 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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?1761113353732621821?= X-GMAIL-MSGID: =?utf-8?q?1761113353732621821?= This patch implements built-in trait for std::is_volatile. gcc/cp/ChangeLog: * cp-trait.def: Define __is_volatile. * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_VOLATILE. * semantics.cc (trait_expr_value): Likewise. (finish_trait_expr): Likewise. gcc/testsuite/ChangeLog: * g++.dg/ext/has-builtin-1.C: Test existence of __is_volatile. * g++.dg/ext/is_volatile.C: New test. --- gcc/cp/constraint.cc | 3 +++ gcc/cp/cp-trait.def | 1 + gcc/cp/semantics.cc | 4 ++++ gcc/testsuite/g++.dg/ext/has-builtin-1.C | 3 +++ gcc/testsuite/g++.dg/ext/is_volatile.C | 19 +++++++++++++++++++ 5 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/is_volatile.C diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 273d15ab097..1da8e8a9780 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -3747,6 +3747,9 @@ diagnose_trait_expr (tree expr, tree args) case CPTK_IS_UNION: inform (loc, " %qT is not a union", t1); break; + case CPTK_IS_VOLATILE: + inform (loc, " %qT is not a volatile type", t1); + break; case CPTK_IS_AGGREGATE: inform (loc, " %qT is not an aggregate", t1); break; diff --git a/gcc/cp/cp-trait.def b/gcc/cp/cp-trait.def index bac593c0094..b89b82bb26b 100644 --- a/gcc/cp/cp-trait.def +++ b/gcc/cp/cp-trait.def @@ -82,6 +82,7 @@ DEFTRAIT_EXPR (IS_TRIVIALLY_ASSIGNABLE, "__is_trivially_assignable", 2) DEFTRAIT_EXPR (IS_TRIVIALLY_CONSTRUCTIBLE, "__is_trivially_constructible", -1) DEFTRAIT_EXPR (IS_TRIVIALLY_COPYABLE, "__is_trivially_copyable", 1) DEFTRAIT_EXPR (IS_UNION, "__is_union", 1) +DEFTRAIT_EXPR (IS_VOLATILE, "__is_volatile", 1) DEFTRAIT_EXPR (REF_CONSTRUCTS_FROM_TEMPORARY, "__reference_constructs_from_temporary", 2) DEFTRAIT_EXPR (REF_CONVERTS_FROM_TEMPORARY, "__reference_converts_from_temporary", 2) /* FIXME Added space to avoid direct usage in GCC 13. */ diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc index 99a76e3ed65..70ea0e83abb 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -11993,6 +11993,9 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2) case CPTK_IS_ENUM: return type_code1 == ENUMERAL_TYPE; + case CPTK_IS_VOLATILE: + return CP_TYPE_VOLATILE_P (type1); + case CPTK_IS_FINAL: return CLASS_TYPE_P (type1) && CLASSTYPE_FINAL (type1); @@ -12201,6 +12204,7 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2) case CPTK_IS_ENUM: case CPTK_IS_UNION: case CPTK_IS_SAME: + case CPTK_IS_VOLATILE: break; case CPTK_IS_LAYOUT_COMPATIBLE: diff --git a/gcc/testsuite/g++.dg/ext/has-builtin-1.C b/gcc/testsuite/g++.dg/ext/has-builtin-1.C index f343e153e56..7ad640f141b 100644 --- a/gcc/testsuite/g++.dg/ext/has-builtin-1.C +++ b/gcc/testsuite/g++.dg/ext/has-builtin-1.C @@ -146,3 +146,6 @@ #if !__has_builtin (__remove_cvref) # error "__has_builtin (__remove_cvref) failed" #endif +#if !__has_builtin (__is_volatile) +# error "__has_builtin (__is_volatile) failed" +#endif diff --git a/gcc/testsuite/g++.dg/ext/is_volatile.C b/gcc/testsuite/g++.dg/ext/is_volatile.C new file mode 100644 index 00000000000..004e397e5e7 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/is_volatile.C @@ -0,0 +1,19 @@ +// { dg-do compile { target c++11 } } + +#include + +using namespace __gnu_test; + +#define SA(X) static_assert((X),#X) + +// Positive tests. +SA(__is_volatile(volatile int)); +SA(__is_volatile(const volatile int)); +SA(__is_volatile(vClassType)); +SA(__is_volatile(cvClassType)); + +// Negative tests. +SA(!__is_volatile(int)); +SA(!__is_volatile(const int)); +SA(!__is_volatile(ClassType)); +SA(!__is_volatile(cClassType)); From patchwork Wed Mar 22 23:41:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 73698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2630143wrt; Wed, 22 Mar 2023 16:43:52 -0700 (PDT) X-Google-Smtp-Source: AK7set/VZ3ei93l9W7ZlC05c63h8H59g8dh9lDNZwz8hTao6+/zNLZ10As3HytAsEifEOQ+EL8BO X-Received: by 2002:a17:906:9493:b0:870:b950:18d4 with SMTP id t19-20020a170906949300b00870b95018d4mr9420815ejx.5.1679528631918; Wed, 22 Mar 2023 16:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679528631; cv=none; d=google.com; s=arc-20160816; b=qkEkqYNDtVboLxyIbEyKtwF+XTxk1xzpxnfzU2m017MSjGYhSe5NB28NlmR8gSA4Le C9F0AJ0HAZTTwu9IoQsMRAfjfbQAecwVINqyzgI1LikAWyM+SRQXyDYlIwPvGeawr2cS DlU4ueIqcJvPMbZ3Ior5qE5KSaEd8K15oqqFkqkj7Vz+FuADw5KfFhCZq4Tnz68YwP/s +TE+XWXHVpI9IQ2r1anzI3/QRfUf4HC8v6zN+sss8T+PSSVkly/8PoXAVs4owyoUnHGZ VkLTM1AdswaGDpxFBA7igNyMqLfr/oUfvbi/+xRKG2C2FTPMnYg+73Qpqs3BWcQruang PBYA== 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=tCeOe9zhcSE9FXYm8nn+WKMComZ8EozdPamCSvkca90=; b=V3Z1AHGXjQLkgEONZa5gK42xI0XJqeo2IypsiGzevqcavcDpXqWQzW6pXIcQDG4BW8 cfIfc+zu/VLka6lFlCQyNYVqN1EeO+TQ04OJVQHFsvnClFIcF9JwVLBdQgtU99ZUu2ta RRoy+aF69yh1EwlRvyZ68rJsdlKk/XeB5hDyDGVQ7tgxT1gacw32NBGkSDMRe9VDhX79 ihNlcfxIo7u8xxORPUZ8zJf1xHZaKiBQ8M2pf2cWQkJ0jXIRF9/xSy5skmhDbArtz2CK 0wrvHoc9UnzsQtIrDGqAWDaY/b/WvGdK8IM2IMWpc3ROpWYvNecn6MwwEs124Trv44LH HzJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=emM0VMzq; 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 sk19-20020a170906631300b00939e87fcf99si5437736ejc.417.2023.03.22.16.43.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 16:43:51 -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=emM0VMzq; 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 63898384D148 for ; Wed, 22 Mar 2023 23:43:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63898384D148 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679528594; bh=tCeOe9zhcSE9FXYm8nn+WKMComZ8EozdPamCSvkca90=; 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=emM0VMzq0J6l1r1oCNupMjC0HsZBAYbPBV4quBGqW3hJhitEmZzzv1gwQGpHgsAly SfE8PKM31MIKT0veKi39ElOElmWmj9f2CPyD7t61yIl2hyEneP4gx39QnZfoX42iKE plAVJS/hZEgE9sJIo7KBb66oU+UawNoFSC/rpFww= 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 6ECA7385021F; Wed, 22 Mar 2023 23:42:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6ECA7385021F Received: from pps.filterd (m0247471.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32MNamix007168; Wed, 22 Mar 2023 23:42:29 GMT Received: from mxout25.s.uw.edu (mxout25.s.uw.edu [140.142.234.175]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3pga080r0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 22 Mar 2023 23:42:29 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.132]) by mxout25.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 32MNfhT5013269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 22 Mar 2023 16:41:43 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.245]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 32MNfdjr023734 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 22 Mar 2023 16:41:43 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH 2/2] libstdc++: use new built-in trait __is_volatile Date: Wed, 22 Mar 2023 16:41:34 -0700 Message-Id: <20230322234134.14578-2-kmatsui@cs.washington.edu> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230322234134.14578-1-kmatsui@cs.washington.edu> References: <20230322234134.14578-1-kmatsui@cs.washington.edu> MIME-Version: 1.0 X-Proofpoint-GUID: vhGfK-KVm2F0hWN2UGx0eFq8StX-IkDD X-Proofpoint-ORIG-GUID: vhGfK-KVm2F0hWN2UGx0eFq8StX-IkDD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-22_18,2023-03-22_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 bulkscore=0 mlxlogscore=971 impostorscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303220173 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP 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?1761113414946332762?= X-GMAIL-MSGID: =?utf-8?q?1761113414946332762?= This patch lets libstdc++ use new built-in trait __is_volatile. libstdc++-v3/ChangeLog: * include/std/type_traits (is_volatile): Use __is_volatile built-in trait. --- libstdc++-v3/include/std/type_traits | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 2bd607a8b8f..c50c8dba396 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -773,6 +773,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public true_type { }; /// is_volatile +#if __has_builtin(__is_volatile) + template + struct is_volatile + : public __bool_constant<__is_volatile(_Tp)> + { }; +#else template struct is_volatile : public false_type { }; @@ -780,6 +786,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct is_volatile<_Tp volatile> : public true_type { }; +#endif /// is_trivial template