public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] Unconditionally define _initialize_addrmap
@ 2021-08-06 18:32 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2021-08-06 18:32 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

The way that init.c is generated does not allow for an initialization
function to be conditionally defined -- doing so will result in a link
error.

This patch fixes a build problem that arises from such a conditional
definition.  It can be reproduce with --disable-unit-tests.
---
 gdb/addrmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 22817824cdc..49e51a388e1 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -681,11 +681,13 @@ test_addrmap ()
 }
 
 } // namespace selftests
+#endif /* GDB_SELF_TEST */
 
 void _initialize_addrmap ();
 void
 _initialize_addrmap ()
 {
+#if GDB_SELF_TEST
   selftests::register_test ("addrmap", selftests::test_addrmap);
-}
 #endif /* GDB_SELF_TEST */
+}
-- 
2.26.3


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

only message in thread, other threads:[~2021-08-06 18:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 18:32 [pushed] Unconditionally define _initialize_addrmap Tom Tromey

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