From patchwork Mon Oct 16 23:02:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 77904 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3FC413857713 for ; Mon, 16 Oct 2023 23:05:55 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id 2C8E43858C2A for ; Mon, 16 Oct 2023 23:05:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2C8E43858C2A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2C8E43858C2A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697497532; cv=none; b=HmrqoWfmPR/XEWRqgWQuBwZL1lpmZP4Kv4MQiSK6UIPddfg/fmfC1d0Niyz5UNw+aVVjUa5NjdD+indsXsCAyysz3IYtJ0DuhYVkqt7/xEEvVPo8pIfWGKMdUzjSRVGQbxXIwk63Qch3V56BxdkP9otHWT0kBcEE8XMBOdkp36Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697497532; c=relaxed/simple; bh=vPpJQELIMU5gfAt18c6FYA/La2fQk2MYjtSd7PjieTo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gRMmWI3mTB7xxOSfUhtQaqMxbZgC8To0EIKomboNLQv/N/C8e9I7acaI3OIlqYmq/hZTRmyIfoCc43XzqLb6V28he7rW1NE/A0fCifCJxIj2nZa+PCZ3uKah+Lg3lMyCps8+D3ltFJbIoOoYxwFqy3XzEfN1611M8bamLkwtGg8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6005a.ext.cloudfilter.net ([10.0.30.201]) by cmsmtp with ESMTPS id sWRFqaCSnOFScsWeQqX1Lg; Mon, 16 Oct 2023 23:05:31 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id sWePqyU5FqfNqsWeQqGu5o; Mon, 16 Oct 2023 23:05:30 +0000 X-Authority-Analysis: v=2.4 cv=LK11/ba9 c=1 sm=1 tr=0 ts=652dc1ba a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=bhdUkHdE2iEA:10 a=Qbun_eYptAEA:10 a=snd5DWcRwXxGJMnhv3gA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=uOhRCcFTeVRFcJqhMb6g3W/DU5wD+/vQIKv2LIMKFr4=; b=Pn9lwQ0qVs1NH/B6xacXPrnIbw kARecXk5m+FXETXQNLhGjPJR8SZy3/y96LYuMdQ/oYUcjEAU48kPpVfTCLGCaPg8wwdRS4Or6wATe x7J0Bbv45BG6zt88QXKsySIVj; Received: from [161.98.8.3] (port=38490 helo=prentzel.ci.boulder.co.us) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.1) (envelope-from ) id 1qsWeP-003Maa-1v; Mon, 16 Oct 2023 17:05:29 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 6/7] Rely on copy elision in scope-exit.h Date: Mon, 16 Oct 2023 17:02:45 -0600 Message-ID: <20231016230527.1820819-7-tom@tromey.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231016230527.1820819-1-tom@tromey.com> References: <20231016230527.1820819-1-tom@tromey.com> MIME-Version: 1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 161.98.8.3 X-Source-L: No X-Exim-ID: 1qsWeP-003Maa-1v X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (prentzel.ci.boulder.co.us) [161.98.8.3]:38490 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfOtFkOmyzpTxEEYQma5uShezsGjcXQJpEIj74zymBw35uWB1KpJYLYmCfJU9GIMM4dI3VFNhFdN43VdF3FiHiuyfp6IeE9Z/ak5OkjasXDEDh/W2TucU g6dncnfKI9Che8ZGMwL1o8j4h1cAiIYz0UiRa5YJqlxwA5q1o2QoKne8LKCwV6lgbq2k+p9umNVSlo/cyI0Al8n690Uo/2kdRAQ= X-Spam-Status: No, score=-3024.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org gdbsupport/scope-exit.h has a couple of comments about being able to rely on copy elision in C++17. This patch makes the change. --- gdbsupport/scope-exit.h | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/gdbsupport/scope-exit.h b/gdbsupport/scope-exit.h index cb8d9255869..8fa40b1ca8a 100644 --- a/gdbsupport/scope-exit.h +++ b/gdbsupport/scope-exit.h @@ -69,16 +69,7 @@ class scope_exit_base } } - /* This is needed for make_scope_exit because copy elision isn't - guaranteed until C++17. An optimizing compiler will usually skip - calling this, but it must exist. */ - scope_exit_base (const scope_exit_base &other) - : m_released (other.m_released) - { - other.m_released = true; - } - - void operator= (const scope_exit_base &) = delete; + DISABLE_COPY_AND_ASSIGN (scope_exit_base); /* If this is called, then the wrapped function will not be called on destruction. */ @@ -132,16 +123,7 @@ class scope_exit : public scope_exit_base> rhs.release (); } - /* This is needed for make_scope_exit because copy elision isn't - guaranteed until C++17. An optimizing compiler will usually skip - calling this, but it must exist. */ - scope_exit (const scope_exit &other) - : scope_exit_base> (other), - m_exit_function (other.m_exit_function) - { - } - - void operator= (const scope_exit &) = delete; + DISABLE_COPY_AND_ASSIGN (scope_exit); void operator= (scope_exit &&) = delete; private: