diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-01-13 11:57:24 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-01-13 11:57:24 -0500 |
commit | db972fce46368f7d2a60e43aca78f0757515c0c8 (patch) | |
tree | d447ae34443d4a8d46728ff9c04ffe9ff124bcac | |
parent | 5e12f48ffbf5eba4524fdbae341f091c7cd0cb72 (diff) | |
download | gdb-db972fce46368f7d2a60e43aca78f0757515c0c8.zip gdb-db972fce46368f7d2a60e43aca78f0757515c0c8.tar.gz gdb-db972fce46368f7d2a60e43aca78f0757515c0c8.tar.bz2 |
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
-rw-r--r-- | gdb/ChangeLog | 21 | ||||
-rw-r--r-- | gdb/auto-load.c | 4 | ||||
-rw-r--r-- | gdb/auto-load.h | 4 | ||||
-rw-r--r-- | gdb/extension-priv.h | 2 | ||||
-rw-r--r-- | gdb/extension.c | 7 | ||||
-rw-r--r-- | gdb/extension.h | 5 | ||||
-rw-r--r-- | gdb/guile/guile-internal.h | 5 | ||||
-rw-r--r-- | gdb/guile/scm-auto-load.c | 5 | ||||
-rw-r--r-- | gdb/python/py-auto-load.c | 5 | ||||
-rw-r--r-- | gdb/python/python-internal.h | 5 |
10 files changed, 46 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d0b78c7..e9f7982 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,26 @@ 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 bool, move comment here. * auto-load.c (file_is_auto_load_safe): Change return type and diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 7b4cd73..0d5532b 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 c644b46..ec80239 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 7f99f3e..1b6701b 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 289f527..0e0d426 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 98a4d7c..a505c68 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 1fa60c5..c48547a 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 4a7b2e2..569a47f 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 1879346d..3b279312 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 e1b62f6..56702ca 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". */ |