public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/7] [gdb/build, c++20] Fix deprecated implicit capture of this
Date: Tue, 15 Aug 2023 20:13:06 +0200	[thread overview]
Message-ID: <20230815181309.8595-5-tdevries@suse.de> (raw)
In-Reply-To: <20230815181309.8595-1-tdevries@suse.de>

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.
---
 gdb/ada-lang.c         | 2 +-
 gdb/ravenscar-thread.c | 2 +-
 gdb/remote.c           | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 1261ee8fa05..018adfcfb70 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -10710,7 +10710,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);
-- 
2.35.3


  parent reply	other threads:[~2023-08-15 18:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 18:13 [PATCH 0/7] [gdb/build] Fix -std=c++20 issues Tom de Vries
2023-08-15 18:13 ` [PATCH 1/7] [gdb/build, c++20] Fix Wdeprecated-enum-enum-conversion Tom de Vries
2023-08-15 18:13 ` [PATCH 2/7] [gdb/build, c++20] Stop using deprecated is_pod Tom de Vries
2023-08-15 18:13 ` [PATCH 3/7] [gdb/build, c++20] Fix DISABLE_COPY_AND_ASSIGN use in ui_out_emit_type Tom de Vries
2023-08-15 18:13 ` Tom de Vries [this message]
2023-08-15 18:13 ` [PATCH 5/7] [gdb/build, c++20] Fix invalid conversion in test_symbols Tom de Vries
2023-08-15 18:13 ` [PATCH 6/7] [gdb/build] Return reference in target_read_auxv Tom de Vries
2023-08-16 18:23   ` Tom Tromey
2023-08-15 18:13 ` [PATCH 7/7] [gdb/build, c++20] Handle deprecated std::allocator::construct Tom de Vries
2023-08-16 18:27 ` [PATCH 0/7] [gdb/build] Fix -std=c++20 issues Tom Tromey
2023-08-21 11:04   ` Tom de Vries

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=20230815181309.8595-5-tdevries@suse.de \
    --to=tdevries@suse.de \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).