aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-06-27 16:32:57 +0100
committerPedro Alves <palves@redhat.com>2017-06-27 16:32:57 +0100
commit6da67eb10df978c1237ca863990f38cdd4ca2e95 (patch)
tree0fc750b2776a6e3b4df7cbdab4ef9928c0c88763
parent23732b1e32dd58f7c731d9aee56ff0b22a645d53 (diff)
downloadgdb-6da67eb10df978c1237ca863990f38cdd4ca2e95.zip
gdb-6da67eb10df978c1237ca863990f38cdd4ca2e95.tar.gz
gdb-6da67eb10df978c1237ca863990f38cdd4ca2e95.tar.bz2
completion_list_add_name wrapper functions
Replace macros with functions. gdb/ChangeLog: 2017-06-27 Pedro Alves <palves@redhat.com> * symtab.c (COMPLETION_LIST_ADD_SYMBOL) (MCOMPLETION_LIST_ADD_SYMBOL): Delete macros, replace with ... (completion_list_add_symbol, completion_list_add_msymbol): ... these new functions. (add_symtab_completions) (default_make_symbol_completion_list_break_on_1): Adjust.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/symtab.c40
2 files changed, 35 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c455d41..1ce56ca 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2017-06-27 Pedro Alves <palves@redhat.com>
+ * symtab.c (COMPLETION_LIST_ADD_SYMBOL)
+ (MCOMPLETION_LIST_ADD_SYMBOL): Delete macros, replace with ...
+ (completion_list_add_symbol, completion_list_add_msymbol):
+ ... these new functions.
+ (add_symtab_completions)
+ (default_make_symbol_completion_list_break_on_1): Adjust.
+
+2017-06-27 Pedro Alves <palves@redhat.com>
+
* objfiles.c (get_objfile_bfd_data): Call bfd_alloc instead of
bfd_zalloc. Call objfile_per_bfd_storage's ctor.
(free_objfile_per_bfd_storage): Call objfile_per_bfd_storage's
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f1daf8c..497d520 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -4837,18 +4837,8 @@ do_free_completion_list (void *list)
free_completion_list ((VEC (char_ptr) **) list);
}
-/* Helper routine for make_symbol_completion_list. */
-
static VEC (char_ptr) *return_val;
-#define COMPLETION_LIST_ADD_SYMBOL(symbol, sym_text, len, text, word) \
- completion_list_add_name \
- (SYMBOL_NATURAL_NAME (symbol), (sym_text), (len), (text), (word))
-
-#define MCOMPLETION_LIST_ADD_SYMBOL(symbol, sym_text, len, text, word) \
- completion_list_add_name \
- (MSYMBOL_NATURAL_NAME (symbol), (sym_text), (len), (text), (word))
-
/* Tracker for how many unique completions have been generated. Used
to terminate completion list generation early if the list has grown
to a size so large as to be useless. This helps avoid GDB seeming
@@ -4918,6 +4908,28 @@ completion_list_add_name (const char *symname,
}
}
+/* completion_list_add_name wrapper for struct symbol. */
+
+static void
+completion_list_add_symbol (symbol *sym,
+ const char *sym_text, int sym_text_len,
+ const char *text, const char *word)
+{
+ completion_list_add_name (SYMBOL_NATURAL_NAME (sym),
+ sym_text, sym_text_len, text, word);
+}
+
+/* completion_list_add_name wrapper for struct minimal_symbol. */
+
+static void
+completion_list_add_msymbol (minimal_symbol *sym,
+ const char *sym_text, int sym_text_len,
+ const char *text, const char *word)
+{
+ completion_list_add_name (MSYMBOL_NATURAL_NAME (sym),
+ sym_text, sym_text_len, text, word);
+}
+
/* ObjC: In case we are completing on a selector, look as the msymbol
again and feed all the selectors into the mill. */
@@ -5068,7 +5080,7 @@ add_symtab_completions (struct compunit_symtab *cust,
if (code == TYPE_CODE_UNDEF
|| (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
&& TYPE_CODE (SYMBOL_TYPE (sym)) == code))
- COMPLETION_LIST_ADD_SYMBOL (sym,
+ completion_list_add_symbol (sym,
sym_text, sym_text_len,
text, word);
}
@@ -5179,7 +5191,7 @@ default_make_symbol_completion_list_break_on_1 (const char *text,
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- MCOMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text,
+ completion_list_add_msymbol (msymbol, sym_text, sym_text_len, text,
word);
completion_list_objc_symbol (msymbol, sym_text, sym_text_len, text,
@@ -5226,14 +5238,14 @@ default_make_symbol_completion_list_break_on_1 (const char *text,
{
if (code == TYPE_CODE_UNDEF)
{
- COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text,
+ completion_list_add_symbol (sym, sym_text, sym_text_len, text,
word);
completion_list_add_fields (sym, sym_text, sym_text_len, text,
word);
}
else if (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
&& TYPE_CODE (SYMBOL_TYPE (sym)) == code)
- COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text,
+ completion_list_add_symbol (sym, sym_text, sym_text_len, text,
word);
}