Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyfox@gentoo.org>
To: gdb-patches@sourceware.org,	Tom Tromey <tom@tromey.com>
Cc: Sergei Trofimovich <slyfox@gentoo.org>
Subject: [PATCH v2] gdb: unconditionally define _initialize_string_view_selftests
Date: Sun, 17 Mar 2019 22:28:00 -0000	[thread overview]
Message-ID: <20190317222731.11704-1-slyfox@gentoo.org> (raw)
In-Reply-To: <20190317222004.0afa508d@sf>

From: Sergei Trofimovich <siarheit@google.com>

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                         | 6 ++++++
 gdb/unittests/string_view-selftests.c | 6 ++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 862c89e821..7684d9be60 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2019-03-17  Sergei Trofimovich <siarheit@google.com>
+
+	* unittests/string_view-selftests.c: define
+	_initialize_string_view_selftests unconditionally.  This
+	fixes build failure on CXXFLAGS="-std=c++17" setup.
+
 2019-03-14  Eli Zaretskii  <eliz@gnu.org>
 
 	The MS-Windows port of ncurses fails to switch to a color pair if
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


  reply	other threads:[~2019-03-17 22:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 22:28 [PATCH] " Sergei Trofimovich
2019-03-15 14:24 ` Tom Tromey
2019-03-17 22:20   ` Sergei Trofimovich
2019-03-17 22:28     ` Sergei Trofimovich [this message]
2019-03-18  4:02       ` [PATCH v2] " Sergio Durigan Junior
2019-03-18  3:55     ` [PATCH] " Sergio Durigan Junior
2019-03-18 16:00       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190317222731.11704-1-slyfox@gentoo.org \
    --to=slyfox@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox