diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2025-07-23 14:41:42 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2025-07-23 14:44:01 -0400 |
commit | cff79e9708be8236211a33af46a215be9b5a91d5 (patch) | |
tree | 65c166c6e703838d1fff1873cd60e60955c4bc0c | |
parent | 3786ec669c6075a5c5cb99efe0c369b7a07ca8d3 (diff) | |
download | binutils-cff79e9708be8236211a33af46a215be9b5a91d5.zip binutils-cff79e9708be8236211a33af46a215be9b5a91d5.tar.gz binutils-cff79e9708be8236211a33af46a215be9b5a91d5.tar.bz2 |
gdbserver: use reference in range for loop
The armhf buildbot fails to build GDB, with:
../../binutils-gdb/gdbserver/server.cc: In function ‘void handle_general_set(char*)’:
../../binutils-gdb/gdbserver/server.cc:1021:23: error: loop variable ‘<structured bindings>’ creates a copy from type ‘const std::pair<thread_info*, enum_flags<gdb_thread_option> >’ [-Werror=range-loop-construct]
1021 | for (const auto [thread, options] : set_options)
| ^~~~~~~~~~~~~~~~~
../../binutils-gdb/gdbserver/server.cc:1021:23: note: use reference type to prevent copying
1021 | for (const auto [thread, options] : set_options)
| ^~~~~~~~~~~~~~~~~
| &
I did not use a reference on purpose, because the pair is very small. I
don't see the problem when building on amd64, I presume it is because
the pair is considered too big to copy on a 32-bit architecture, but not
on a 64-bit architecture.
In any case, fix it by adding a reference.
Change-Id: I8e95235d6e53f032361950cf6e0c7d46b082f951
-rw-r--r-- | gdbserver/server.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 4875df7..ce84c7f 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -1018,7 +1018,7 @@ handle_general_set (char *own_buf) }); } - for (const auto [thread, options] : set_options) + for (const auto &[thread, options] : set_options) if (thread->thread_options != options) { threads_debug_printf ("[options for %s are now %s]\n", |