* [PATCH] gdb: remove unused parameters in print_doc_of_command, apropos_cmd
@ 2023-04-01 19:32 Simon Marchi
2023-04-01 22:58 ` Kevin Buettner
2023-04-02 11:43 ` Philippe Waroquiers
0 siblings, 2 replies; 4+ messages in thread
From: Simon Marchi @ 2023-04-01 19:32 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
I noticed the prefix parameter was unused in print_doc_of_command. And
when removing it, it becomes unused in apropos_cmd.
Sending as non-obvious, in case somebody can spot if this is a mistake,
and it should actually be used.
Change-Id: Id72980b03fe091b22931e6b85945f412b274ed5e
---
gdb/cli/cli-cmds.c | 2 +-
gdb/cli/cli-decode.c | 16 +++++++---------
gdb/cli/cli-decode.h | 2 +-
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 0c680896c917..3b1c6a9f4bd6 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1768,7 +1768,7 @@ apropos_command (const char *arg, int from_tty)
compiled_regex pattern (arg, REG_ICASE,
_("Error in regular expression"));
- apropos_cmd (gdb_stdout, cmdlist, verbose, pattern, "");
+ apropos_cmd (gdb_stdout, cmdlist, verbose, pattern);
}
/* The options for the "alias" command. */
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 2a4f9b45ab1d..948592a6f621 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1637,9 +1637,8 @@ fput_command_names_styled (const cmd_list_element &c,
otherwise print only one-line help for command C. */
static void
-print_doc_of_command (const cmd_list_element &c, const char *prefix,
- bool verbose, compiled_regex &highlight,
- struct ui_file *stream)
+print_doc_of_command (const cmd_list_element &c, bool verbose,
+ compiled_regex &highlight, struct ui_file *stream)
{
/* When printing the full documentation, add a line to separate
this documentation from the previous command help, in the likely
@@ -1674,7 +1673,7 @@ print_doc_of_command (const cmd_list_element &c, const char *prefix,
void
apropos_cmd (struct ui_file *stream,
struct cmd_list_element *commandlist,
- bool verbose, compiled_regex ®ex, const char *prefix)
+ bool verbose, compiled_regex ®ex)
{
struct cmd_list_element *c;
int returnvalue;
@@ -1698,7 +1697,7 @@ apropos_cmd (struct ui_file *stream,
/* Try to match against the name. */
returnvalue = regex.search (c->name, name_len, 0, name_len, NULL);
if (returnvalue >= 0)
- print_doc_of_command (*c, prefix, verbose, regex, stream);
+ print_doc_of_command (*c, verbose, regex, stream);
/* Try to match against the name of the aliases. */
for (const cmd_list_element &alias : c->aliases)
@@ -1707,7 +1706,7 @@ apropos_cmd (struct ui_file *stream,
returnvalue = regex.search (alias.name, name_len, 0, name_len, NULL);
if (returnvalue >= 0)
{
- print_doc_of_command (*c, prefix, verbose, regex, stream);
+ print_doc_of_command (*c, verbose, regex, stream);
break;
}
}
@@ -1718,15 +1717,14 @@ apropos_cmd (struct ui_file *stream,
/* Try to match against documentation. */
if (regex.search (c->doc, doc_len, 0, doc_len, NULL) >= 0)
- print_doc_of_command (*c, prefix, verbose, regex, stream);
+ print_doc_of_command (*c, verbose, regex, stream);
}
/* Check if this command has subcommands. */
if (c->is_prefix ())
{
/* Recursively call ourselves on the subcommand list,
passing the right prefix in. */
- apropos_cmd (stream, *c->subcommands, verbose, regex,
- c->prefixname ().c_str ());
+ apropos_cmd (stream, *c->subcommands, verbose, regex);
}
}
}
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 013ffc8fd4cf..8fe9325c2da3 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -283,7 +283,7 @@ struct cmd_list_element
extern void help_cmd (const char *, struct ui_file *);
extern void apropos_cmd (struct ui_file *, struct cmd_list_element *,
- bool verbose, compiled_regex &, const char *);
+ bool verbose, compiled_regex &);
/* Used to mark commands that don't do anything. If we just leave the
function field NULL, the command is interpreted as a help topic, or
base-commit: 3026cdbdde0e1937f811b52ba18fe3fbb1419ef9
--
2.40.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: remove unused parameters in print_doc_of_command, apropos_cmd
2023-04-01 19:32 [PATCH] gdb: remove unused parameters in print_doc_of_command, apropos_cmd Simon Marchi
@ 2023-04-01 22:58 ` Kevin Buettner
2023-04-02 11:43 ` Philippe Waroquiers
1 sibling, 0 replies; 4+ messages in thread
From: Kevin Buettner @ 2023-04-01 22:58 UTC (permalink / raw)
To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi
On Sat, 1 Apr 2023 15:32:40 -0400
Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> wrote:
> I noticed the prefix parameter was unused in print_doc_of_command. And
> when removing it, it becomes unused in apropos_cmd.
>
> Sending as non-obvious, in case somebody can spot if this is a mistake,
> and it should actually be used.
Looks reasonable to me...
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: remove unused parameters in print_doc_of_command, apropos_cmd
2023-04-01 19:32 [PATCH] gdb: remove unused parameters in print_doc_of_command, apropos_cmd Simon Marchi
2023-04-01 22:58 ` Kevin Buettner
@ 2023-04-02 11:43 ` Philippe Waroquiers
2023-04-02 18:12 ` Simon Marchi
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Waroquiers @ 2023-04-02 11:43 UTC (permalink / raw)
To: Simon Marchi, gdb-patches
On Sat, 2023-04-01 at 15:32 -0400, Simon Marchi via Gdb-patches wrote:
> I noticed the prefix parameter was unused in print_doc_of_command. And
> when removing it, it becomes unused in apropos_cmd.
>
> Sending as non-obvious, in case somebody can spot if this is a mistake,
> and it should actually be used.
I think that the prefix arguments were removed as part of
2f822da535ba9b159174d02d7114b4fc4f7c8818
Likely these 2 prefix args felt through the cracks.
Philippe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gdb: remove unused parameters in print_doc_of_command, apropos_cmd
2023-04-02 11:43 ` Philippe Waroquiers
@ 2023-04-02 18:12 ` Simon Marchi
0 siblings, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2023-04-02 18:12 UTC (permalink / raw)
To: Philippe Waroquiers, gdb-patches
On 4/2/23 07:43, Philippe Waroquiers wrote:
> On Sat, 2023-04-01 at 15:32 -0400, Simon Marchi via Gdb-patches wrote:
>> I noticed the prefix parameter was unused in print_doc_of_command. And
>> when removing it, it becomes unused in apropos_cmd.
>>
>> Sending as non-obvious, in case somebody can spot if this is a mistake,
>> and it should actually be used.
>
>
> I think that the prefix arguments were removed as part of
> 2f822da535ba9b159174d02d7114b4fc4f7c8818
>
> Likely these 2 prefix args felt through the cracks.
Ok, thanks for checking, pushed.
Simon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-02 18:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-01 19:32 [PATCH] gdb: remove unused parameters in print_doc_of_command, apropos_cmd Simon Marchi
2023-04-01 22:58 ` Kevin Buettner
2023-04-02 11:43 ` Philippe Waroquiers
2023-04-02 18:12 ` Simon Marchi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).