[PATCH] make calls to help_list use enumerator

Tom Tromey tromey@redhat.com
Thu Jun 5 14:28:00 GMT 2014


Currently there are many calls to help_list that pass the constant -1
as the "class" value.  However, the parameter is declared as being of
type enum command_class, and uses of the constant violate this
abstraction.

This patch fixes the error everywhere it occurs in the gdb sources.

Tested by rebuilding.

2014-06-05  Tom Tromey  <tromey@barimba>

	* guile/guile.c (info_guile_command): Pass all_commands, not -1,
	to help_list.
	* tui/tui-win.c (tui_command): Pass all_commands, not -1, to
	help_list.
	* tui/tui-regs.c (tui_reg_command): Pass all_commands, not -1, to
	help_list.Pass all_commands, not -1, to help_list.
	* cli/cli-dump.c (dump_command, append_command)
	(srec_dump_command, ihex_dump_command, tekhex_dump_command)
	(binary_dump_command, binary_append_command): Pass all_commands,
	not -1, to help_list.
	* cli/cli-cmds.c (info_command, set_debug): Pass all_commands, not
	-1, to help_list.
	* valprint.c (set_print, set_print_raw): Pass all_commands, not
	-1, to help_list.
	* typeprint.c (set_print_type): Pass all_commands, not -1, to
	help_list.
	* top.c (set_history): Pass all_commands, not -1, to help_list.
	* target-descriptions.c (set_tdesc_cmd, unset_tdesc_cmd): Pass
	all_commands, not -1, to help_list.
	* symfile.c (overlay_command): Pass all_commands, not -1, to
	help_list.
	* spu-tdep.c (info_spu_command): Pass all_commands, not -1, to
	help_list.
	* serial.c (serial_set_cmd): Pass all_commands, not -1, to
	help_list.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Pass all_commands, not
	-1, to help_list.
	* remote.c (remote_command, set_remote_cmd): Pass all_commands,
	not -1, to help_list.
	* ravenscar-thread.c (set_ravenscar_command): Pass all_commands,
	not -1, to help_list.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_print_command, maintenance_set_cmd): Pass
	all_commands, not -1, to help_list.
	* macrocmd.c (macro_command): Pass all_commands, not -1, to
	help_list.
	* language.c (set_check): Pass all_commands, not -1, to help_list.
	* infcmd.c (unset_command): Pass all_commands, not -1, to
	help_list.
	* frame.c (set_backtrace_cmd): Pass all_commands, not -1, to
	help_list.
	* dwarf2read.c (set_dwarf2_cmd): Pass all_commands, not -1, to
	help_list.
	* dcache.c (set_dcache_command): Pass all_commands, not -1, to
	help_list.
	* breakpoint.c (save_command): Pass all_commands, not -1, to
	help_list.
	* ada-lang.c (maint_set_ada_cmd, set_ada_command): Pass
	all_commands, not -1, to help_list.
---
 gdb/ChangeLog             | 52 +++++++++++++++++++++++++++++++++++++++++++++++
 gdb/ada-lang.c            |  5 +++--
 gdb/breakpoint.c          |  2 +-
 gdb/cli/cli-cmds.c        |  4 ++--
 gdb/cli/cli-dump.c        | 15 +++++++-------
 gdb/dcache.c              |  2 +-
 gdb/dwarf2read.c          |  3 ++-
 gdb/frame.c               |  3 ++-
 gdb/guile/guile.c         |  2 +-
 gdb/infcmd.c              |  2 +-
 gdb/language.c            |  2 +-
 gdb/macrocmd.c            |  2 +-
 gdb/maint.c               | 11 ++++++----
 gdb/ravenscar-thread.c    |  2 +-
 gdb/remote.c              |  4 ++--
 gdb/ser-tcp.c             |  4 ++--
 gdb/serial.c              |  2 +-
 gdb/spu-tdep.c            |  2 +-
 gdb/symfile.c             |  2 +-
 gdb/target-descriptions.c |  4 ++--
 gdb/top.c                 |  2 +-
 gdb/tui/tui-regs.c        |  2 +-
 gdb/tui/tui-win.c         |  2 +-
 gdb/typeprint.c           |  2 +-
 gdb/valprint.c            |  4 ++--
 25 files changed, 98 insertions(+), 39 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c12fbb8..decbb1c 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -357,7 +357,8 @@ static struct cmd_list_element *maint_show_ada_cmdlist;
 static void
 maint_set_ada_cmd (char *args, int from_tty)
 {
-  help_list (maint_set_ada_cmdlist, "maintenance set ada ", -1, gdb_stdout);
+  help_list (maint_set_ada_cmdlist, "maintenance set ada ", all_commands,
+	     gdb_stdout);
 }
 
 /* Implement the "maintenance show ada" (prefix) command.  */
@@ -13552,7 +13553,7 @@ set_ada_command (char *arg, int from_tty)
 {
   printf_unfiltered (_(\
 "\"set ada\" must be followed by the name of a setting.\n"));
-  help_list (set_ada_list, "set ada ", -1, gdb_stdout);
+  help_list (set_ada_list, "set ada ", all_commands, gdb_stdout);
 }
 
 /* Implement the "show ada" prefix command.  */
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 23c8895..8f702e2 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -16093,7 +16093,7 @@ save_command (char *arg, int from_tty)
 {
   printf_unfiltered (_("\"save\" must be followed by "
 		       "the name of a save subcommand.\n"));
-  help_list (save_cmdlist, "save ", -1, gdb_stdout);
+  help_list (save_cmdlist, "save ", all_commands, gdb_stdout);
 }
 
 struct breakpoint *
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index e5d34a7..a4f52f8 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -218,7 +218,7 @@ info_command (char *arg, int from_tty)
 {
   printf_unfiltered (_("\"info\" must be followed by "
 		       "the name of an info command.\n"));
-  help_list (infolist, "info ", -1, gdb_stdout);
+  help_list (infolist, "info ", all_commands, gdb_stdout);
 }
 
 /* The "show" command with no arguments shows all the settings.  */
@@ -1567,7 +1567,7 @@ set_debug (char *arg, int from_tty)
 {
   printf_unfiltered (_("\"set debug\" must be followed by "
 		       "the name of a debug subcommand.\n"));
-  help_list (setdebuglist, "set debug ", -1, gdb_stdout);
+  help_list (setdebuglist, "set debug ", all_commands, gdb_stdout);
 }
 
 static void
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 005e207..aec732e 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -160,14 +160,14 @@ static void
 dump_command (char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"dump\" must be followed by a subcommand.\n\n"));
-  help_list (dump_cmdlist, "dump ", -1, gdb_stdout);
+  help_list (dump_cmdlist, "dump ", all_commands, gdb_stdout);
 }
 
 static void
 append_command (char *cmd, int from_tty)
 {
   printf_unfiltered (_("\"append\" must be followed by a subcommand.\n\n"));
-  help_list (dump_cmdlist, "append ", -1, gdb_stdout);
+  help_list (dump_cmdlist, "append ", all_commands, gdb_stdout);
 }
 
 static void
@@ -626,35 +626,36 @@ static void
 srec_dump_command (char *cmd, int from_tty)
 {
   printf_unfiltered ("\"dump srec\" must be followed by a subcommand.\n");
-  help_list (srec_cmdlist, "dump srec ", -1, gdb_stdout);
+  help_list (srec_cmdlist, "dump srec ", all_commands, gdb_stdout);
 }
 
 static void
 ihex_dump_command (char *cmd, int from_tty)
 {
   printf_unfiltered ("\"dump ihex\" must be followed by a subcommand.\n");
-  help_list (ihex_cmdlist, "dump ihex ", -1, gdb_stdout);
+  help_list (ihex_cmdlist, "dump ihex ", all_commands, gdb_stdout);
 }
 
 static void
 tekhex_dump_command (char *cmd, int from_tty)
 {
   printf_unfiltered ("\"dump tekhex\" must be followed by a subcommand.\n");
-  help_list (tekhex_cmdlist, "dump tekhex ", -1, gdb_stdout);
+  help_list (tekhex_cmdlist, "dump tekhex ", all_commands, gdb_stdout);
 }
 
 static void
 binary_dump_command (char *cmd, int from_tty)
 {
   printf_unfiltered ("\"dump binary\" must be followed by a subcommand.\n");
-  help_list (binary_dump_cmdlist, "dump binary ", -1, gdb_stdout);
+  help_list (binary_dump_cmdlist, "dump binary ", all_commands, gdb_stdout);
 }
 
 static void
 binary_append_command (char *cmd, int from_tty)
 {
   printf_unfiltered ("\"append binary\" must be followed by a subcommand.\n");
-  help_list (binary_append_cmdlist, "append binary ", -1, gdb_stdout);
+  help_list (binary_append_cmdlist, "append binary ", all_commands,
+	     gdb_stdout);
 }
 
 extern initialize_file_ftype _initialize_cli_dump; /* -Wmissing-prototypes */
diff --git a/gdb/dcache.c b/gdb/dcache.c
index 9780f4d..6bf0e91 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -681,7 +681,7 @@ set_dcache_command (char *arg, int from_tty)
 {
   printf_unfiltered (
      "\"set dcache\" must be followed by the name of a subcommand.\n");
-  help_list (dcache_set_list, "set dcache ", -1, gdb_stdout);
+  help_list (dcache_set_list, "set dcache ", all_commands, gdb_stdout);
 }
 
 static void
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index f078cb4..3e441dc 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -21811,7 +21811,8 @@ static struct cmd_list_element *show_dwarf2_cmdlist;
 static void
 set_dwarf2_cmd (char *args, int from_tty)
 {
-  help_list (set_dwarf2_cmdlist, "maintenance set dwarf2 ", -1, gdb_stdout);
+  help_list (set_dwarf2_cmdlist, "maintenance set dwarf2 ", all_commands,
+	     gdb_stdout);
 }
 
 static void
diff --git a/gdb/frame.c b/gdb/frame.c
index 8dea9c4..4f3cb35 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2707,7 +2707,8 @@ static struct cmd_list_element *show_backtrace_cmdlist;
 static void
 set_backtrace_cmd (char *args, int from_tty)
 {
-  help_list (set_backtrace_cmdlist, "set backtrace ", -1, gdb_stdout);
+  help_list (set_backtrace_cmdlist, "set backtrace ", all_commands,
+	     gdb_stdout);
 }
 
 static void
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 00d7b06..a3e103f 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -442,7 +442,7 @@ info_guile_command (char *args, int from_tty)
 {
   printf_unfiltered (_("\"info guile\" must be followed"
 		       " by the name of an info command.\n"));
-  help_list (info_guile_list, "info guile ", -1, gdb_stdout);
+  help_list (info_guile_list, "info guile ", all_commands, gdb_stdout);
 }
 
 /* Initialization.  */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index df4fd40..c4bb401 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2769,7 +2769,7 @@ unset_command (char *args, int from_tty)
 {
   printf_filtered (_("\"unset\" must be followed by the "
 		     "name of an unset subcommand.\n"));
-  help_list (unsetlist, "unset ", -1, gdb_stdout);
+  help_list (unsetlist, "unset ", all_commands, gdb_stdout);
 }
 
 /* Implement `info proc' family of commands.  */
diff --git a/gdb/language.c b/gdb/language.c
index d5502f2..1b65d65 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -505,7 +505,7 @@ set_check (char *ignore, int from_tty)
 {
   printf_unfiltered (
      "\"set check\" must be followed by the name of a check subcommand.\n");
-  help_list (setchecklist, "set check ", -1, gdb_stdout);
+  help_list (setchecklist, "set check ", all_commands, gdb_stdout);
 }
 
 static void
diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c
index 0455fb0..94a627f 100644
--- a/gdb/macrocmd.c
+++ b/gdb/macrocmd.c
@@ -38,7 +38,7 @@ macro_command (char *arg, int from_tty)
 {
   printf_unfiltered
     ("\"macro\" must be followed by the name of a macro command.\n");
-  help_list (macrolist, "macro ", -1, gdb_stdout);
+  help_list (macrolist, "macro ", all_commands, gdb_stdout);
 }
 
 
diff --git a/gdb/maint.c b/gdb/maint.c
index 873c33c..30a9d3b 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -88,7 +88,7 @@ maintenance_command (char *args, int from_tty)
 {
   printf_unfiltered (_("\"maintenance\" must be followed by "
 		       "the name of a maintenance command.\n"));
-  help_list (maintenancelist, "maintenance ", -1, gdb_stdout);
+  help_list (maintenancelist, "maintenance ", all_commands, gdb_stdout);
 }
 
 #ifndef _WIN32
@@ -192,7 +192,8 @@ maintenance_info_command (char *arg, int from_tty)
 {
   printf_unfiltered (_("\"maintenance info\" must be followed "
 		       "by the name of an info command.\n"));
-  help_list (maintenanceinfolist, "maintenance info ", -1, gdb_stdout);
+  help_list (maintenanceinfolist, "maintenance info ", all_commands,
+	     gdb_stdout);
 }
 
 /* Mini tokenizing lexer for 'maint info sections' command.  */
@@ -439,7 +440,8 @@ maintenance_print_command (char *arg, int from_tty)
 {
   printf_unfiltered (_("\"maintenance print\" must be followed "
 		       "by the name of a print command.\n"));
-  help_list (maintenanceprintlist, "maintenance print ", -1, gdb_stdout);
+  help_list (maintenanceprintlist, "maintenance print ", all_commands,
+	     gdb_stdout);
 }
 
 /* The "maintenance translate-address" command converts a section and address
@@ -664,7 +666,8 @@ maintenance_set_cmd (char *args, int from_tty)
 {
   printf_unfiltered (_("\"maintenance set\" must be followed "
 		       "by the name of a set command.\n"));
-  help_list (maintenance_set_cmdlist, "maintenance set ", -1, gdb_stdout);
+  help_list (maintenance_set_cmdlist, "maintenance set ", all_commands,
+	     gdb_stdout);
 }
 
 static void
diff --git a/gdb/ravenscar-thread.c b/gdb/ravenscar-thread.c
index 01b5d81..060d5ce 100644
--- a/gdb/ravenscar-thread.c
+++ b/gdb/ravenscar-thread.c
@@ -394,7 +394,7 @@ set_ravenscar_command (char *arg, int from_tty)
 {
   printf_unfiltered (_(\
 "\"set ravenscar\" must be followed by the name of a setting.\n"));
-  help_list (set_ravenscar_list, "set ravenscar ", -1, gdb_stdout);
+  help_list (set_ravenscar_list, "set ravenscar ", all_commands, gdb_stdout);
 }
 
 /* Implement the "show ravenscar" prefix command.  */
diff --git a/gdb/remote.c b/gdb/remote.c
index 8f9478c..5fa5d9c 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -10249,7 +10249,7 @@ remote_delete_command (char *args, int from_tty)
 static void
 remote_command (char *args, int from_tty)
 {
-  help_list (remote_cmdlist, "remote ", -1, gdb_stdout);
+  help_list (remote_cmdlist, "remote ", all_commands, gdb_stdout);
 }
 
 static int
@@ -11601,7 +11601,7 @@ remote_async (struct target_ops *ops,
 static void
 set_remote_cmd (char *args, int from_tty)
 {
-  help_list (remote_set_cmdlist, "set remote ", -1, gdb_stdout);
+  help_list (remote_set_cmdlist, "set remote ", all_commands, gdb_stdout);
 }
 
 static void
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index c288ab4..5600001 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -363,13 +363,13 @@ ser_tcp_send_break (struct serial *scb)
 static void
 set_tcp_cmd (char *args, int from_tty)
 {
-  help_list (tcp_set_cmdlist, "set tcp ", -1, gdb_stdout);
+  help_list (tcp_set_cmdlist, "set tcp ", all_commands, gdb_stdout);
 }
 
 static void
 show_tcp_cmd (char *args, int from_tty)
 {
-  help_list (tcp_show_cmdlist, "show tcp ", -1, gdb_stdout);
+  help_list (tcp_show_cmdlist, "show tcp ", all_commands, gdb_stdout);
 }
 
 #ifndef USE_WIN32API
diff --git a/gdb/serial.c b/gdb/serial.c
index e780bbe..52d1322 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -615,7 +615,7 @@ serial_set_cmd (char *args, int from_tty)
 {
   printf_unfiltered ("\"set serial\" must be followed "
 		     "by the name of a command.\n");
-  help_list (serial_set_cmdlist, "set serial ", -1, gdb_stdout);
+  help_list (serial_set_cmdlist, "set serial ", all_commands, gdb_stdout);
 }
 
 static void
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 4fc3ca5..d251e4d 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -2649,7 +2649,7 @@ info_spu_command (char *args, int from_tty)
 {
   printf_unfiltered (_("\"info spu\" must be followed by "
 		       "the name of an SPU facility.\n"));
-  help_list (infospucmdlist, "info spu ", -1, gdb_stdout);
+  help_list (infospucmdlist, "info spu ", all_commands, gdb_stdout);
 }
 
 
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 64a83c6..4b28476 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3487,7 +3487,7 @@ overlay_command (char *args, int from_tty)
 {
   printf_unfiltered
     ("\"overlay\" must be followed by the name of an overlay command.\n");
-  help_list (overlaylist, "overlay ", -1, gdb_stdout);
+  help_list (overlaylist, "overlay ", all_commands, gdb_stdout);
 }
 
 /* Target Overlays for the "Simplest" overlay manager:
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 953748b..6b3389a 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1550,7 +1550,7 @@ static struct cmd_list_element *tdesc_unset_cmdlist;
 static void
 set_tdesc_cmd (char *args, int from_tty)
 {
-  help_list (tdesc_set_cmdlist, "set tdesc ", -1, gdb_stdout);
+  help_list (tdesc_set_cmdlist, "set tdesc ", all_commands, gdb_stdout);
 }
 
 static void
@@ -1562,7 +1562,7 @@ show_tdesc_cmd (char *args, int from_tty)
 static void
 unset_tdesc_cmd (char *args, int from_tty)
 {
-  help_list (tdesc_unset_cmdlist, "unset tdesc ", -1, gdb_stdout);
+  help_list (tdesc_unset_cmdlist, "unset tdesc ", all_commands, gdb_stdout);
 }
 
 static void
diff --git a/gdb/top.c b/gdb/top.c
index 3488813..a137db5 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1544,7 +1544,7 @@ set_history (char *args, int from_tty)
 {
   printf_unfiltered (_("\"set history\" must be followed "
 		       "by the name of a history subcommand.\n"));
-  help_list (sethistlist, "set history ", -1, gdb_stdout);
+  help_list (sethistlist, "set history ", all_commands, gdb_stdout);
 }
 
 void
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 9a88e8b..2c53e05 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -607,7 +607,7 @@ tui_reg_command (char *args, int from_tty)
 {
   printf_unfiltered (_("\"tui reg\" must be followed by the name of a "
                      "tui reg command.\n"));
-  help_list (tuireglist, "tui reg ", -1, gdb_stdout);
+  help_list (tuireglist, "tui reg ", all_commands, gdb_stdout);
 }
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 7ea0fec..a97704d 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -333,7 +333,7 @@ tui_command (char *args, int from_tty)
 {
   printf_unfiltered (_("\"tui\" must be followed by the name of a "
                      "tui command.\n"));
-  help_list (tuilist, "tui ", -1, gdb_stdout);
+  help_list (tuilist, "tui ", all_commands, gdb_stdout);
 }
 
 struct cmd_list_element **
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index b4ad431..026f3a2 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -636,7 +636,7 @@ set_print_type (char *arg, int from_tty)
 {
   printf_unfiltered (
      "\"set print type\" must be followed by the name of a subcommand.\n");
-  help_list (setprintlist, "set print type ", -1, gdb_stdout);
+  help_list (setprintlist, "set print type ", all_commands, gdb_stdout);
 }
 
 static void
diff --git a/gdb/valprint.c b/gdb/valprint.c
index f55b5db..8600b34 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -2704,7 +2704,7 @@ set_print (char *arg, int from_tty)
 {
   printf_unfiltered (
      "\"set print\" must be followed by the name of a print subcommand.\n");
-  help_list (setprintlist, "set print ", -1, gdb_stdout);
+  help_list (setprintlist, "set print ", all_commands, gdb_stdout);
 }
 
 static void
@@ -2718,7 +2718,7 @@ set_print_raw (char *arg, int from_tty)
 {
   printf_unfiltered (
      "\"set print raw\" must be followed by the name of a \"print raw\" subcommand.\n");
-  help_list (setprintrawlist, "set print raw ", -1, gdb_stdout);
+  help_list (setprintrawlist, "set print raw ", all_commands, gdb_stdout);
 }
 
 static void
-- 
1.9.3



More information about the Gdb-patches mailing list