public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Enze Li <lienze2010@hotmail.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb/build: Fix Wpessimizing-move in clang build
Date: Fri, 28 Jan 2022 22:33:49 +0800	[thread overview]
Message-ID: <MEAP282MB02938CAC1E8A5CD9C9090A72DD229@MEAP282MB0293.AUSP282.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <4aa938bd-1d99-b6fe-d3d7-c1de42057d07@polymtl.ca>

On Fri, 2022-01-28 at 09:25 -0500, Simon Marchi wrote:
> 
> 
> On 2022-01-28 08:41, Enze Li via Gdb-patches wrote:
> > When building with clang, I run into an error:
> > 
> > ...
> > tui/tui-disasm.c:138:25: error: moving a temporary object prevents
> > copy
> > elision [-Werror,-Wpessimizing-move]
> >       tal.addr_string = std::move (gdb_dis_out.release ());
> >                         ^
> > tui/tui-disasm.c:138:25: note: remove std::move call here
> >       tal.addr_string = std::move (gdb_dis_out.release ());
> >                         ^~~~~~~~~~~                      ~
> > ...
> > 
> > The error above is caused by the recent commit 5d10a2041eb8 ("gdb:
> > add
> > string_file::release method").
> > 
> > Fix this by removing std::move.
> > 
> > Build on x86_64-linux with clang 13.0.0.
> > ---
> >  gdb/tui/tui-disasm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
> > index 445503a5af9..70f7429d32b 100644
> > --- a/gdb/tui/tui-disasm.c
> > +++ b/gdb/tui/tui-disasm.c
> > @@ -135,7 +135,7 @@ tui_disassemble (struct gdbarch *gdbarch,
> >        /* And capture the address the instruction is at.  */
> >        tal.addr = orig_pc;
> >        print_address (gdbarch, orig_pc, &gdb_dis_out);
> > -      tal.addr_string = std::move (gdb_dis_out.release ());
> > +      tal.addr_string = gdb_dis_out.release ();
> >  
> >        if (addr_size != nullptr)
> >         {
> 
> Oh, thanks!  In fact, this is the spot that did prompt me to add this
> release method, so it's a silly oversight on my part to not remove
> the
> std::move.  Thanks patch is ok.  Do you have push access?

Yes.  Should I push it now?

  reply	other threads:[~2022-01-28 14:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 13:41 Enze Li
2022-01-28 14:25 ` Simon Marchi
2022-01-28 14:33   ` Enze Li [this message]
2022-01-28 14:58     ` Simon Marchi
2022-01-28 15:08       ` Enze Li

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=MEAP282MB02938CAC1E8A5CD9C9090A72DD229@MEAP282MB0293.AUSP282.PROD.OUTLOOK.COM \
    --to=lienze2010@hotmail.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).