[PATCH 09/40] Rename make_symbol_completion_list_fn -> symbol_completer

Pedro Alves
2017-06-02T12:22:49Z

"make_symbol_completion_list_fn" is odly named when you look at a list
of "standard" completers, like the Python/Guild completer lists
adjusted by this patch. Rename / move it to completers.h/c, for
consistency.

gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>

* 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.
---
gdb/cli/cli-decode.c | 2 +-
gdb/completer.c | 9 +++++++++
gdb/completer.h | 3 +++
gdb/guile/scm-cmd.c | 2 +-
gdb/python/py-cmd.c | 2 +-
gdb/symtab.c | 10 ----------
gdb/symtab.h | 3 ---
7 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index d386d02..f982028 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 ee587fb..4ab2388 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -671,6 +671,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 2aa1987..0a40eaa 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 ae5d145..0c6419d 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 6203211..72ea577 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 183164d..09c9411b 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5310,16 +5310,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 a source file FILE. */

diff --git a/gdb/symtab.h b/gdb/symtab.h
index 341deca..5901cf9 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 *,
--
2.5.5