From: Tom de Vries Date: Thu, 17 Aug 2023 08:41:34 +0000 (+0200) Subject: [gdb/build, c++20] Fix deprecated implicit capture of this X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5bd5fecdd25eda1335796df8d77511f62bbd1898;p=binutils-gdb.git [gdb/build, c++20] Fix deprecated implicit capture of this When building gdb with -std=c++20 I run into: ... gdb/ada-lang.c:10713:16: error: implicit capture of ‘this’ via ‘[=]’ is \ deprecated in C++20 [-Werror=deprecated] 10713 | auto do_op = [=] (LONGEST x, LONGEST y) | ^ gdb/ada-lang.c:10713:16: note: add explicit ‘this’ or ‘*this’ capture ... Fix this by using "[this]". Likewise in two more spots. Tested on x86_64-linux. --- diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 2f934b1e79a..575568cffb5 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -10730,7 +10730,7 @@ ada_binop_addsub_operation::evaluate (struct type *expect_type, value *arg1 = std::get<1> (m_storage)->evaluate_with_coercion (exp, noside); value *arg2 = std::get<2> (m_storage)->evaluate_with_coercion (exp, noside); - auto do_op = [=] (LONGEST x, LONGEST y) + auto do_op = [this] (LONGEST x, LONGEST y) { if (std::get<0> (m_storage) == BINOP_ADD) return x + y; diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c index 52016133889..68d336bee99 100644 --- a/gdb/ravenscar-thread.c +++ b/gdb/ravenscar-thread.c @@ -473,7 +473,7 @@ ravenscar_thread_target::update_thread_list () (m_base_ptid) and the running thread, that may not have been included to system.tasking.debug's list yet. */ - iterate_over_live_ada_tasks ([=] (struct ada_task_info *task) + iterate_over_live_ada_tasks ([this] (struct ada_task_info *task) { this->add_thread (task); }); diff --git a/gdb/remote.c b/gdb/remote.c index e01da795ec8..7abe08439b5 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -11609,7 +11609,7 @@ remote_target::search_memory (CORE_ADDR start_addr, ULONGEST search_space_len, int found; ULONGEST found_addr; - auto read_memory = [=] (CORE_ADDR addr, gdb_byte *result, size_t len) + auto read_memory = [this] (CORE_ADDR addr, gdb_byte *result, size_t len) { return (target_read (this, TARGET_OBJECT_MEMORY, NULL, result, addr, len) == len);