From patchwork Thu Mar 14 22:28:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Trofimovich X-Patchwork-Id: 31857 Received: (qmail 40343 invoked by alias); 14 Mar 2019 22:28:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 40285 invoked by uid 89); 14 Mar 2019 22:28:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 spammy=helmut, cxxld, CXXLD, HContent-Transfer-Encoding:8bit X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Mar 2019 22:28:36 +0000 Received: from sf.home (trofi-1-pt.tunnel.tserv1.lon2.ipv6.he.net [IPv6:2001:470:1f1c:a0f::2]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: slyfox) by smtp.gentoo.org (Postfix) with ESMTPSA id 3E38F335CC0; Thu, 14 Mar 2019 22:28:35 +0000 (UTC) Received: by sf.home (Postfix, from userid 1000) id 8C54B2379E4C8; Thu, 14 Mar 2019 22:28:31 +0000 (GMT) From: Sergei Trofimovich To: gdb-patches@sourceware.org Cc: Sergei Trofimovich Subject: [PATCH] gdb: unconditionally define _initialize_string_view_selftests Date: Thu, 14 Mar 2019 22:28:28 +0000 Message-Id: <20190314222828.28798-1-slyfox@gentoo.org> MIME-Version: 1.0 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 --- 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 */