From patchwork Thu Jul 13 02:33: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: 11958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1547717vqm; Wed, 12 Jul 2023 19:38:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlGc8ZBpDCXRSNEmzaTCBTr5qll8UTcK7Z3n2XcNnX3uc/zuBX0cSxC7ZXW4oQHSdBuUHLQN X-Received: by 2002:a2e:3815:0:b0:2b7:1b76:2c98 with SMTP id f21-20020a2e3815000000b002b71b762c98mr148164lja.10.1689215927490; Wed, 12 Jul 2023 19:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689215927; cv=none; d=google.com; s=arc-20160816; b=Qw1kvchIt+yrKwcq6ax8BcHa6q36B+4DfSEVxEDGazNunl5bl3sEX7hL9YnIJOaW+a Ro+bBtEIDcmYGvLHajOzI3cmlh0qkWq2qKDHBa+O6ls5FhCMsstHhEK01o8RKf8N2JUr 7u5OMqOgkWYkfHTxidChFlhq/AIe1waWtU0lXbZS0WYbaLA1vzBrD+piuV1sFOUa4EEW V6bSVgF2XI4kA7hgLTq/K5CJLILtZpru/ZlUZqHZOB4xSRJ9peAYjIfIk+trNdJRVTs0 dGuOEGXa0pF9Z0FsccALhuFmXgk4dEHIgt4tZmV7iUfZKtVLG93rrL2YvbMdtgIYkv3u rFfA== 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=g+jBiEIPjyaMn/K4wwaM0AXrjyPnSdlbSKMsxfqTMJg=; fh=1CAabwJrK+ugngH18pg8mqZVlwzSJe6ffxxXK5OO7Vs=; b=qsc9nkjUT4gh9Bd41Glw6X3grE/7MifDeNm/7nKFm1agU0DG54LsBR71V5L/z5pV77 dHwKIGgNMnpONgbkPaLiod3laQGTlsgo5uX8zsN+rSnE+vJ7GQoqL7qT/b6pMti8poP6 c0rVwwn59G5eomo59Uy9PD9IgBGhg9BMrOpVd1GCKJrbS/531SR64fvB4roqarZ6NKTn HRAI/P4dVeV4NYO0zQINjO/zhdYpZzYbiVffoKKSYY3f+9/3es/oWvfnOJni+fW43pft QbakaPwphuiY58eERQVvfqe/0KHxQdryCIxf9bbqnj9tlwQiKdRkBQZ5dH0sWhLKSy1T IGIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="wkHg/3zb"; 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 a18-20020aa7d912000000b0051e0f836ddesi5982459edr.57.2023.07.12.19.38.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 19:38: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="wkHg/3zb"; 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 2CCA6385773F for ; Thu, 13 Jul 2023 02:38:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2CCA6385773F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689215926; bh=g+jBiEIPjyaMn/K4wwaM0AXrjyPnSdlbSKMsxfqTMJg=; 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=wkHg/3zbZQjQUDWwnzUkzYLofgbxa9iGj5aeMwUqNKS5VfVaC0gCxh1ol1+pacSKa xxpilcaeNyYf46Db06eML4RqOA5w+J6gaVp96c5Y1+wVM3g5sy3IJQ0mLtuzUUgPlx tVLK0pYe7ZRveoc9tRpulL6CCLZX9w3ySpOifqK0= 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 5B7063858C74; Thu, 13 Jul 2023 02:37:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5B7063858C74 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 36D2ZQLS001542; Thu, 13 Jul 2023 02:37:58 GMT Received: from mxout24.cac.washington.edu (mxout24.cac.washington.edu [140.142.234.158]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rt2sj2dj2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Jul 2023 02:37:57 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.54]) by mxout24.cac.washington.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 36D2bYiD012075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jul 2023 19:37:34 -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 36D2bY7D020817 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 12 Jul 2023 19:37:34 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH v10 0/5] c++, libstdc++: Make std::is_object dispatch to new built-in traits Date: Wed, 12 Jul 2023 19:33:34 -0700 Message-ID: <20230713023731.15571-1-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230708051137.63707-1-kmatsui@gcc.gnu.org> References: <20230708051137.63707-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: up2g4m4binn21wAnnAIlQxAXsWjE-lus X-Proofpoint-ORIG-GUID: up2g4m4binn21wAnnAIlQxAXsWjE-lus 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-12_17,2023-07-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=727 clxscore=1034 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307130021 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NEUTRAL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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: 1771271280315074514 X-GMAIL-MSGID: 1771271280315074514 Hi, This patch series gets std::is_object to dispatch to built-in traits and implements the following built-in traits, on which std::object depends. * __is_reference * __is_function std::is_object was depending on them with disjunction and negation. __not_<__or_, is_reference<_Tp>, is_void<_Tp>>>::type Therefore, this patch uses them directly instead of implementing an additional built-in trait __is_object, which makes the compiler slightly bigger and slower. __bool_constant::value)> This would instantiate only __bool_constant and __bool_constant, which can be mostly shared. That is, the purpose of built-in traits is considered as achieved. Changes in v8 * Dropped __is_void built-in implementation since it is optimal. * Optimized is_function_v Ken Matsui (5): c++: Implement __is_reference built-in trait libstdc++: Use new built-in trait __is_reference for std::is_reference c++: Implement __is_function built-in trait libstdc++: Use new built-in trait __is_function for std::is_function libstdc++: Make std::is_object dispatch to new built-in traits gcc/cp/constraint.cc | 6 +++ gcc/cp/cp-trait.def | 2 + gcc/cp/semantics.cc | 8 ++++ gcc/testsuite/g++.dg/ext/has-builtin-1.C | 6 +++ gcc/testsuite/g++.dg/ext/is_function.C | 58 ++++++++++++++++++++++++ gcc/testsuite/g++.dg/ext/is_reference.C | 34 ++++++++++++++ libstdc++-v3/include/std/type_traits | 50 +++++++++++++++++++- 7 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ext/is_function.C create mode 100644 gcc/testsuite/g++.dg/ext/is_reference.C