From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id D8FFD3858C98 for ; Tue, 21 Nov 2023 15:28:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D8FFD3858C98 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 D8FFD3858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700580496; cv=none; b=Vs4KMxvmQwj94OKT0ZgPQzboTagESP87H3BQnFRzyePfv+/FSdmelv8OuVFpTPDg+DwPBG5XdDL4rk+XsOrzIde39+lLziu3pWq0BNpW+x2TcDl+O5HVBxRXIoiv8zHvPti7tSJ/R2pIqAeLNc7Gl/GmMq1HuzLhc9d96j20Uys= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700580496; c=relaxed/simple; bh=B0BoOBNbV9q3L988xhb2pDtB3fudLa4ADWgnfXh1WPk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PoCuzbQsllf001VGhqtI7ftmlTcnDZBObYr1P12zUUlRBkZJgyfPyGRG9QfnTLrPyOCk++KTSpEsw6BsBOS2JTaWn46lh00y3/EGokOVcHdoJHREm89DpfuYcOToFNuoeHDJNiNxKMhNQ5v/3p89ehtdcuarkYo7t9IQKESevxw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6004a.ext.cloudfilter.net ([10.0.30.197]) by cmsmtp with ESMTPS id 5C58rnO1nWcCI5SfereYtm; Tue, 21 Nov 2023 15:28:14 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id 5Sfdr4JAIRGmS5SfdrMPYu; Tue, 21 Nov 2023 15:28:14 +0000 X-Authority-Analysis: v=2.4 cv=efcuwpIH c=1 sm=1 tr=0 ts=655ccc8e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=BNY50KLci1gA:10 a=Qbun_eYptAEA:10 a=T_Alst9gAAAA:8 a=snd5DWcRwXxGJMnhv3gA:9 a=DvZ5ixILWSEuw56YIEpp:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Reply-To:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender: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=gYdtcsJHdoBu59JSb6wFohwwjY7YB8heTeSJAzkxhqs=; b=Pa6ybYkbi/JRI8WXTH+TAa0f7M 5AOy4YzU5yKg+twYZkEcRnptw8jwtwDJkwe6GtJdhvKYq4kfYjyem63ORcdMqSFgNm8+NVHFEZeQm bxB2Vrsy/NraK6WpXMyHc512T; Received: from 97-122-77-73.hlrn.qwest.net ([97.122.77.73]:36894 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1r5Sfd-004BpE-0s; Tue, 21 Nov 2023 08:28:13 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey , Pedro Alves Subject: [PATCH v2 6/8] Rely on copy elision in scope-exit.h Date: Tue, 21 Nov 2023 08:27:33 -0700 Message-ID: <20231121152817.31859-7-tom@tromey.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231121152817.31859-1-tom@tromey.com> References: <20231121152817.31859-1-tom@tromey.com> Reply-To: [PATCH v2 0/8] More C++17 conversions MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: 97.122.77.73 X-Source-L: No X-Exim-ID: 1r5Sfd-004BpE-0s X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-77-73.hlrn.qwest.net (localhost.localdomain) [97.122.77.73]:36894 X-Source-Auth: tom+tromey.com X-Email-Count: 15 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfNlSMUTd0nYUmWwccTz6i+fUGb/geDM2mld4dsH9eIldgdfjwZm1nACjVmdHj0WCoSKxSsZjopafnnVMpwwKGNAVO/roUwxK4FYmTZU8CpwLi8HYSg/3 weE3Qt3/YPrECIwL1eMAzkaRnzFeg6y0VdrA7NX/uQo4D5O6JjH62EN+EuH2mBz15ixCMFJXKIlfr0VxnBbqGZgMP8ioh1DjmTg= X-Spam-Status: No, score=-3024.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,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 List-Id: 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. Approved-By: Pedro Alves --- 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: -- 2.41.0