From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [pushed] gdb/record-full: fix some -Wpessimizing-move errors
Date: Mon, 6 Jul 2026 10:43:03 -0400 [thread overview]
Message-ID: <20260706144305.180512-1-simon.marchi@efficios.com> (raw)
Compiling record-full.c with clang shows:
/home/smarchi/src/binutils-gdb/gdb/record-full.c:2386:14: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
2386 | rec.entry = std::move (record_full_reg_entry::from_bfd
| ^
/home/smarchi/src/binutils-gdb/gdb/record-full.c:2386:14: note: remove std::move call here
2386 | rec.entry = std::move (record_full_reg_entry::from_bfd
| ^~~~~~~~~~~
2387 | (cbfd, osec, bfd_offset));
| ~
/home/smarchi/src/binutils-gdb/gdb/record-full.c:2393:14: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
2393 | rec.entry = std::move (record_full_mem_entry::from_bfd
| ^
/home/smarchi/src/binutils-gdb/gdb/record-full.c:2393:14: note: remove std::move call here
2393 | rec.entry = std::move (record_full_mem_entry::from_bfd
| ^~~~~~~~~~~
2394 | (cbfd, osec, bfd_offset));
| ~
It's indeed not recommended to std::move the return value of a
function. Remove the std::moves.
Change-Id: I80d947aa3d917fe3fcaaad0c3e329cb1de48a8ee
---
gdb/record-full.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 695d9d1622cd..1392510a175c 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2383,15 +2383,13 @@ record_full_entry::from_bfd (bfd *cbfd, asection *osec, int *bfd_offset)
{
case record_full_reg: /* reg */
{
- rec.entry = std::move (record_full_reg_entry::from_bfd
- (cbfd, osec, bfd_offset));
+ rec.entry = record_full_reg_entry::from_bfd (cbfd, osec, bfd_offset);
break;
}
case record_full_mem: /* mem */
{
- rec.entry = std::move (record_full_mem_entry::from_bfd
- (cbfd, osec, bfd_offset));
+ rec.entry = record_full_mem_entry::from_bfd (cbfd, osec, bfd_offset);
break;
}
base-commit: 748bc6a7febf874d84657f538c9d9e3b8153c6e7
--
2.55.0
reply other threads:[~2026-07-06 14:44 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260706144305.180512-1-simon.marchi@efficios.com \
--to=simon.marchi@efficios.com \
--cc=gdb-patches@sourceware.org \
/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