binutils-gdb/gdb/cli
Simon Marchi 3a553c80da gdb: rename cfunc to simple_func
After browsing the CLI code for quite a while and trying really hard, I
reached the conclusion that I can't give a meaningful explanation of
what "sfunc" and "cfunc" functions are, in cmd_list_element.  I don't
see a logic at all.  That makes it very difficult to do any kind of
change.  Unless somebody can make sense out of all that, I'd like to try
to retro-fit some logic in the cmd_list_element callback function code
so that we can understand what is going on, do some cleanups and add new
features.

The first change is about "cfunc".  I can't figure out what the "c" in
cfunc means.  It's not const, because there's already "const" in
"cmd_const_cfunc_ftype", and the previous "cmd_cfunc_ftype" had nothing
const..  It's not "cmd" or "command", because there's already "cmd" in
"cmd_const_cfunc_ftype".

The "main" command callback, cmd_list_element::func, has three
parameters, whereas cfunc has two.  It is missing the cmd_list_element
parameter.  So the only reason I see for cfunc to exist is to be a shim
between the three and two parameter versions.  Most commands don't need
to receive the cmd_list_element object, so adding it everywhere would be
long and would just add more unnecessary boilerplate.  So since this is
the "simple" version of the callback, compared to the "full", I suggest
renaming cmd_const_cfunc_ftype into cmd_simple_func_ftype, as well as
everything (like the utility functions) that goes with it.

Change-Id: I4e46cacfd77a66bc1cbf683f6a362072504b7868
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: rename cfunc to simple_func 2021-07-23 15:38:54 -04:00
cli-decode.h gdb: rename cfunc to simple_func 2021-07-23 15:38:54 -04:00
cli-dump.c gdb: add context getter/setter to cmd_list_element 2021-06-25 21:35:40 -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: Pass std::strings to ui_out::field_string () where convenient 2021-05-19 13:58:41 +01: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