[RFA,16/23] Remove in_user_command

Message ID 20170503224626.2818-17-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey May 3, 2017, 10:46 p.m. UTC
  While working on the next patch in this series, I found that the
global in_user_command is not used.  This patch removes it.  (I didn't
think to check Insight until submitting this series; and it's not very
convenient to do so, so if someone has it checked out and could look
at it, that would be nice.)

2017-05-02  Tom Tromey  <tom@tromey.com>

	* top.h (in_user_command): Remove.
	* top.c (in_user_command): Remove.
	* cli/cli-script.c (do_restore_user_call_depth)
	(execute_user_command): Update.
---
 gdb/ChangeLog        | 7 +++++++
 gdb/cli/cli-script.c | 6 ------
 gdb/top.c            | 4 ----
 gdb/top.h            | 1 -
 4 files changed, 7 insertions(+), 11 deletions(-)
  

Comments

Pedro Alves June 5, 2017, 1:27 p.m. UTC | #1
On 05/03/2017 11:46 PM, Tom Tromey wrote:
> While working on the next patch in this series, I found that the
> global in_user_command is not used.

Looks like I removed the last (or only) user in:

 268a799a454ce862f516ff2215290fae08eca7fa ("Make stdin be per UI")
 https://sourceware.org/ml/gdb-patches/2016-05/msg00123.html

>  This patch removes it.  (I didn't
> think to check Insight until submitting this series; and it's not very
> convenient to do so, so if someone has it checked out and could look
> at it, that would be nice.)

Insight master is still based on a gdb from Jan 2016 so it still
has the use in the old input_from_terminal_p in top.c, but there's no
use in gdbtk/libgui.  If insight really needs it when it rebases,
we can come up with something then.

> 
> 2017-05-02  Tom Tromey  <tom@tromey.com>
> 
> 	* top.h (in_user_command): Remove.
> 	* top.c (in_user_command): Remove.
> 	* cli/cli-script.c (do_restore_user_call_depth)
> 	(execute_user_command): Update.

OK.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9f75d1e..45c5db7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@ 
 2017-05-02  Tom Tromey  <tom@tromey.com>
 
+	* top.h (in_user_command): Remove.
+	* top.c (in_user_command): Remove.
+	* cli/cli-script.c (do_restore_user_call_depth)
+	(execute_user_command): Update.
+
+2017-05-02  Tom Tromey  <tom@tromey.com>
+
 	* valops.c (search_struct_method): Use std::vector.
 	* valarith.c (value_concat): Use std::vector.
 	* target.c (memory_xfer_partial): Use std::vector.
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 0aa1848..994f5c4 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -379,8 +379,6 @@  do_restore_user_call_depth (void * call_depth)
   int *depth = (int *) call_depth;
 
   (*depth)--;
-  if ((*depth) == 0)
-    in_user_command = 0;
 }
 
 
@@ -411,10 +409,6 @@  execute_user_command (struct cmd_list_element *c, char *args)
   make_cleanup (do_restore_instream_cleanup, ui->instream);
   ui->instream = NULL;
 
-  /* Also set the global in_user_command, so that NULL instream is
-     not confused with Insight.  */
-  in_user_command = 1;
-
   scoped_restore save_async = make_scoped_restore (&current_ui->async, 0);
 
   command_nest_depth++;
diff --git a/gdb/top.c b/gdb/top.c
index 652c55a..862016a 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -128,10 +128,6 @@  show_confirm (struct ui_file *file, int from_tty,
 		    value);
 }
 
-/* Flag to indicate whether a user defined command is currently running.  */
-
-int in_user_command;
-
 /* Current working directory.  */
 
 char *current_directory;
diff --git a/gdb/top.h b/gdb/top.h
index 452a381..5d7cb1f 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -218,7 +218,6 @@  extern void ui_unregister_input_event_handler (struct ui *ui);
 
 /* From top.c.  */
 extern char *saved_command_line;
-extern int in_user_command;
 extern int confirm;
 extern char gdb_dirbuf[1024];
 extern int inhibit_gdbinit;