[v8,3/6] GDB: Add references to erased args in cli-decode.c

Message ID alpine.DEB.2.20.2211240502050.19931@tpp.orcam.me.uk
State Superseded
Headers
Series gdb: split array and string limiting options |

Commit Message

Maciej W. Rozycki Nov. 24, 2022, 11:22 a.m. UTC
  Complement commit 1d7fe7f01b93 ("gdb: Introduce setting construct within 
cmd_list_element") and commit 702991711a91 ("gdb: Have setter and getter 
callbacks for settings") and update inline documentation accordingly for 
`add_set_or_show_cmd' and `add_setshow_cmd_full_erased', documenting the 
`args' parameter and removing references to `var', `set_setting_func' 
and `get_setting_func'.
---
New change in v8.
---
 gdb/cli/cli-decode.c |   17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

gdb-setshow-cmd-erased-args-doc.diff
  

Comments

Simon Marchi Jan. 12, 2023, 6:46 p.m. UTC | #1
On 11/24/22 06:22, Maciej W. Rozycki wrote:
> Complement commit 1d7fe7f01b93 ("gdb: Introduce setting construct within 
> cmd_list_element") and commit 702991711a91 ("gdb: Have setter and getter 
> callbacks for settings") and update inline documentation accordingly for 
> `add_set_or_show_cmd' and `add_setshow_cmd_full_erased', documenting the 
> `args' parameter and removing references to `var', `set_setting_func' 
> and `get_setting_func'.

If you want to change them so they cross-reference a single place where
these parameters are documented, it would be fine too.  But in any case:

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon
  
Maciej W. Rozycki Jan. 18, 2023, 11:41 p.m. UTC | #2
On Thu, 12 Jan 2023, Simon Marchi wrote:

> > Complement commit 1d7fe7f01b93 ("gdb: Introduce setting construct within 
> > cmd_list_element") and commit 702991711a91 ("gdb: Have setter and getter 
> > callbacks for settings") and update inline documentation accordingly for 
> > `add_set_or_show_cmd' and `add_setshow_cmd_full_erased', documenting the 
> > `args' parameter and removing references to `var', `set_setting_func' 
> > and `get_setting_func'.
> 
> If you want to change them so they cross-reference a single place where
> these parameters are documented, it would be fine too.  But in any case:

 This is good enough however, so I have applied it unchanged.  Thank you 
for your review.

  Maciej
  

Patch

Index: src/gdb/cli/cli-decode.c
===================================================================
--- src.orig/gdb/cli/cli-decode.c
+++ src/gdb/cli/cli-decode.c
@@ -496,11 +496,8 @@  empty_func (const char *args, int from_t
    TYPE is set_cmd or show_cmd.
    THECLASS is as in add_cmd.
    VAR_TYPE is the kind of thing we are setting.
-   VAR is address of the variable being controlled by this command.
-   SET_SETTING_FUNC is a pointer to an optional function callback used to set
-   the setting value.
-   GET_SETTING_FUNC is a pointer to an optional function callback used to get
-   the setting value.
+   ARGS is a pre-validated type-erased reference to the variable being
+   controlled by this command.
    DOC is the documentation string.  */
 
 static struct cmd_list_element *
@@ -526,12 +523,10 @@  add_set_or_show_cmd (const char *name,
 
 /* Add element named NAME to both the command SET_LIST and SHOW_LIST.
    THECLASS is as in add_cmd.  VAR_TYPE is the kind of thing we are
-   setting.  VAR is address of the variable being controlled by this
-   command.  If nullptr is given as VAR, then both SET_SETTING_FUNC and
-   GET_SETTING_FUNC must be provided. SET_SETTING_FUNC and GET_SETTING_FUNC are
-   callbacks used to access and modify the underlying property, whatever its
-   storage is.  SET_FUNC and SHOW_FUNC are the callback functions (if non-NULL).
-   SET_DOC, SHOW_DOC and HELP_DOC are the documentation strings.
+   setting.  ARGS is a pre-validated type-erased reference to the
+   variable being controlled by this command.  SET_FUNC and SHOW_FUNC
+   are the callback functions (if non-NULL).  SET_DOC, SHOW_DOC and
+   HELP_DOC are the documentation strings.
 
    Return the newly created set and show commands.  */