binutils-gdb/gdb/cli
Simon Marchi 5538b03c98 gdb: remove cmd_list_element::function::sfunc
I don't understand what the sfunc function type in
cmd_list_element::function is for.  Compared to cmd_simple_func_ftype,
it has an extra cmd_list_element parameter, giving the callback access
to the cmd_list_element for the command being invoked.  This allows
registering the same callback with many commands, and alter the behavior
using the cmd_list_element's context.

From the comment in cmd_list_element, it sounds like at some point it
was the callback function type for set and show functions, hence the
"s".  But nowadays, it's used for many more commands that need to access
the cmd_list_element object (see add_catch_command for example).

I don't really see the point of having sfunc at all, since do_sfunc is
just a trivial shim that changes the order of the arguments.  All
commands using sfunc could just as well set cmd_list_element::func to
their callback directly.

Therefore, remove the sfunc field in cmd_list_element and everything
that goes with it.  Rename cmd_const_sfunc_ftype to cmd_func_ftype and
use it for cmd_list_element::func, as well as for the add_setshow
commands.

Change-Id: I1eb96326c9b511c293c76996cea0ebc51c70fac0
2021-07-23 15:38:54 -04:00
..
cli-cmds.c gdb: rename cfunc to simple_func 2021-07-23 15:38:54 -04:00
cli-cmds.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-decode.c gdb: remove cmd_list_element::function::sfunc 2021-07-23 15:38:54 -04:00
cli-decode.h gdb: remove cmd_list_element::function::sfunc 2021-07-23 15:38:54 -04:00
cli-dump.c gdb: remove cmd_list_element::function::sfunc 2021-07-23 15:38:54 -04:00
cli-interp.c gdbsupport, gdb: give names to observers 2021-04-24 19:26:41 -04:00
cli-interp.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-logging.c gdb: generate the prefix name for prefix commands on demand 2021-05-12 11:19:22 +01:00
cli-option.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-option.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-script.c cli-script: use unique_ptr to not leak next struct 2021-05-20 21:03:47 +02:00
cli-script.h cli-script: use unique_ptr to not leak next struct 2021-05-20 21:03:47 +02:00
cli-setshow.c gdb: remove cmd_list_element::function::sfunc 2021-07-23 15:38:54 -04:00
cli-setshow.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-style.c gdb: remove context parameter from add_setshow_enum_cmd 2021-06-25 21:39:26 -04:00
cli-style.h gdb: generate the prefix name for prefix commands on demand 2021-05-12 11:19:22 +01:00
cli-utils.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-utils.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00