From: Pedro Alves Date: Mon, 17 Jul 2017 10:55:42 +0000 (+0100) Subject: Rename make_symbol_completion_list_fn -> symbol_completer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=78b13106edcd14d87b4cc0b7f8dce8db8c2be489;p=binutils-gdb.git Rename make_symbol_completion_list_fn -> symbol_completer "make_symbol_completion_list_fn" is odly named when you look at a list of "standard" completers, like the Python/Guile completer lists adjusted by this patch. Rename / move it to completers.h/c, for consistency. gdb/ChangeLog: 2017-07-17 Pedro Alves * completer.c (symbol_completer): New function, based on make_symbol_completion_list_fn. * completer.h (symbol_completer): New declaration. * guile/scm-cmd.c (cmdscm_completers): Adjust. * python/py-cmd.c (completers): Adjust. * symtab.c (make_symbol_completion_list_fn): Delete. * symtab.h (make_symbol_completion_list_fn): Delete. * cli/cli-decode.c (add_cmd): Adjust. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8b37cda6b47..3e41709f8ae 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2017-07-17 Pedro Alves + + * completer.c (symbol_completer): New function, based on + make_symbol_completion_list_fn. + * completer.h (symbol_completer): New declaration. + * guile/scm-cmd.c (cmdscm_completers): Adjust. + * python/py-cmd.c (completers): Adjust. + * symtab.c (make_symbol_completion_list_fn): Delete. + * symtab.h (make_symbol_completion_list_fn): Delete. + * cli/cli-decode.c (add_cmd): Adjust. + 2017-07-17 Pedro Alves * Makefile.in (COMMON_OBS): Add filename-seen-cache.o. diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 383adf8b1ac..0a78f4e5a8e 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -244,7 +244,7 @@ add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, c->allow_unknown = 0; c->prefix = NULL; c->abbrev_flag = 0; - set_cmd_completer (c, make_symbol_completion_list_fn); + set_cmd_completer (c, symbol_completer); c->completer_handle_brkchars = NULL; c->destroyer = NULL; c->type = not_set_cmd; diff --git a/gdb/completer.c b/gdb/completer.c index 68e68eb8d68..89cecbc9a8b 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -663,6 +663,15 @@ set_gdb_completion_word_break_characters (completer_ftype *fn) set_rl_completer_word_break_characters (break_chars); } +/* Complete on symbols. */ + +VEC (char_ptr) * +symbol_completer (struct cmd_list_element *ignore, + const char *text, const char *word) +{ + return make_symbol_completion_list (text, word); +} + /* Here are some useful test cases for completion. FIXME: These should be put in the test suite. They should be tested with both M-? and TAB. diff --git a/gdb/completer.h b/gdb/completer.h index 2aa1987f303..0a40eaa5025 100644 --- a/gdb/completer.h +++ b/gdb/completer.h @@ -87,6 +87,9 @@ extern VEC (char_ptr) *expression_completer (struct cmd_list_element *, extern VEC (char_ptr) *location_completer (struct cmd_list_element *, const char *, const char *); +extern VEC (char_ptr) *symbol_completer (struct cmd_list_element *, + const char *, const char *); + extern VEC (char_ptr) *command_completer (struct cmd_list_element *, const char *, const char *); diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c index ae5d14599db..0c6419d9d04 100644 --- a/gdb/guile/scm-cmd.c +++ b/gdb/guile/scm-cmd.c @@ -114,7 +114,7 @@ static const struct cmdscm_completer cmdscm_completers[] = { "COMPLETE_FILENAME", filename_completer }, { "COMPLETE_LOCATION", location_completer }, { "COMPLETE_COMMAND", command_completer }, - { "COMPLETE_SYMBOL", make_symbol_completion_list_fn }, + { "COMPLETE_SYMBOL", symbol_completer }, { "COMPLETE_EXPRESSION", expression_completer }, }; diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c index 62032115b0c..72ea5770818 100644 --- a/gdb/python/py-cmd.c +++ b/gdb/python/py-cmd.c @@ -44,7 +44,7 @@ static const struct cmdpy_completer completers[] = { "COMPLETE_FILENAME", filename_completer }, { "COMPLETE_LOCATION", location_completer }, { "COMPLETE_COMMAND", command_completer }, - { "COMPLETE_SYMBOL", make_symbol_completion_list_fn }, + { "COMPLETE_SYMBOL", symbol_completer }, { "COMPLETE_EXPRESSION", expression_completer }, }; diff --git a/gdb/symtab.c b/gdb/symtab.c index 44809aeaff5..e5cd397f6ca 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -5299,16 +5299,6 @@ make_symbol_completion_type (const char *text, const char *word, return current_language->la_make_symbol_completion_list (text, word, code); } -/* Like make_symbol_completion_list, but suitable for use as a - completion function. */ - -VEC (char_ptr) * -make_symbol_completion_list_fn (struct cmd_list_element *ignore, - const char *text, const char *word) -{ - return make_symbol_completion_list (text, word); -} - /* Like make_symbol_completion_list, but returns a list of symbols defined in all source files name SRCFILE. */ diff --git a/gdb/symtab.h b/gdb/symtab.h index 30d7eeeb843..5261a6940c9 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1507,9 +1507,6 @@ extern VEC (char_ptr) *default_make_symbol_completion_list (const char *, extern VEC (char_ptr) *make_symbol_completion_list (const char *, const char *); extern VEC (char_ptr) *make_symbol_completion_type (const char *, const char *, enum type_code); -extern VEC (char_ptr) *make_symbol_completion_list_fn (struct cmd_list_element *, - const char *, - const char *); extern VEC (char_ptr) *make_file_symbol_completion_list (const char *, const char *,