aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-10-21 08:04:07 +0200
committerTom de Vries <tdevries@suse.de>2024-10-21 08:04:07 +0200
commitced885161b6e1dee89acc4bd3b68ba7a27815645 (patch)
tree7b650713fdc491af07b58188d66fb73e8469a716
parent0740c336853825b0cddce5dd10cbe26fd32693e7 (diff)
downloadbinutils-ced885161b6e1dee89acc4bd3b68ba7a27815645.zip
binutils-ced885161b6e1dee89acc4bd3b68ba7a27815645.tar.gz
binutils-ced885161b6e1dee89acc4bd3b68ba7a27815645.tar.bz2
[gdb/build, c++20] Fix more deprecated implicit capture of this
When building gdb with -std=c++20 I run into: ... gdb/dwarf2/cooked-index.c: In lambda function: gdb/dwarf2/cooked-index.c:471:47: error: implicit capture of ‘this’ via \ ‘[=]’ is deprecated in C++20 [-Werror=deprecated] 471 | gdb::thread_pool::g_thread_pool->post_task ([=] () | ^ gdb/dwarf2/cooked-index.c:471:47: note: add explicit ‘this’ or ‘*this’ capture ... Fix this and two more spots by removing the capture default, and explicitly listing all captures. Tested on x86_64-linux.
-rw-r--r--gdb/dwarf2/cooked-index.c4
-rw-r--r--gdb/dwarf2/read.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index 46b1c2d..d776f2f 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -468,7 +468,7 @@ cooked_index_shard::find (const std::string &name, bool completing) const
void
cooked_index_worker::start ()
{
- gdb::thread_pool::g_thread_pool->post_task ([=] ()
+ gdb::thread_pool::g_thread_pool->post_task ([this] ()
{
try
{
@@ -653,7 +653,7 @@ cooked_index::set_contents (vec_type &&vec, deferred_warnings *warn,
finalization. However, that would take a slot in the global
thread pool, and if enough such tasks were submitted at once, it
would cause a livelock. */
- gdb::task_group finalizers ([=] ()
+ gdb::task_group finalizers ([this, warn] ()
{
m_state->set (cooked_state::FINALIZED);
m_state->write_to_cache (index_for_writing (), warn);
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index cc49c47..886d14f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -5033,7 +5033,7 @@ cooked_index_debug_info::do_reading ()
}
gdb_assert (iter != last);
- workers.add_task ([=] ()
+ workers.add_task ([this, task_count, iter, last] ()
{
process_cus (task_count, iter, last);
});