gdb/dwarf2/read.c: remove pessimizing std::move
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
When building with this clang:
$ c++ --version
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
I see:
$ gmake
CXX dwarf2/read.o
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:4890:6: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
std::move (thread_storage.release_parent_map ()));
^
/home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:4890:6: note: remove std::move call here
std::move (thread_storage.release_parent_map ()));
^~~~~~~~~~~ ~
The compiler seems right, there is not need to std::move the result of
`release_parent_map ()`, it's already going to be an rvalue. Remove the
std::move.
The issue isn't FreeBSD-specific, I see it on Linux as well when
building hwith clang, I just noticed it on a FreeBSD build first.
Change-Id: I7aa20a4db56c799f20d838ad08099a01653bba19
---
gdb/dwarf2/read.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
base-commit: fdaa4939e5024ea809c0d4d1aa6043a60b37d9b5
Comments
>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
Simon> The compiler seems right, there is not need to std::move the result of
Simon> `release_parent_map ()`, it's already going to be an rvalue. Remove the
Simon> std::move.
Thanks.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
On 2024-04-23 10:39, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
>
> Simon> The compiler seems right, there is not need to std::move the result of
> Simon> `release_parent_map ()`, it's already going to be an rvalue. Remove the
> Simon> std::move.
>
> Thanks.
> Approved-By: Tom Tromey <tom@tromey.com>
>
> Tom
Thanks, pushed.
Simon
@@ -4885,7 +4885,7 @@ cooked_index_debug_info::process_cus (size_t task_number, unit_iterator first,
m_results[task_number] = result_type (thread_storage.release (),
complaint_handler.release (),
std::move (errors),
- std::move (thread_storage.release_parent_map ()));
+ thread_storage.release_parent_map ());
}
void