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)
	<auto_load_enabled>: 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
This commit is contained in:
Simon Marchi 2021-01-13 11:57:24 -05:00
parent 5e12f48ffb
commit db972fce46
10 changed files with 46 additions and 17 deletions

View File

@ -1,3 +1,24 @@
2021-01-13 Simon Marchi <simon.marchi@polymtl.ca>
* 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)
<auto_load_enabled>: 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 <simon.marchi@polymtl.ca>
* auto-load.h (file_is_auto_load_safe): Change return type to

View File

@ -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;

View File

@ -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 */

View File

@ -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

View File

@ -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);

View File

@ -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. */

View File

@ -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 *,

View File

@ -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;

View File

@ -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;

View File

@ -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". */