From c6a6aad52d9e839d6a84ac31cabe2b7e1a2a31a0 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Mon, 25 Oct 2021 17:25:45 +0100 Subject: [PATCH] gdb/python: make some global variables static Make a couple of global variables static in python/python.c. To do this I had to move the definition of extension_language_python to later in the file. There should be no user visible changes after this commit. --- gdb/python/python.c | 53 ++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/gdb/python/python.c b/gdb/python/python.c index 593fbc1be7a..d8a6a5978de 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -58,33 +58,6 @@ static const char *const python_excp_enums[] = the default. */ static const char *gdbpy_should_print_stack = python_excp_message; -#ifdef HAVE_PYTHON -/* Forward decls, these are defined later. */ -extern const struct extension_language_script_ops python_extension_script_ops; -extern const struct extension_language_ops python_extension_ops; -#endif - -/* The main struct describing GDB's interface to the Python - extension language. */ -const struct extension_language_defn extension_language_python = -{ - EXT_LANG_PYTHON, - "python", - "Python", - - ".py", - "-gdb.py", - - python_control, - -#ifdef HAVE_PYTHON - &python_extension_script_ops, - &python_extension_ops -#else - NULL, - NULL -#endif -}; #ifdef HAVE_PYTHON @@ -151,7 +124,7 @@ static gdb::optional gdbpy_colorize /* The interface between gdb proper and loading of python scripts. */ -const struct extension_language_script_ops python_extension_script_ops = +static const struct extension_language_script_ops python_extension_script_ops = { gdbpy_source_script, gdbpy_source_objfile_script, @@ -161,7 +134,7 @@ const struct extension_language_script_ops python_extension_script_ops = /* The interface between gdb proper and python extensions. */ -const struct extension_language_ops python_extension_ops = +static const struct extension_language_ops python_extension_ops = { gdbpy_initialize, gdbpy_initialized, @@ -191,6 +164,28 @@ const struct extension_language_ops python_extension_ops = gdbpy_colorize, }; +/* The main struct describing GDB's interface to the Python + extension language. */ +const struct extension_language_defn extension_language_python = +{ + EXT_LANG_PYTHON, + "python", + "Python", + + ".py", + "-gdb.py", + + python_control, + +#ifdef HAVE_PYTHON + &python_extension_script_ops, + &python_extension_ops +#else + NULL, + NULL +#endif +}; + /* Architecture and language to be used in callbacks from the Python interpreter. */ struct gdbarch *python_gdbarch; -- 2.30.2