Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: unconditionally define _initialize_string_view_selftests
@ 2019-03-14 22:28 Sergei Trofimovich
  2019-03-15 14:24 ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Trofimovich @ 2019-03-14 22:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Sergei Trofimovich

The build failure was noticed by Helmut Jarausch in
https://bugs.gentoo.org/680232:
    $ ./configure CXXFLAGS='-std=c++17 -Os'
    ...
      CXXLD  gdb
    ld: init.o: in function `initialize_all_files()':
    init.c:(.text+0x113): undefined reference to `_initialize_string_view_selftests()'

It happens because '_initialize_string_view_selftests()' is
conditionally defined based on C++ default.

The change defines '_initialize_string_view_selftests()'
unconditionally and leaves implementation a no-op on c++17
compilers.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 gdb/unittests/string_view-selftests.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/unittests/string_view-selftests.c b/gdb/unittests/string_view-selftests.c
index 21a10e65af..b2a2bf7f2e 100644
--- a/gdb/unittests/string_view-selftests.c
+++ b/gdb/unittests/string_view-selftests.c
@@ -170,10 +170,12 @@ run_tests ()
 } /* namespace string_view */
 } /* namespace selftests */
 
+#endif /* __cplusplus < 201703L */
+
 void
 _initialize_string_view_selftests ()
 {
+#if defined(GDB_STRING_VIEW)
   selftests::register_test ("string_view", selftests::string_view::run_tests);
+#endif
 }
-
-#endif /* __cplusplus < 201703L */
-- 
2.21.0


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

end of thread, other threads:[~2019-03-18 16:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 22:28 [PATCH] gdb: unconditionally define _initialize_string_view_selftests Sergei Trofimovich
2019-03-15 14:24 ` Tom Tromey
2019-03-17 22:20   ` Sergei Trofimovich
2019-03-17 22:28     ` [PATCH v2] " Sergei Trofimovich
2019-03-18  4:02       ` Sergio Durigan Junior
2019-03-18  3:55     ` [PATCH] " Sergio Durigan Junior
2019-03-18 16:00       ` Tom Tromey

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