From: Simon Marchi Date: Wed, 13 Jan 2021 16:57:24 +0000 (-0500) Subject: gdb: bool-ify ext_lang_auto_load_enabled and friends X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=db972fce46368f7d2a60e43aca78f0757515c0c8;p=binutils-gdb.git gdb: bool-ify ext_lang_auto_load_enabled and friends Make it and related functions return bool. Move function comments to header where applicable. gdb/ChangeLog: * auto-load.h (auto_load_gdb_scripts_enabled): Return bool, move comment here. * auto-load.c (auto_load_gdb_scripts_enabled): Return bool, move comment to header. * extension-priv.h (struct extension_language_script_ops) : Return bool. * extension.h (ext_lang_auto_load_enabled): Return bool, move comment here. * extension.c (ext_lang_auto_load_enabled): Return bool, move comment to header. * guile/guile-header.h (gdbscm_auto_load_enabled): Return bool, move comment here. * guile/scm-auto-load.c (gdbscm_auto_load_enabled): Return bool, move comment to header. * python/python-header.h (gdbpy_auto_load_enabled): Return bool, move comment here. * python/py-auto-load.c (gdbpy_auto_load_enabled): Return bool, move comment to header. Change-Id: I657a17d2dab77a36884a137ce9b23a2cc6d53140 --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d0b78c708d7..e9f7982cf00 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +2021-01-13 Simon Marchi + + * auto-load.h (auto_load_gdb_scripts_enabled): Return bool, move + comment here. + * auto-load.c (auto_load_gdb_scripts_enabled): Return bool, move + comment to header. + * extension-priv.h (struct extension_language_script_ops) + : Return bool. + * extension.h (ext_lang_auto_load_enabled): Return bool, move + comment here. + * extension.c (ext_lang_auto_load_enabled): Return bool, move + comment to header. + * guile/guile-header.h (gdbscm_auto_load_enabled): Return bool, + move comment here. + * guile/scm-auto-load.c (gdbscm_auto_load_enabled): Return bool, + move comment to header. + * python/python-header.h (gdbpy_auto_load_enabled): Return bool, + move comment here. + * python/py-auto-load.c (gdbpy_auto_load_enabled): Return bool, + move comment to header. + 2021-01-13 Simon Marchi * auto-load.h (file_is_auto_load_safe): Change return type to diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 7b4cd73ea57..0d5532b4882 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -93,9 +93,9 @@ show_auto_load_gdb_scripts (struct ui_file *file, int from_tty, value); } -/* Return non-zero if auto-loading gdb scripts is enabled. */ +/* See auto-load.h. */ -int +bool auto_load_gdb_scripts_enabled (const struct extension_language_defn *extlang) { return auto_load_gdb_scripts; diff --git a/gdb/auto-load.h b/gdb/auto-load.h index c644b4694ac..ec802395d3e 100644 --- a/gdb/auto-load.h +++ b/gdb/auto-load.h @@ -56,7 +56,9 @@ extern bool file_is_auto_load_safe (const char *filename, const char *debug_fmt, ...) ATTRIBUTE_PRINTF (2, 3); -extern int auto_load_gdb_scripts_enabled +/* Return true if auto-loading gdb scripts is enabled. */ + +extern bool auto_load_gdb_scripts_enabled (const struct extension_language_defn *extlang); #endif /* AUTO_LOAD_H */ diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h index 7f99f3e1ca1..1b6701ba6cc 100644 --- a/gdb/extension-priv.h +++ b/gdb/extension-priv.h @@ -92,7 +92,7 @@ struct extension_language_script_ops /* Return non-zero if auto-loading scripts in this extension language is enabled. */ - int (*auto_load_enabled) (const struct extension_language_defn *); + bool (*auto_load_enabled) (const struct extension_language_defn *); }; /* The interface for making calls from GDB to an external extension diff --git a/gdb/extension.c b/gdb/extension.c index 289f527ee49..0e0d42685fc 100644 --- a/gdb/extension.c +++ b/gdb/extension.c @@ -282,14 +282,13 @@ ext_lang_objfile_script_executor return extlang->script_ops->objfile_script_executor; } -/* Return non-zero if auto-loading of EXTLANG scripts is enabled. - Zero is returned if support for this language isn't compiled in. */ +/* See extension.h. */ -int +bool ext_lang_auto_load_enabled (const struct extension_language_defn *extlang) { if (extlang->script_ops == NULL) - return 0; + return false; /* The extension language is required to implement this function. */ gdb_assert (extlang->script_ops->auto_load_enabled != NULL); diff --git a/gdb/extension.h b/gdb/extension.h index 98a4d7cf839..a505c68d25e 100644 --- a/gdb/extension.h +++ b/gdb/extension.h @@ -268,7 +268,10 @@ extern objfile_script_sourcer_func *ext_lang_objfile_script_sourcer extern objfile_script_executor_func *ext_lang_objfile_script_executor (const struct extension_language_defn *); -extern int ext_lang_auto_load_enabled (const struct extension_language_defn *); +/* Return true if auto-loading of EXTLANG scripts is enabled. + False is returned if support for this language isn't compiled in. */ + +extern bool ext_lang_auto_load_enabled (const struct extension_language_defn *); /* Wrappers for each extension language API function that iterate over all extension languages. */ diff --git a/gdb/guile/guile-internal.h b/gdb/guile/guile-internal.h index 1fa60c5d382..c48547a41cd 100644 --- a/gdb/guile/guile-internal.h +++ b/gdb/guile/guile-internal.h @@ -595,7 +595,10 @@ extern struct value *vlscm_convert_value_from_scheme extern objfile_script_sourcer_func gdbscm_source_objfile_script; extern objfile_script_executor_func gdbscm_execute_objfile_script; -extern int gdbscm_auto_load_enabled (const struct extension_language_defn *); +/* Return true if auto-loading Guile scripts is enabled. + This is the extension_language_script_ops.auto_load_enabled "method". */ + +extern bool gdbscm_auto_load_enabled (const struct extension_language_defn *); extern void gdbscm_preserve_values (const struct extension_language_defn *, diff --git a/gdb/guile/scm-auto-load.c b/gdb/guile/scm-auto-load.c index 4a7b2e2df1f..569a47f69ca 100644 --- a/gdb/guile/scm-auto-load.c +++ b/gdb/guile/scm-auto-load.c @@ -41,10 +41,9 @@ show_auto_load_guile_scripts (struct ui_file *file, int from_tty, fprintf_filtered (file, _("Auto-loading of Guile scripts is %s.\n"), value); } -/* Return non-zero if auto-loading Guile scripts is enabled. - This is the extension_language_script_ops.auto_load_enabled "method". */ +/* See guile-internal.h. */ -int +bool gdbscm_auto_load_enabled (const struct extension_language_defn *extlang) { return auto_load_guile_scripts; diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c index 1879346db24..3b279312e88 100644 --- a/gdb/python/py-auto-load.c +++ b/gdb/python/py-auto-load.c @@ -40,10 +40,9 @@ show_auto_load_python_scripts (struct ui_file *file, int from_tty, fprintf_filtered (file, _("Auto-loading of Python scripts is %s.\n"), value); } -/* Return non-zero if auto-loading Python scripts is enabled. - This is the extension_language_script_ops.auto_load_enabled "method". */ +/* See python-internal.h. */ -int +bool gdbpy_auto_load_enabled (const struct extension_language_defn *extlang) { return auto_load_python_scripts; diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index e1b62f6323c..56702cad53a 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -379,7 +379,10 @@ extern struct cmd_list_element *show_python_list; /* extension_language_script_ops "methods". */ -extern int gdbpy_auto_load_enabled (const struct extension_language_defn *); +/* Return true if auto-loading Python scripts is enabled. + This is the extension_language_script_ops.auto_load_enabled "method". */ + +extern bool gdbpy_auto_load_enabled (const struct extension_language_defn *); /* extension_language_ops "methods". */