public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
Cc: Simon Marchi <simon.marchi@polymtl.ca>,
	 Andrew Burgess <aburgess@redhat.com>
Subject: Re: [PATCH] gdbsupport: fix scoped_debug_start_end's move constructor
Date: Thu, 05 Jan 2023 13:05:29 -0700	[thread overview]
Message-ID: <87k020d9x2.fsf@tromey.com> (raw)
In-Reply-To: <b079de0a-cd6d-bb8c-4802-fe2a9a88d25d@polymtl.ca> (Simon Marchi via Gdb-patches's message of "Wed, 4 Jan 2023 17:01:16 -0500")

>>>>> "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.

Probably overkill for just the one case.  I think your patch is ok.

Tom

  reply	other threads:[~2023-01-05 20:05 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 [this message]
2023-01-05 20:23     ` Simon Marchi

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=87k020d9x2.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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).