summaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-10-13 22:58:21 -0600
committerTom Tromey <tom@tromey.com>2017-11-07 13:59:09 -0700
commit5fed81ff351121887a93b5b57caebb86667cbbd2 (patch)
tree571f96134b9dd45b2778469c750a59ccc62bb624 /gdb/cli
parent1d12d88f186fe1ae66deccf877b5509c506c4d39 (diff)
Remove cmd_cfunc_ftype
This removes cmd_cfunc_ftype and the non-const overload of add_cmd; then fixes up the fallout. For the most part this patch is straightforward. There are a few files (go32-nat.c, windows-nat.c, and gnu-nat.c) that I could not compile; so I made a best effort there. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * go32-nat.c (go32_sysinfo, go32_sldt, go32_sgdt, go32_sidt) (go32_pde, go32_pte, go32_pte_for_address): Constify. * gnu-nat.c (_parse_bool_arg, show_thread_default_pause_cmd) (set_thread_default_pause_cmd, set_thread_default_run_cmd) (show_thread_default_run_cmd, set_thread_default_detach_sc_cmd) (parse_int_arg, show_thread_default_detach_sc_cmd) (set_signals_cmd, show_signals_cmd, set_sig_thread_cmd) (show_sig_thread_cmd, set_stopped_cmd, show_stopped_cmd) (set_exceptions_cmd, show_exceptions_cmd, set_task_pause_cmd) (show_task_pause_cmd, set_task_detach_sc_cmd) (show_task_detach_sc_cmd, set_task_exc_port_cmd) (set_noninvasive_cmd, set_thread_pause_cmd) (show_thread_pause_cmd, set_thread_run_cmd, show_thread_run_cmd) (set_thread_detach_sc_cmd, show_thread_detach_sc_cmd) (set_thread_exc_port_cmd, thread_takeover_sc_cmd): Constify. * windows-nat.c (display_selectors): Constify. * cli/cli-decode.h (struct cmd_list_element) <function>: Remove non-const "cfunc". * cli/cli-decode.c (set_cmd_cfunc): Remove non-const overload. (cmd_cfunc_eq): Likewise. (struct cmd_list_element): Likewise. (do_cfunc): Remove. (cli_user_command_p): Update. * command.h (add_cmd): Remove non-const overload. (cmd_cfunc_ftype): Remove typedef. (cmd_cfunc_eq): Remove non-const overload. * value.c (show_values): Constify. * thread.c (thread_apply_all_command): Constify. * symfile.c (load_command): Constify. * source.c (directory_command): Constify. * maint.c (maintenance_internal_error) (maintenance_demangler_warning, maintenance_space_display) (maintenance_print_architecture, maintenance_translate_address) (maintenance_info_selftests, maintenance_internal_warning): Constify. * breakpoint.c (disable_trace_command, enable_trace_command): Constify. * auto-load.c (info_auto_load_local_gdbinit, add_auto_load_dir): Constify. (add_auto_load_safe_path): Constify. * guile/scm-auto-load.c (info_auto_load_guile_scripts): Constify. * top.h (show_commands): Constify. * linux-thread-db.c (info_auto_load_libthread_db): Constify. * sparc64-tdep.c (adi_examine_command): Constify. (adi_assign_command): Constify.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-decode.c36
-rw-r--r--gdb/cli/cli-decode.h2
2 files changed, 2 insertions, 36 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 0c555268b3..459438e170 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -101,22 +101,6 @@ print_help_for_command (struct cmd_list_element *c, const char *prefix,
bounce function (unless cfunc / sfunc is NULL that is). */
static void
-do_cfunc (struct cmd_list_element *c, char *args, int from_tty)
-{
- c->function.cfunc (args, from_tty);
-}
-
-static void
-set_cmd_cfunc (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
-{
- if (cfunc == NULL)
- cmd->func = NULL;
- else
- cmd->func = do_cfunc;
- cmd->function.cfunc = cfunc;
-}
-
-static void
do_const_cfunc (struct cmd_list_element *c, char *args, int from_tty)
{
c->function.const_cfunc (args, from_tty);
@@ -149,12 +133,6 @@ set_cmd_sfunc (struct cmd_list_element *cmd, cmd_sfunc_ftype *sfunc)
}
int
-cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
-{
- return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
-}
-
-int
cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
{
return cmd->func == do_const_cfunc && cmd->function.const_cfunc == cfunc;
@@ -281,21 +259,12 @@ do_add_cmd (const char *name, enum command_class theclass,
}
struct cmd_list_element *
-add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
- const char *doc, struct cmd_list_element **list)
-{
- cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
- set_cmd_cfunc (result, fun);
- return result;
-}
-
-struct cmd_list_element *
add_cmd (const char *name, enum command_class theclass,
const char *doc, struct cmd_list_element **list)
{
cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
result->func = NULL;
- result->function.cfunc = NULL; /* Ok. */
+ result->function.const_cfunc = NULL;
return result;
}
@@ -1960,6 +1929,5 @@ int
cli_user_command_p (struct cmd_list_element *cmd)
{
return (cmd->theclass == class_user
- && (cmd->func == do_cfunc || cmd->func == do_sfunc
- || cmd->func == do_const_cfunc));
+ && (cmd->func == do_const_cfunc || cmd->func == do_sfunc));
}
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 76f3ca9d7a..e3ac69ba66 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -113,8 +113,6 @@ struct cmd_list_element
union
{
/* If type is not_set_cmd, call it like this: */
- cmd_cfunc_ftype *cfunc;
- /* ... or like this. */
cmd_const_cfunc_ftype *const_cfunc;
/* If type is set_cmd or show_cmd, first set the variables,
and then call this: */