aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/python.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2021-09-13 07:49:36 -0600
committerTom Tromey <tromey@adacore.com>2021-09-13 07:49:36 -0600
commite68b7db18cf127d054bebe9d6b28c0bfeadaf18a (patch)
tree21465e4fb1f96303374a68c9be2a939130ec1ebe /gdb/python/python.c
parent18287cf8b19533429a4b7f17726c93d1f292e1df (diff)
downloadgdb-e68b7db18cf127d054bebe9d6b28c0bfeadaf18a.zip
gdb-e68b7db18cf127d054bebe9d6b28c0bfeadaf18a.tar.gz
gdb-e68b7db18cf127d054bebe9d6b28c0bfeadaf18a.tar.bz2
Fix no-Python build
A build without Python will currently fail, because selftests::test_python uses gdb_python_initialized, which is only conditionally defined. This patch fixes the build by making test_python also be conditionally defined. I chose this approach because the selftest will fail if Python is not enabled, so it didn't seem useful to leave it defined.
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r--gdb/python/python.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c
index 5918bb4..37eacef 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1878,8 +1878,6 @@ do_start_initialization ()
return true;
}
-#endif /* HAVE_PYTHON */
-
#if GDB_SELF_TEST
namespace selftests {
@@ -1921,6 +1919,8 @@ test_python ()
} // namespace selftests
#endif /* GDB_SELF_TEST */
+#endif /* HAVE_PYTHON */
+
/* See python.h. */
cmd_list_element *python_cmd_element = nullptr;
@@ -2020,9 +2020,11 @@ python executable."),
&user_set_python_list,
&user_show_python_list);
+#ifdef HAVE_PYTHON
#if GDB_SELF_TEST
selftests::register_test ("python", selftests::test_python);
#endif /* GDB_SELF_TEST */
+#endif /* HAVE_PYTHON */
}
#ifdef HAVE_PYTHON