public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] Fix no-Python build
@ 2021-09-13 14:13 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2021-09-13 14:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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.
---
 gdb/python/python.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/python/python.c b/gdb/python/python.c
index 5918bb414a3..37eacefd8fc 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
-- 
2.31.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-13 14:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 14:13 [pushed] Fix no-Python build Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).