diff options
author | Tom Tromey <tom@tromey.com> | 2017-09-25 22:28:30 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-10-11 16:21:02 -0600 |
commit | 981a3fb3594dddae266b7a5014c3001727200d7b (patch) | |
tree | 15c1edb975e878b6b8ae49466b3bd539b7f87681 /gdb/cli | |
parent | fdf44873ec6e37417bf8c8ce33bb9b1a6b4ddcef (diff) | |
download | fsf-binutils-gdb-981a3fb3594dddae266b7a5014c3001727200d7b.zip fsf-binutils-gdb-981a3fb3594dddae266b7a5014c3001727200d7b.tar.gz fsf-binutils-gdb-981a3fb3594dddae266b7a5014c3001727200d7b.tar.bz2 |
Constify add_prefix_cmd
This changes add_prefix_cmd to accept a const-taking function as an
argument; then fixes up all the callers.
In a couple of spots I had to add a non-const overload of a function,
because the function is passed to two different command-adding
"constructors". These overloads are temporary; once constification is
complete they can be removed.
This patch also fixes a typo I happened to notice while constifying.
Note that this touches a couple of files (gnu-nat.c and go32-nat.c)
that I can't build. So, while I made a best-effort there, I am not
certain they will still compile.
Tested by rebuilding.
gdb/ChangeLog
2017-10-11 Tom Tromey <tom@tromey.com>
* gdbthread.h (thread_command): Constify.
* inferior.h (detach_command): Constify.
* top.h (set_history, show_history): Constify.
* arm-tdep.c (set_arm_command, show_arm_command): Constify.
* serial.c (serial_set_cmd, serial_show_cmd): Constify.
* bsd-kvm.c (bsd_kvm_cmd): Constify.
* printcmd.c (set_command): Constify.
(non_const_set_command): New function.
* dcache.c (set_dcache_command, show_dcache_command): Constify.
* breakpoint.c (enable_command, disable_command, delete_command)
(catch_command, tcatch_command, set_breakpoint_cmd)
(show_breakpoint_cmd): Constify.
* macrocmd.c (macro_command): Constify.
* infcmd.c (unset_command, kill_command, detach_command)
(info_proc_cmd): Constify.
* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify.
* auto-load.c (show_auto_load_cmd, set_auto_load_cmd)
(info_auto_load_cmd): Constify.
* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
(unset_tdesc_cmd): Constify.
* ada-lang.c (set_ada_command, show_ada_command)
(maint_set_ada_cmd, maint_show_ada_cmd): Constify.
* guile/guile.c (set_guile_command, show_guile_command)
(info_guile_command): Constify.
* tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd):
Constify.
* skip.c (skip_command): Constify.
* compile/compile.c (_initialize_compile): Constify.
* dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify.
* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
(maint_btrace_pt_show_cmd): Constify.
* remote.c (set_remote_cmd, show_remote_cmd, remote_command):
Constify.
* python/python.c (user_show_python, user_set_python): Constify.
* mips-tdep.c (set_mips_command, show_mips_command)
(set_mipsfpu_command): Constify.
* record-btrace.c (cmd_record_btrace_start)
(cmd_set_record_btrace, cmd_show_record_btrace)
(cmd_set_record_btrace_bts, cmd_show_record_btrace_bts)
(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify.
* rs6000-tdep.c (set_powerpc_command, show_powerpc_command):
Constify.
* symfile.c (overlay_command): Constify.
* spu-tdep.c (set_spu_command, show_spu_command): Constify.
* cli/cli-logging.c (set_logging_command, show_logging_command):
Constify.
* cli/cli-dump.c (dump_command, append_command)
(srec_dump_command, ihex_dump_command, verilog_dump_command)
(tekhex_dump_command, binary_dump_command)
(binary_append_command): Constify.
* cli/cli-decode.c (struct cmd_list_element): Change type of
"fun".
* cli/cli-cmds.c (info_command, show_command, set_debug)
(show_debug): Constify.
(show_command): Add non-const overload.
* top.c (set_history, show_history): Constify.
* sh-tdep.c (set_sh_command, show_sh_command): Constify.
* command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype.
* target.c (target_command): Constify.
* sparc64-tdep.c (info_adi_command): Constify.
* record-full.c (cmd_record_full_start): Constify.
(set_record_full_command): Constify. Fix typo.
(show_record_full_command): Constify.
* thread.c (thread_command, thread_apply_command): Constify.
* memattr.c (dummy_cmd): Constify.
* value.c (function_command): Constify.
* frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify.
* probe.c (info_probes_command): Constify.
* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify.
* gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd)
(show_thread_cmd, set_thread_default_cmd)
(show_thread_default_cmd): Constify.
(check_empty): Constify.
* tracepoint.c (tfind_command): Constify.
* cp-support.c (maint_cplus_command): Constify.
* windows-tdep.c (info_w32_command): Constify.
* record.c (cmd_record_start, set_record_command)
(show_record_command, info_record_command, cmd_record_goto):
Constify.
* ravenscar-thread.c (set_ravenscar_command)
(show_ravenscar_command): Constify.
* utils.c (set_internal_problem_cmd, show_internal_problem_cmd):
Constify.
(add_internal_problem_command): Remove casts.
* arc-tdep.c (maintenance_print_arc_command): Constify.
* valprint.c (set_print, show_print, set_print_raw)
(show_print_raw): Constify.
* maint.c (maintenance_command, maintenance_info_command)
(maintenance_print_command, maintenance_set_cmd)
(maintenance_show_cmd, set_per_command_cmd)
(show_per_command_cmd, maintenance_check_command): Constify.
* language.c (set_check, show_check): Constify.
* typeprint.c (show_print_type, set_print_type): Constify.
* go32-nat.c (go32_info_dos_command): Constify.
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-cmds.c | 23 | ||||
-rw-r--r-- | gdb/cli/cli-decode.c | 2 | ||||
-rw-r--r-- | gdb/cli/cli-dump.c | 16 | ||||
-rw-r--r-- | gdb/cli/cli-logging.c | 4 |
4 files changed, 23 insertions, 22 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 51271ad..a1c308a 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -68,14 +68,6 @@ static void pwd_command (char *, int); static void help_command (char *, int); -static void show_command (char *, int); - -static void info_command (char *, int); - -static void show_debug (char *, int); - -static void set_debug (char *, int); - static void make_command (char *, int); static void shell_escape (const char *, int); @@ -218,7 +210,7 @@ error_no_arg (const char *why) args. */ static void -info_command (char *arg, int from_tty) +info_command (const char *arg, int from_tty) { printf_unfiltered (_("\"info\" must be followed by " "the name of an info command.\n")); @@ -228,10 +220,19 @@ info_command (char *arg, int from_tty) /* The "show" command with no arguments shows all the settings. */ static void +show_command (const char *arg, int from_tty) +{ + cmd_show_list (showlist, from_tty, ""); +} + +/* A temporary non-const overload of show_command. */ + +static void show_command (char *arg, int from_tty) { cmd_show_list (showlist, from_tty, ""); } + /* Provide documentation on command or list given by COMMAND. FROM_TTY is ignored. */ @@ -1616,7 +1617,7 @@ filter_sals (std::vector<symtab_and_line> &sals) } static void -set_debug (char *arg, int from_tty) +set_debug (const char *arg, int from_tty) { printf_unfiltered (_("\"set debug\" must be followed by " "the name of a debug subcommand.\n")); @@ -1624,7 +1625,7 @@ set_debug (char *arg, int from_tty) } static void -show_debug (char *args, int from_tty) +show_debug (const char *args, int from_tty) { cmd_show_list (showdebuglist, from_tty, ""); } diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index f161c86..87ebed5 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -396,7 +396,7 @@ add_alias_cmd (const char *name, const char *oldname, struct cmd_list_element * add_prefix_cmd (const char *name, enum command_class theclass, - cmd_cfunc_ftype *fun, + cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list) diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index f4ea2d7..4eafffa 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -129,14 +129,14 @@ static struct cmd_list_element *binary_dump_cmdlist; static struct cmd_list_element *binary_append_cmdlist; static void -dump_command (char *cmd, int from_tty) +dump_command (const char *cmd, int from_tty) { printf_unfiltered (_("\"dump\" must be followed by a subcommand.\n\n")); help_list (dump_cmdlist, "dump ", all_commands, gdb_stdout); } static void -append_command (char *cmd, int from_tty) +append_command (const char *cmd, int from_tty) { printf_unfiltered (_("\"append\" must be followed by a subcommand.\n\n")); help_list (dump_cmdlist, "append ", all_commands, gdb_stdout); @@ -581,42 +581,42 @@ restore_command (char *args_in, int from_tty) } static void -srec_dump_command (char *cmd, int from_tty) +srec_dump_command (const char *cmd, int from_tty) { printf_unfiltered (_("\"dump srec\" must be followed by a subcommand.\n")); help_list (srec_cmdlist, "dump srec ", all_commands, gdb_stdout); } static void -ihex_dump_command (char *cmd, int from_tty) +ihex_dump_command (const char *cmd, int from_tty) { printf_unfiltered (_("\"dump ihex\" must be followed by a subcommand.\n")); help_list (ihex_cmdlist, "dump ihex ", all_commands, gdb_stdout); } static void -verilog_dump_command (char *cmd, int from_tty) +verilog_dump_command (const char *cmd, int from_tty) { printf_unfiltered (_("\"dump verilog\" must be followed by a subcommand.\n")); help_list (verilog_cmdlist, "dump verilog ", all_commands, gdb_stdout); } static void -tekhex_dump_command (char *cmd, int from_tty) +tekhex_dump_command (const char *cmd, int from_tty) { printf_unfiltered (_("\"dump tekhex\" must be followed by a subcommand.\n")); help_list (tekhex_cmdlist, "dump tekhex ", all_commands, gdb_stdout); } static void -binary_dump_command (char *cmd, int from_tty) +binary_dump_command (const char *cmd, int from_tty) { printf_unfiltered (_("\"dump binary\" must be followed by a subcommand.\n")); help_list (binary_dump_cmdlist, "dump binary ", all_commands, gdb_stdout); } static void -binary_append_command (char *cmd, int from_tty) +binary_append_command (const char *cmd, int from_tty) { printf_unfiltered (_("\"append binary\" must be followed by a subcommand.\n")); help_list (binary_append_cmdlist, "append binary ", all_commands, diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c index 14242e0..ee31659 100644 --- a/gdb/cli/cli-logging.c +++ b/gdb/cli/cli-logging.c @@ -172,7 +172,7 @@ set_logging_off (const char *args, int from_tty) } static void -set_logging_command (char *args, int from_tty) +set_logging_command (const char *args, int from_tty) { printf_unfiltered (_("\"set logging\" lets you log output to a file.\n" "Usage: set logging on [FILENAME]\n" @@ -183,7 +183,7 @@ set_logging_command (char *args, int from_tty) } static void -show_logging_command (char *args, int from_tty) +show_logging_command (const char *args, int from_tty) { if (saved_filename) printf_unfiltered (_("Currently logging to \"%s\".\n"), saved_filename); |