Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Remove init_cli_cmds
@ 2019-07-11 15:31 Tom Tromey
  2019-07-11 15:58 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2019-07-11 15:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I noticed that init_cli_cmds only installs a command, and so doesn't
need to be handled specially.  This patch merges it into
_initialize_cli_cmds.

The help text is constructed dynamically, which is sometimes an
indication that special treatment is needed; but in this case it is
just to insert the value of "gdbinit", which is created at
compile-time and not modified; so this doesn't affect the result.

gdb/ChangeLog
2019-07-11  Tom Tromey  <tromey@adacore.com>

	* cli/cli-cmds.c (init_cli_cmds): Remove, merging contents
	into...
	(_initialize_cli_cmds): ...here.
	* top.c (gdb_init): Don't call init_cli_cmds.
	* cli/cli-cmds.h (init_cli_cmds): Don't declare.
---
 gdb/ChangeLog      | 8 ++++++++
 gdb/cli/cli-cmds.c | 9 +--------
 gdb/cli/cli-cmds.h | 2 --
 gdb/top.c          | 1 -
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index e689c0ff64e..2ef28a5f277 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -2215,15 +2215,8 @@ Make \"spe\" an alias of \"set print elements\":\n\
   alias spe = set print elements\n\
 Make \"elms\" an alias of \"elements\" in the \"set print\" command:\n\
   alias -a set print elms = set print elements"));
-}
-
-void
-init_cli_cmds (void)
-{
-  struct cmd_list_element *c;
-  char *source_help_text;
 
-  source_help_text = xstrprintf (_("\
+  const char *source_help_text = xstrprintf (_("\
 Read commands from a file named FILE.\n\
 \n\
 Usage: source [-s] [-v] FILE\n\
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index ac0591e2e89..5bfffde04a1 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -105,8 +105,6 @@ extern struct cmd_list_element *showchecklist;
 
 void init_cmd_lists (void);
 
-void init_cli_cmds (void);
-
 int is_complete_command (struct cmd_list_element *cmd);
 
 /* Exported to gdb/main.c */
diff --git a/gdb/top.c b/gdb/top.c
index 68cf405f6e0..63754169405 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2265,7 +2265,6 @@ gdb_init (char *argv0)
   initialize_progspace ();
   initialize_inferiors ();
   initialize_current_architecture ();
-  init_cli_cmds();
   init_main ();			/* But that omits this file!  Do it now.  */
 
   initialize_stdin_serial ();
-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Remove init_cli_cmds
  2019-07-11 15:31 [PATCH] Remove init_cli_cmds Tom Tromey
@ 2019-07-11 15:58 ` Pedro Alves
  2019-07-11 16:21   ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2019-07-11 15:58 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 7/11/19 4:31 PM, Tom Tromey wrote:
> I noticed that init_cli_cmds only installs a command, and so doesn't
> need to be handled specially.  This patch merges it into
> _initialize_cli_cmds.
> 
> The help text is constructed dynamically, which is sometimes an
> indication that special treatment is needed; but in this case it is
> just to insert the value of "gdbinit", which is created at
> compile-time and not modified; so this doesn't affect the result.

I wonder why we have a gdbinit variable at all, instead of using
the GDBINIT macro directly.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Remove init_cli_cmds
  2019-07-11 15:58 ` Pedro Alves
@ 2019-07-11 16:21   ` Tom Tromey
  2019-07-11 16:26     ` Tom Tromey
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2019-07-11 16:21 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

Pedro> I wonder why we have a gdbinit variable at all, instead of using
Pedro> the GDBINIT macro directly.

Me too.  I'll nuke that.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Remove init_cli_cmds
  2019-07-11 16:21   ` Tom Tromey
@ 2019-07-11 16:26     ` Tom Tromey
  2019-07-11 16:30       ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2019-07-11 16:26 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches

>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:

Pedro> I wonder why we have a gdbinit variable at all, instead of using
Pedro> the GDBINIT macro directly.

Tom> Me too.  I'll nuke that.

Note that we still have to use printf for the help text, to be
i18n-correct.

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Remove init_cli_cmds
  2019-07-11 16:26     ` Tom Tromey
@ 2019-07-11 16:30       ` Pedro Alves
  0 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2019-07-11 16:30 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 7/11/19 5:25 PM, Tom Tromey wrote:
>>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:
> 
> Pedro> I wonder why we have a gdbinit variable at all, instead of using
> Pedro> the GDBINIT macro directly.
> 
> Tom> Me too.  I'll nuke that.
> 
> Note that we still have to use printf for the help text, to be
> i18n-correct.

Agreed.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-11 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-11 15:31 [PATCH] Remove init_cli_cmds Tom Tromey
2019-07-11 15:58 ` Pedro Alves
2019-07-11 16:21   ` Tom Tromey
2019-07-11 16:26     ` Tom Tromey
2019-07-11 16:30       ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox