public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>,
	Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: Re: [PATCH] gdbsupport: fix scoped_debug_start_end's move constructor
Date: Thu, 5 Jan 2023 15:23:14 -0500	[thread overview]
Message-ID: <5905d51d-bc33-b801-12c4-4d110ff7c5d5@polymtl.ca> (raw)
In-Reply-To: <87k020d9x2.fsf@tromey.com>

On 1/5/23 15:05, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> 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

      reply	other threads:[~2023-01-05 20:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 21:22 Simon Marchi
2023-01-04 22:01 ` Simon Marchi
2023-01-05 20:05   ` Tom Tromey
2023-01-05 20:23     ` Simon Marchi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5905d51d-bc33-b801-12c4-4d110ff7c5d5@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).