aboutsummaryrefslogtreecommitdiff
path: root/gdb/target.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-09-09 20:51:33 -0600
committerTom Tromey <tom@tromey.com>2017-09-27 08:44:14 -0600
commit0450cc4ce8b4775c47e9aaa1c5a34e181b10ae98 (patch)
treef72a3f6796ac10fe11c3ca341aaf22aea3a8b693 /gdb/target.c
parenta9bbfbd85fddfea2db30810c33c4bb130a2ef773 (diff)
downloadfsf-binutils-gdb-0450cc4ce8b4775c47e9aaa1c5a34e181b10ae98.zip
fsf-binutils-gdb-0450cc4ce8b4775c47e9aaa1c5a34e181b10ae98.tar.gz
fsf-binutils-gdb-0450cc4ce8b4775c47e9aaa1c5a34e181b10ae98.tar.bz2
Add add_cmd function overloads
This adds two add_cmd overloads: one whose callback takes a const char *, and one that doesn't accept a function at all. The no-function overload was introduced to avoid ambiguity when NULL was passed as the function. Long term the goal is for all commands to take const arguments, and for the non-const variants to be removed entirely. gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * cli/cli-decode.c (add_cmd, set_cmd_cfunc): New function overloads. (do_add_cmd): Rename from add_cmd. Don't call set_cmd_cfunc. (do_const_cfunc): New function. (cmd_cfunc_eq): New overload. (cli_user_command_p): Check do_const_cfunc. * cli/cli-decode.h (struct cmd_list_element) <function>: New field const_cfunc. * command.h (add_cmd): Add const overload and no-function overload. (set_cmd_cfunc): Add const overload. (cmd_const_cfunc_ftype): Declare. (cmd_cfunc_eq): Add const overload. * breakpoint.c, cli-cmds.c, cli-dump.c, guile/scm-cmd.c, python/py-cmd.c, target.c, tracepoint.c: Use no-function add_cmd overload.
Diffstat (limited to 'gdb/target.c')
-rw-r--r--gdb/target.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/target.c b/gdb/target.c
index 5a2c087..c26fba7 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -386,7 +386,7 @@ Remaining arguments are interpreted by the target protocol. For more\n\
information on the arguments for a particular protocol, type\n\
`help target ' followed by the protocol name."),
&targetlist, "target ", 0, &cmdlist);
- c = add_cmd (t->to_shortname, no_class, NULL, t->to_doc, &targetlist);
+ c = add_cmd (t->to_shortname, no_class, t->to_doc, &targetlist);
set_cmd_sfunc (c, open_target);
set_cmd_context (c, t);
if (completer != NULL)
@@ -411,7 +411,7 @@ add_deprecated_target_alias (struct target_ops *t, const char *alias)
/* If we use add_alias_cmd, here, we do not get the deprecated warning,
see PR cli/15104. */
- c = add_cmd (alias, no_class, NULL, t->to_doc, &targetlist);
+ c = add_cmd (alias, no_class, t->to_doc, &targetlist);
set_cmd_sfunc (c, open_target);
set_cmd_context (c, t);
alt = xstrprintf ("target %s", t->to_shortname);