aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-06-28 10:33:06 -0600
committerTom Tromey <tom@tromey.com>2020-06-28 10:33:07 -0600
commitcd4c4c07f45fcd8e7c03ee3a0d90942a92250768 (patch)
treeae594d27afbba39f3797e09b1226147f5454d313 /gdb/cli
parenta5122bfa078902c04668a59370ed33ef51783b0e (diff)
downloadgdb-cd4c4c07f45fcd8e7c03ee3a0d90942a92250768.zip
gdb-cd4c4c07f45fcd8e7c03ee3a0d90942a92250768.tar.gz
gdb-cd4c4c07f45fcd8e7c03ee3a0d90942a92250768.tar.bz2
Remove "cmd_type" function
The cmd_type function only has a single caller, which is in the CLI implementation code. This patch removes the function, and moves the cmd_types enum definition from command.h to cli-decode.h, fixing an 18 year old FIXME. gdb/ChangeLog 2020-06-28 Tom Tromey <tom@tromey.com> * command.h (cmd_types): Remove. (cmd_type): Don't declare. * cli/cli-decode.h (enum cmd_types): Uncomment. No longer a typedef. * cli/cli-cmds.c (setting_cmd): Use cmd->type directly. * cli/cli-decode.c (cmd_type): Remove.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c2
-rw-r--r--gdb/cli/cli-decode.c6
-rw-r--r--gdb/cli/cli-decode.h17
3 files changed, 7 insertions, 18 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 2ff515a..14718d1 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2069,7 +2069,7 @@ setting_cmd (const char *fnname, struct cmd_list_element *showlist,
const char *a0 = (const char *) value_contents (argv[0]);
cmd_list_element *cmd = lookup_cmd (&a0, showlist, "", NULL, -1, 0);
- if (cmd == nullptr || cmd_type (cmd) != show_cmd)
+ if (cmd == nullptr || cmd->type != show_cmd)
error (_("First argument of %s must be a "
"valid setting of the 'show' command."), fnname);
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 85f50aa..5a549ed 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -139,12 +139,6 @@ get_cmd_context (struct cmd_list_element *cmd)
return cmd->context;
}
-enum cmd_types
-cmd_type (struct cmd_list_element *cmd)
-{
- return cmd->type;
-}
-
void
set_cmd_completer (struct cmd_list_element *cmd, completer_ftype *completer)
{
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index f855ee5..e8ce362 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -27,20 +27,15 @@
#include "cli-script.h"
#include "completer.h"
-#if 0
-/* FIXME: cagney/2002-03-17: Once cmd_type() has been removed, ``enum
- cmd_types'' can be moved from "command.h" to "cli-decode.h". */
/* Not a set/show command. Note that some commands which begin with
"set" or "show" might be in this category, if their syntax does
not fall into one of the following categories. */
-typedef enum cmd_types
- {
- not_set_cmd,
- set_cmd,
- show_cmd
- }
-cmd_types;
-#endif
+enum cmd_types
+{
+ not_set_cmd,
+ set_cmd,
+ show_cmd
+};
/* This structure records one command'd definition. */