From: Tom Tromey Date: Tue, 22 Jul 2014 02:37:34 +0000 (-0600) Subject: constify deprecate_cmd X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=429e55ea941f54f8e0481dd2048dc15af751ed71;p=binutils-gdb.git constify deprecate_cmd This constifies deprecate_cmd and the "replacement" field in struct cmd_list_element. 2014-07-24 Tom Tromey * cli/cli-decode.c (deprecate_cmd): Make "replacement" const. * cli/cli-decode.h (struct cmd_list_element) : Now const. * command.h (deprecate_cmd): Update. * maint.c (maintenance_do_deprecate): Add casts. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1a20220bd3d..ce4893c01d4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2014-07-24 Tom Tromey + + * cli/cli-decode.c (deprecate_cmd): Make "replacement" const. + * cli/cli-decode.h (struct cmd_list_element) : Now + const. + * command.h (deprecate_cmd): Update. + * maint.c (maintenance_do_deprecate): Add casts. + 2014-07-24 Tom Tromey * cli/cli-decode.c (help_cmd): Make parameter "const". diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index fcd4cebfc65..a08cc452889 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -261,7 +261,7 @@ add_cmd (const char *name, enum command_class class, cmd_cfunc_ftype *fun, Returns a pointer to the deprecated command. */ struct cmd_list_element * -deprecate_cmd (struct cmd_list_element *cmd, char *replacement) +deprecate_cmd (struct cmd_list_element *cmd, const char *replacement) { cmd->cmd_deprecated = 1; cmd->deprecated_warn_user = 1; diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 48ed604735b..9cd887db4e9 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -135,7 +135,7 @@ struct cmd_list_element show_value_ftype *show_value_func; /* If this command is deprecated, this is the replacement name. */ - char *replacement; + const char *replacement; /* If this command represents a show command, then this function is called before the variable's value is examined. */ diff --git a/gdb/command.h b/gdb/command.h index 5761447490e..1d63d2bae32 100644 --- a/gdb/command.h +++ b/gdb/command.h @@ -194,7 +194,7 @@ extern struct cmd_list_element *lookup_cmd_1 (const char **, int); extern struct cmd_list_element *deprecate_cmd (struct cmd_list_element *, - char * ); + const char * ); extern void deprecated_cmd_warning (const char *); diff --git a/gdb/maint.c b/gdb/maint.c index 99c7f9e921b..d4d5810af22 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -628,7 +628,7 @@ maintenance_do_deprecate (char *text, int deprecate) if (alias) { if (alias->malloced_replacement) - xfree (alias->replacement); + xfree ((char *) alias->replacement); if (deprecate) { @@ -647,7 +647,7 @@ maintenance_do_deprecate (char *text, int deprecate) else if (cmd) { if (cmd->malloced_replacement) - xfree (cmd->replacement); + xfree ((char *) cmd->replacement); if (deprecate) {