gdb: unconditionally define _initialize_string_view_selftests
authorSergei Trofimovich <siarheit@google.com>
Sun, 17 Mar 2019 22:27:31 +0000 (22:27 +0000)
committerSergio Durigan Junior <sergiodj@redhat.com>
Mon, 18 Mar 2019 04:01:13 +0000 (00:01 -0400)
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.

gdb/ChangeLog:
2019-03-17  Sergei Trofimovich <siarheit@google.com>

* unittests/string_view-selftests.c: Define
_initialize_string_view_selftests unconditionally.

gdb/ChangeLog
gdb/unittests/string_view-selftests.c

index cb7f6b0..0c39c19 100644 (file)
@@ -1,3 +1,8 @@
+2019-03-17  Sergei Trofimovich <siarheit@google.com>
+
+       * unittests/string_view-selftests.c: Define
+       _initialize_string_view_selftests unconditionally.
+
 2019-03-17  Vladimir Martyanov  <vilgeforce@gmail.com>
 
        PR gdb/24350
index 21a10e6..b2a2bf7 100644 (file)
@@ -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 */