[RFA,1/8] Constify add_abbrev_prefix_cmd

Message ID 20171013205950.22943-2-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey Oct. 13, 2017, 8:59 p.m. UTC
  This changes add_abbrev_prefix_cmd to take a const-taking callback
function and then fixes the one caller.

gdb/ChangeLog
2017-10-13  Tom Tromey  <tom@tromey.com>

	* breakpoint.c (stop_command): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Constify.
	* command.h (add_abbrev_prefix_cmd): Constify.
---
 gdb/ChangeLog        | 6 ++++++
 gdb/breakpoint.c     | 4 +---
 gdb/cli/cli-decode.c | 2 +-
 gdb/command.h        | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)
  

Comments

Yao Qi Oct. 16, 2017, 9:01 a.m. UTC | #1
Tom Tromey <tom@tromey.com> writes:

> This changes add_abbrev_prefix_cmd to take a const-taking callback
> function and then fixes the one caller.
>
> gdb/ChangeLog
> 2017-10-13  Tom Tromey  <tom@tromey.com>
>
> 	* breakpoint.c (stop_command): Constify.
> 	* cli/cli-decode.c (struct cmd_list_element): Constify.
> 	* command.h (add_abbrev_prefix_cmd): Constify.

As you said in cover letter, breakpoint.c:stop_command needs update as
well.  You can pull the stop_command change in this patch, and it looks
good to me.
  
Tom Tromey Oct. 16, 2017, 3:54 p.m. UTC | #2
>>>>> "Yao" == Yao Qi <qiyaoltc@gmail.com> writes:

Yao> Tom Tromey <tom@tromey.com> writes:
>> This changes add_abbrev_prefix_cmd to take a const-taking callback
>> function and then fixes the one caller.
>> 
>> gdb/ChangeLog
>> 2017-10-13  Tom Tromey  <tom@tromey.com>
>> 
>> * breakpoint.c (stop_command): Constify.
>> * cli/cli-decode.c (struct cmd_list_element): Constify.
>> * command.h (add_abbrev_prefix_cmd): Constify.

Yao> As you said in cover letter, breakpoint.c:stop_command needs update as
Yao> well.  You can pull the stop_command change in this patch, and it looks
Yao> good to me.

I'm sorry -- I don't understand what I ought to do here.
I think this patch does include a change to stop_command.

Tom
  
Yao Qi Oct. 16, 2017, 8:23 p.m. UTC | #3
On Mon, Oct 16, 2017 at 4:54 PM, Tom Tromey <tom@tromey.com> wrote:
>>>>>> "Yao" == Yao Qi <qiyaoltc@gmail.com> writes:
>
> I'm sorry -- I don't understand what I ought to do here.
> I think this patch does include a change to stop_command.
>

Oh, yes, a change to stop_command was there.  I wonder why I didn't
see it in gnus.  Sorry about the confusion.  Patch is good to me.
  

Patch

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 32ceea7c9b..3e7957f223 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -193,8 +193,6 @@  static void thbreak_command (char *, int);
 static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp,
 				    int count);
 
-static void stop_command (char *arg, int from_tty);
-
 static void free_bp_location (struct bp_location *loc);
 static void incref_bp_location (struct bp_location *loc);
 static void decref_bp_location (struct bp_location **loc);
@@ -9674,7 +9672,7 @@  thbreak_command (char *arg, int from_tty)
 }
 
 static void
-stop_command (char *arg, int from_tty)
+stop_command (const char *arg, int from_tty)
 {
   printf_filtered (_("Specify the type of breakpoint to set.\n\
 Usage: stop in <function | address>\n\
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 87ebed5f6e..5fc3187001 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -424,7 +424,7 @@  add_prefix_cmd (const char *name, enum command_class theclass,
 
 struct cmd_list_element *
 add_abbrev_prefix_cmd (const char *name, enum command_class theclass,
-		       cmd_cfunc_ftype *fun, const char *doc,
+		       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/command.h b/gdb/command.h
index 32ee73af62..71ad71d953 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -173,7 +173,7 @@  extern struct cmd_list_element *add_prefix_cmd (const char *, enum command_class
 
 extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
 						       enum command_class,
-						       cmd_cfunc_ftype *fun,
+						       cmd_const_cfunc_ftype *fun,
 						       const char *,
 						       struct cmd_list_element
 						       **, const char *, int,