Remove "cmd_type" function
authorTom Tromey <tom@tromey.com>
Sun, 28 Jun 2020 16:33:06 +0000 (10:33 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 28 Jun 2020 16:33:07 +0000 (10:33 -0600)
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.

gdb/ChangeLog
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/cli/cli-decode.h
gdb/command.h

index 0ab251ddc4a1fd0ed3bb933f7b4c1a032a8f5c34..a34c2ea972f1e1fcbff024b9a19ef52ed7f95787 100644 (file)
@@ -1,3 +1,12 @@
+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.
+
 2020-06-27  Pedro Alves  <palves@redhat.com>
 
        * fork-child.c (prefork_hook): Adjust.
index 2ff515ace7d1fe3601520d9946b197c3f543b674..14718d1181ac64bda95d15b1a4815274a5e2d117 100644 (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);
 
index 85f50aa8e48214907fa921668967bf25776909f4..5a549edd43cb2ca74160855990840e4b97696b1f 100644 (file)
@@ -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)
 {
index f855ee5724fda1a3c0d9dde527fe9ca1876f2e49..e8ce3629227648a9a79e664b5a3a3532244be483 100644 (file)
 #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.  */
 
index 2cac5c8ced0c87f732ef66ad290b89985d39795b..22e43de3c15973f9e0a0590c58dfd403d92acd0a 100644 (file)
@@ -71,19 +71,6 @@ enum command_class
   no_set_class
 };
 
-/* 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;
-
 /* Types of "set" or "show" command.  */
 typedef enum var_types
   {
@@ -282,9 +269,6 @@ extern void *get_cmd_context (struct cmd_list_element *cmd);
 extern void execute_cmd_pre_hook (struct cmd_list_element *cmd);
 extern void execute_cmd_post_hook (struct cmd_list_element *cmd);
 
-/* Return the type of the command.  */
-extern enum cmd_types cmd_type (struct cmd_list_element *cmd);
-
 /* Flag for an ambiguous cmd_list result.  */
 #define CMD_LIST_AMBIGUOUS ((struct cmd_list_element *) -1)
 
This page took 0.039437 seconds and 4 git commands to generate.