Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@efficios.com>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@efficios.com>
Subject: [PATCH 1/2] gdb: mark addrmap classes `final`
Date: Mon, 25 Mar 2024 14:27:59 -0400	[thread overview]
Message-ID: <20240325183011.1037710-2-simon.marchi@efficios.com> (raw)
In-Reply-To: <20240325183011.1037710-1-simon.marchi@efficios.com>

When building GDB with clang, I see:

    /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:95:2: error: delete called on non-final 'addrmap_mutable' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non
    -abstract-non-virtual-dtor]
       95 |         delete __ptr;
          |         ^
    /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:396:4: note: in instantiation of member function 'std::default_delete<addrmap_mutable>::operator()' requested here
      396 |           get_deleter()(std::move(__ptr));
          |           ^
    /home/smarchi/src/binutils-gdb/gdb/addrmap.c:422:14: note: in instantiation of member function 'std::unique_ptr<addrmap_mutable>::~unique_ptr' requested here
      422 |   auto map = std::make_unique<struct addrmap_mutable> ();
          |              ^

Fix that by making `addrmap_mutable` final, and `addrmap_fixed` too
while at it.

Change-Id: I03aa0b0907c8d0e3390ddbedeb77d73b19b2b526
---
 gdb/addrmap.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gdb/addrmap.h b/gdb/addrmap.h
index 55dea36b8771..ed52e3cd990d 100644
--- a/gdb/addrmap.h
+++ b/gdb/addrmap.h
@@ -80,8 +80,8 @@ struct addrmap
 struct addrmap_mutable;
 
 /* Fixed address maps.  */
-struct addrmap_fixed : public addrmap,
-		       public allocate_on_obstack<addrmap_fixed>
+struct addrmap_fixed final : public addrmap,
+			     public allocate_on_obstack<addrmap_fixed>
 {
 public:
 
@@ -116,7 +116,7 @@ struct addrmap_fixed : public addrmap,
 
 /* Mutable address maps.  */
 
-struct addrmap_mutable : public addrmap
+struct addrmap_mutable final : public addrmap
 {
 public:
 
-- 
2.44.0


  reply	other threads:[~2024-03-25 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 18:27 [PATCH 0/2] Fix some trivial build failures with clang Simon Marchi
2024-03-25 18:27 ` Simon Marchi [this message]
2024-03-25 18:28 ` [PATCH 2/2] gdbserver/Makefile.in: add missing `-x c++` Simon Marchi
2024-03-26  0:33 ` [PATCH 0/2] Fix some trivial build failures with clang Tom Tromey
2024-03-26  1:49   ` Simon Marchi

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=20240325183011.1037710-2-simon.marchi@efficios.com \
    --to=simon.marchi@efficios.com \
    --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