public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb: mark addrmap classes `final`
@ 2024-03-26  1:49 Simon Marchi
  0 siblings, 0 replies; only message in thread
From: Simon Marchi @ 2024-03-26  1:49 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1859fcf17799209720ef3431464139e5098ee91b

commit 1859fcf17799209720ef3431464139e5098ee91b
Author: Simon Marchi <simon.marchi@efficios.com>
Date:   Mon Mar 25 14:27:59 2024 -0400

    gdb: mark addrmap classes `final`
    
    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
    Approved-By: Tom Tromey <tom@tromey.com>

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

diff --git a/gdb/addrmap.h b/gdb/addrmap.h
index 55dea36b877..ed52e3cd990 100644
--- a/gdb/addrmap.h
+++ b/gdb/addrmap.h
@@ -80,8 +80,8 @@ private:
 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 @@ private:
 
 /* Mutable address maps.  */
 
-struct addrmap_mutable : public addrmap
+struct addrmap_mutable final : public addrmap
 {
 public:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-26  1:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26  1:49 [binutils-gdb] gdb: mark addrmap classes `final` Simon Marchi

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).