From patchwork Sat Jun 24 14:23:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 112468 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6428406vqr; Sat, 24 Jun 2023 07:25:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5BJhEsT0GnPWR4F4IwiUnQALQs9FthIKS7LB56s8lTG5DVIiV5riGvFQ616rkUzgDGEzs+ X-Received: by 2002:a05:6402:682:b0:51b:e581:6ca3 with SMTP id f2-20020a056402068200b0051be5816ca3mr5921125edy.35.1687616716044; Sat, 24 Jun 2023 07:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687616716; cv=none; d=google.com; s=arc-20160816; b=zEN+9Wl4pJuwuZkqF42E9AYLg4jY7hKapbU5XxxZgUSmmZk2JtVCV/MMtu1sc+pRvn ZE4GBrJTudtZVgu7a9xAUccyXZG5FOt3VTqZHJvZjU1RmITQMMUjmeznBuY9CE5gJNOG b1W1ppEnBYMOpUK1Rd7OUcV0ZcF4LoSIwaoM3SOduwvmUekgSYdsm9VyuYzKYk9B1yR/ VQE+6wnalQWvpJPhgUoJ9HkB+6bwrCFbUPDjfaslLRlUCIgaq7aUHIc0l9X38TbULDMa lW7+KXW9R7GQb08wDkW/kquKEhrBoV266TsnlrDKHn/wRrDP+nQKZCyivBOHsh6HnsU4 6qYw== 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=2iylnyenNO/IO86Lmj+idwVh6MPDRGW0AO9xn5LOhyI=; fh=ox+DVjjAr7YURR6UvGsFmi3AQ1YcSFrZcspu5PnHEIc=; b=es/bwAjV5xGt3Z+0UYGmj+XDOo4EWAeXOlDhNfw7EZ1/odoEQWb5DIzta++c/hdzDI UVObcNrsgGErNCi1C+g7Ee7AzA8ohf1JSCTTeA31B3+J3IylykPdsBBkP7SckBwDUg+l ZlxDNpCvd4WUUmVfYSuZk0ozOeQ2xNiqYwPAQH/1947kV5OeUb3T0hmTHguUpJnlzl/N jCqdD2+OMF8rWbB/ImfM28VqDLxpNoWGu+tEAQiiJjBeTP/tbqqUK9dSxY/dPgAknbIl Vfeh30UzTL29Skbn5mcF4Y/mRIuiuDmB31GNw8I26yVPCf1+bpcw//DN628rqIt5lKEc 7zyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ytLUEtev; 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 l22-20020a056402345600b0051d7d1f5377si631199edc.586.2023.06.24.07.25.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jun 2023 07:25:16 -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=ytLUEtev; 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 39D9B385773F for ; Sat, 24 Jun 2023 14:24:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39D9B385773F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687616686; bh=2iylnyenNO/IO86Lmj+idwVh6MPDRGW0AO9xn5LOhyI=; 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=ytLUEtevqpV/A56v/IBS2ahpl10r0enSkslRr63G4CpMgtThaHo6qUjo21aqtxEv+ c5ZqZy7Xy/fqIO7Zmure4wnbbNCcBQ/vn49h9raI0T+NgJwL6/H6x1rNbCbS/CJoY+ TmdkQxbIXRw8HIGx4hnrKM2ngEIoFTVwKRe1TnZw= 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 5FB2F3858D35; Sat, 24 Jun 2023 14:24:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5FB2F3858D35 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 35OENnGv022738; Sat, 24 Jun 2023 14:24:02 GMT Received: from mxout23.cac.washington.edu (mxout23.cac.washington.edu [140.142.32.140]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rdse8hg1u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 24 Jun 2023 14:24:02 +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 35OENmYm024104 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Jun 2023 07:23:48 -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 35OENmaN013513 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 24 Jun 2023 07:23:48 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH v2 1/2] c++: implement __is_volatile built-in trait Date: Sat, 24 Jun 2023 07:23:45 -0700 Message-ID: <20230624142346.84325-1-kmatsui@cs.washington.edu> X-Mailer: git-send-email 2.41.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-ORIG-GUID: OmwmjGzPVJs44QKDAbttVI-8eGuZggor X-Proofpoint-GUID: OmwmjGzPVJs44QKDAbttVI-8eGuZggor 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-06-24_10,2023-06-22_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 impostorscore=0 malwarescore=0 priorityscore=1501 phishscore=0 suspectscore=0 mlxlogscore=838 clxscore=1015 mlxscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306240135 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761113353732621821?= X-GMAIL-MSGID: =?utf-8?q?1769594385714078068?= 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. Signed-off-by: Ken Matsui --- 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 8cf0f2d0974..e971d67ee25 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -3751,6 +3751,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 8b7fece0cc8..414b1065a11 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 8fb47fd179e..10934d01504 100644 --- a/gcc/cp/semantics.cc +++ b/gcc/cp/semantics.cc @@ -12079,6 +12079,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); @@ -12296,6 +12299,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 Sat Jun 24 14:23:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 112469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6428917vqr; Sat, 24 Jun 2023 07:26:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5GV9CnWzTU+39In8KgVSB2dxNJDy/bX6TmNAx+ZpNdwgmVi3GH5Rag/cnNWRQVWeom4tQ7 X-Received: by 2002:a05:6402:344c:b0:51a:5ac3:4df7 with SMTP id l12-20020a056402344c00b0051a5ac34df7mr11899099edc.0.1687616789096; Sat, 24 Jun 2023 07:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687616789; cv=none; d=google.com; s=arc-20160816; b=c8xLhG1oblPWqkl945WVWLbZ0J5IP+hxTENucoeJ9/8JKcHi8ds/dpm+E+Yg1mvd69 d2HGYBx6cUIhrW+kXIP3Ke2COIMC0yb/kkG6bTOj3e6MnijnECLHbbQCKqnhD6nO/opA +kZToybpxdbk41BBDiPkBHUfMCABpY76Tp+8Kl3sPXG711O66Ze5BV18kb0QB/wKLoiQ cbrfG8lV5agMrAb4f1otYs5fesSdl531TAYnVwiqYykh+KYK1IxiYv+xANUo4Uv44l1T g9G66bxZCbiHn51IsimZPO5cz/9c0lhEV76qp8RFFrAGbW7IO8jBnSzNM7dF2h34mECJ FEXA== 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=T0XP4AoD7qVFqxLHbD4CjnHco5BVnGP+iG3KlcWmeLQ=; fh=ox+DVjjAr7YURR6UvGsFmi3AQ1YcSFrZcspu5PnHEIc=; b=O8dAVSUDmTptnMTMkdJxUymwvr6Q7eGPZUbqu91fxJqWDokqRiVn0SNCVf9RVoCV6p aUXvZp3mC0pGoVN8QMcTGVc+b3Orl3dS28bYcRWJBW6rs2S5+4vCRkZoLxvqRXm/gmMD UB0sVEpElpmpKFPqHy/9ZSX9UU8/2xmnAcVkPYMA8GiWSOTgMMlXidecGXvynmgzV6Vo SrjgRlIQTlVWI2A0Pv5En/WK+m4cKDlu/52EEVAeCBV8tsaHgTiEIotu10MfXc7HUG2n f9FTd7Rs93NbCQYf7oW6IZ87GKfVypjjo2aykPOR2VdDInv8sV0e3LEa8KhaEAQgkzOA 6i+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=EnvRPDae; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id u6-20020a05640207c600b0051bea139bdbsi674143edy.166.2023.06.24.07.26.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jun 2023 07:26:29 -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=EnvRPDae; 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 0D1023856948 for ; Sat, 24 Jun 2023 14:25:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D1023856948 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687616752; bh=T0XP4AoD7qVFqxLHbD4CjnHco5BVnGP+iG3KlcWmeLQ=; 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=EnvRPDaeaCehBaiwNANqKB6gR2vw8ToRvzA9JpPwVx8xS5RtgaF909hxNGIkypWZB Z+b456h6WVVGAzqsb4t3oTWz58cblxgB6ykWWddGV6UDIFX3UguwnUPF9K26YtOPr4 bIBKez5eWX2GEu0Ydel58txYtOYYz6VS8evqwmTk= 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 3F4AC3857720; Sat, 24 Jun 2023 14:24:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3F4AC3857720 Received: from pps.filterd (m0247477.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35OEIZKJ031160; Sat, 24 Jun 2023 14:24: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 3rdp6ma3mj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 24 Jun 2023 14:24:29 +0000 Received: from smtp.washington.edu (smtp.washington.edu [140.142.234.157]) by mxout25.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 35OEOSj8028536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 24 Jun 2023 07:24:28 -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 35OENmaO013513 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 24 Jun 2023 07:24:28 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH v2 2/2] libstdc++: use new built-in trait __is_volatile Date: Sat, 24 Jun 2023 07:23:46 -0700 Message-ID: <20230624142346.84325-2-kmatsui@cs.washington.edu> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230624142346.84325-1-kmatsui@cs.washington.edu> References: <20230322234134.14578-1-kmatsui@cs.washington.edu> <20230624142346.84325-1-kmatsui@cs.washington.edu> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: dlLdGAhRpzloo_pLwe744MV0EAR4g2Cu X-Proofpoint-GUID: dlLdGAhRpzloo_pLwe744MV0EAR4g2Cu 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-06-24_10,2023-06-22_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 adultscore=0 impostorscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 clxscore=1015 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306240135 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761113414946332762?= X-GMAIL-MSGID: =?utf-8?q?1769594462177847581?= 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. (is_volatile_v): Likewise. Signed-off-by: Ken Matsui --- libstdc++-v3/include/std/type_traits | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 0e7a9c9c7f3..db74b884b35 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 @@ -3214,10 +3221,16 @@ template inline constexpr bool is_const_v = false; template inline constexpr bool is_const_v = true; + +#if __has_builtin(__is_volatile) +template + inline constexpr bool is_volatile_v = __is_volatile(_Tp); +#else template inline constexpr bool is_volatile_v = false; template inline constexpr bool is_volatile_v = true; +#endif template inline constexpr bool is_trivial_v = __is_trivial(_Tp);