Re: [RFA 01/67] Add add_cmd function overloads

Pedro Alves
2017-09-26T12:12:16Z

On 09/23/2017 05:48 AM, Tom Tromey wrote:

> --- a/gdb/command.h
> +++ b/gdb/command.h
> @@ -117,6 +117,7 @@ var_types;
> struct cmd_list_element;
>
> typedef void cmd_cfunc_ftype (char *args, int from_tty);
> +typedef void cmd_const_cfunc_ftype (const char *args, int from_tty);
>
> /* This structure specifies notifications to be suppressed by a cli
> command interpreter. */
> @@ -140,6 +141,19 @@ extern struct cmd_list_element *add_cmd (const char *, enum command_class,
> const char *,
> struct cmd_list_element **);
>
> +/* Like add_cmd, but no command function is specified. */
> +
> +extern struct cmd_list_element *add_cmd (const char *, enum command_class,
> + const char *,
> + struct cmd_list_element **);
> +
> +/* Const-correct variant of the above. */

It'd seem a tiny bit clearer to swap the two new declarations so
that this "of the above" comment is right below
the const-incorrect one.

> +
> +extern struct cmd_list_element *add_cmd (const char *, enum command_class,
> + cmd_const_cfunc_ftype *fun,
> + const char *,
> + struct cmd_list_element **);

Otherwise OK.

Thanks,
Pedro Alves