From patchwork Fri Jun 13 15:30:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 1490 Received: (qmail 1387 invoked by alias); 13 Jun 2014 15:30:28 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 1374 invoked by uid 89); 13 Jun 2014 15:30:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Jun 2014 15:30:25 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5DFUNTM014973 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 13 Jun 2014 11:30:23 -0400 Received: from barimba (ovpn-113-103.phx2.redhat.com [10.3.113.103]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5DFULdb019339 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Fri, 13 Jun 2014 11:30:22 -0400 From: Tom Tromey To: gdb-patches@sourceware.org Subject: Re: [PATCH] make calls to help_list use enumerator References: <1401978478-30796-1-git-send-email-tromey@redhat.com> Date: Fri, 13 Jun 2014 09:30:20 -0600 In-Reply-To: <1401978478-30796-1-git-send-email-tromey@redhat.com> (Tom Tromey's message of "Thu, 5 Jun 2014 08:27:58 -0600") Message-ID: <87tx7oq12r.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 >>>>> "Tom" == Tom Tromey writes: Tom> Currently there are many calls to help_list that pass the constant -1 Tom> as the "class" value. However, the parameter is declared as being of Tom> type enum command_class, and uses of the constant violate this Tom> abstraction. Tom> This patch fixes the error everywhere it occurs in the gdb sources. I found one more case of this problem that my script missed. It is in cp-support.c. I'm checking in the appended. Tom b/gdb/ChangeLog: 2014-06-13 Tom Tromey * cp-support.c (maint_cplus_command): Pass all_commands, not -1, to help_list. * 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. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index d7c7e24..56b3708 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. */ @@ -13517,7 +13518,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/cp-support.c b/gdb/cp-support.c index 2379b54..350451a 100644 --- a/gdb/cp-support.c +++ b/gdb/cp-support.c @@ -1499,7 +1499,7 @@ maint_cplus_command (char *arg, int from_tty) "by the name of a command.\n")); help_list (maint_cplus_cmd_list, "maintenance cplus ", - -1, gdb_stdout); + all_commands, gdb_stdout); } /* This is a front end for cp_find_first_component, for unit testing. 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 167e717..05dba69 100644 --- a/gdb/guile/guile.c +++ b/gdb/guile/guile.c @@ -462,7 +462,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 d5e5272..9db3410 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 d443508..f7e0de5 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 7ad4a44..d94db48 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