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.
This commit is contained in:
Tom Tromey 2020-06-28 10:33:06 -06:00
parent a5122bfa07
commit cd4c4c07f4
5 changed files with 16 additions and 34 deletions

View file

@ -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);