From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 0AD3F3858D28 for ; Thu, 5 Jan 2023 20:23:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0AD3F3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 305KNEPJ020652 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 5 Jan 2023 15:23:18 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 305KNEPJ020652 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1672950199; bh=CUiuLb83QWi4w2+qwqjzvkXOEQoiDhJHRBjIrg25MDY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=izCsUnEM//qaXQ5iYeWOgHMbXn3S/7WWgoYZlNTjbHbr7Bh81mzF0BGnyJhl2uKOk L08sG8C3ZJBv/moy5/6VWWhNIIaBNkn3OtuaSaXy8wmrQ+TSTqA6iZjTEG7AdZ721M Jt6k+yQ5CyxkAMv/j+GJfy9dooGzWJR2n3/6iTK4= Received: from [192.168.255.180] (unknown [207.35.41.250]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 39A071E112; Thu, 5 Jan 2023 15:23:14 -0500 (EST) Message-ID: <5905d51d-bc33-b801-12c4-4d110ff7c5d5@polymtl.ca> Date: Thu, 5 Jan 2023 15:23:14 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] gdbsupport: fix scoped_debug_start_end's move constructor Content-Language: fr To: Tom Tromey , Simon Marchi via Gdb-patches Cc: Andrew Burgess References: <20230104212242.545914-1-simon.marchi@polymtl.ca> <87k020d9x2.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87k020d9x2.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 5 Jan 2023 20:23:14 +0000 X-Spam-Status: No, score=-3033.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 List-Id: On 1/5/23 15:05, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > >>> + scoped_debug_start_end (scoped_debug_start_end &&other) >>> + : m_debug_enabled (other.m_debug_enabled), >>> + m_module (other.m_module), >>> + m_func (other.m_func), >>> + m_end_prefix (other.m_end_prefix), >>> + m_msg (other.m_msg), > > Simon> Just found this nit... not that it changes anything (because this ctor > Simon> isn't called in practice), but we should std::move m_msg. I'll change > Simon> it locally. > > I think it's also fine to just leave it as-is. > > Simon> Well, we could std::move all fields, but it would be a bit verbose. > > If we think we may need this kind of behavior again, one way would be a > sort of "move token" object that wraps a bool, and that sets the bool on > construction and clears it on move. Then scoped_debug_start_end could > just use the default move constructor again, and check the token's value > in its destructor. Interesting, I'll keep this in mind. I think it could apply to some scoped_restore_* objects that have global side effects, that we want to be movable, because we want to be able to have functions that return them. > Probably overkill for just the one case. I think your patch is ok. Ok, thanks, will push. Simon