aboutsummaryrefslogtreecommitdiff
path: root/gdb/maint.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-10-29 14:11:08 +0200
committerTom de Vries <tdevries@suse.de>2021-10-29 14:11:08 +0200
commitb88e456f7e3e6d8c354da57d3e77a98575070ee8 (patch)
treeae039d8d59040b4948105511f21e612d143c3ee4 /gdb/maint.c
parent91b7c7e522802371f07cf614e5e5b24c1911a6d8 (diff)
downloadgdb-b88e456f7e3e6d8c354da57d3e77a98575070ee8.zip
gdb-b88e456f7e3e6d8c354da57d3e77a98575070ee8.tar.gz
gdb-b88e456f7e3e6d8c354da57d3e77a98575070ee8.tar.bz2
[gdb/build] Fix build with --disable-unit-tests
A build with --disable-unit-tests currently run into: ... ld: maint.o: in function \ `maintenance_selftest_completer(cmd_list_element*, completion_tracker&, char const*, char const*)': src/gdb/maint.c:1183: undefined reference to \ `selftests::for_each_selftest( gdb::function_view< void (std::__cxx11::basic_string<char,std::char_traits<char>, std::allocator<char> > const&)>)' ... Fix this by guarding the call to selftests::for_each_selftest in maintenance_selftest_completer with GDB_SELF_TEST, such that the "-verbose" completion still works. Rebuild on x86_64-linux and ran gdb.gdb/unittest.exp.
Diffstat (limited to 'gdb/maint.c')
-rw-r--r--gdb/maint.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/maint.c b/gdb/maint.c
index 85fa18c..bcc71aa 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -1180,11 +1180,13 @@ maintenance_selftest_completer (cmd_list_element *cmd,
(tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_ERROR, grp))
return;
+#if GDB_SELF_TEST
selftests::for_each_selftest ([&tracker, text] (const std::string &name)
{
if (startswith (name.c_str (), text))
tracker.add_completion (make_unique_xstrdup (name.c_str ()));
});
+#endif
}
static void