Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix some trivial build failures with clang
@ 2024-03-25 18:27 Simon Marchi
  2024-03-25 18:27 ` [PATCH 1/2] gdb: mark addrmap classes `final` Simon Marchi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Simon Marchi @ 2024-03-25 18:27 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

Fix two trivial build failures when building with Clang.  I see more
problems, but they were not as trivial, so I'm leaving them for another
patch series.

Simon Marchi (2):
  gdb: mark addrmap classes `final`
  gdbserver/Makefile.in: add missing `-x c++`

 gdb/addrmap.h         | 6 +++---
 gdbserver/Makefile.in | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)


base-commit: 7879fba359f185d674d4e981af4f23a066bfe644
-- 
2.44.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] gdb: mark addrmap classes `final`
  2024-03-25 18:27 [PATCH 0/2] Fix some trivial build failures with clang Simon Marchi
@ 2024-03-25 18:27 ` Simon Marchi
  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
  2 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2024-03-25 18:27 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] gdbserver/Makefile.in: add missing `-x c++`
  2024-03-25 18:27 [PATCH 0/2] Fix some trivial build failures with clang Simon Marchi
  2024-03-25 18:27 ` [PATCH 1/2] gdb: mark addrmap classes `final` Simon Marchi
@ 2024-03-25 18:28 ` Simon Marchi
  2024-03-26  0:33 ` [PATCH 0/2] Fix some trivial build failures with clang Tom Tromey
  2 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2024-03-25 18:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

When building with Clang, I get:

      CXX    nat/x86-linux-tdesc-ipa.o
    clang++: error: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Werror,-Wdeprecated]

Fix that by adding the missing `-x c++` in the rule building
`gdb/nat/*.c` files for the in-process agent.

Change-Id: Ie53e4b9a8b57bef9669397fdfaf21617107c7180
---
 gdbserver/Makefile.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
index bd6f68e7f2cf..5506701106df 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
@@ -520,7 +520,7 @@ gdbsupport/%-ipa.o: ../gdbsupport/%.cc
 	$(POSTCOMPILE)
 
 nat/%-ipa.o: ../gdb/nat/%.c
-	$(IPAGENT_COMPILE) $<
+	$(IPAGENT_COMPILE) -x c++ $<
 	$(POSTCOMPILE)
 
 %-ipa.o: ../gdb/%.c
-- 
2.44.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Fix some trivial build failures with clang
  2024-03-25 18:27 [PATCH 0/2] Fix some trivial build failures with clang Simon Marchi
  2024-03-25 18:27 ` [PATCH 1/2] gdb: mark addrmap classes `final` Simon Marchi
  2024-03-25 18:28 ` [PATCH 2/2] gdbserver/Makefile.in: add missing `-x c++` Simon Marchi
@ 2024-03-26  0:33 ` Tom Tromey
  2024-03-26  1:49   ` Simon Marchi
  2 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2024-03-26  0:33 UTC (permalink / raw)
  To: Simon Marchi; +Cc: gdb-patches

>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

Simon> Fix two trivial build failures when building with Clang.  I see more
Simon> problems, but they were not as trivial, so I'm leaving them for another
Simon> patch series.

Thanks.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] Fix some trivial build failures with clang
  2024-03-26  0:33 ` [PATCH 0/2] Fix some trivial build failures with clang Tom Tromey
@ 2024-03-26  1:49   ` Simon Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2024-03-26  1:49 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi; +Cc: gdb-patches



On 2024-03-25 20:33, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
> 
> Simon> Fix two trivial build failures when building with Clang.  I see more
> Simon> problems, but they were not as trivial, so I'm leaving them for another
> Simon> patch series.
> 
> Thanks.
> Approved-By: Tom Tromey <tom@tromey.com>
> 
> Tom

Thanks, pushed.

Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-26  1:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-25 18:27 [PATCH 0/2] Fix some trivial build failures with clang Simon Marchi
2024-03-25 18:27 ` [PATCH 1/2] gdb: mark addrmap classes `final` Simon Marchi
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox