Remove ui::num

Message ID 20200727173952.2191504-1-tromey@adacore.com
State New
Headers show
Series
  • Remove ui::num
Related show

Commit Message

Tom Tromey July 27, 2020, 5:39 p.m.
I noticed that nothing uses ui::num, so this patch removes it.

gdb/ChangeLog
2020-07-27  Tom Tromey  <tromey@adacore.com>

	* top.c (ui::ui): Update.
	(highest_ui_num): Remove.
	* top.h (struct ui) <num>: Remove.
---
 gdb/ChangeLog | 6 ++++++
 gdb/top.c     | 4 ----
 gdb/top.h     | 3 ---
 3 files changed, 6 insertions(+), 7 deletions(-)

-- 
2.26.2

Comments

Simon Marchi July 28, 2020, 1:33 p.m. | #1
On 2020-07-27 1:39 p.m., Tom Tromey wrote:
> I noticed that nothing uses ui::num, so this patch removes it.

> 

> gdb/ChangeLog

> 2020-07-27  Tom Tromey  <tromey@adacore.com>

> 

> 	* top.c (ui::ui): Update.

> 	(highest_ui_num): Remove.

> 	* top.h (struct ui) <num>: Remove.

> ---

>  gdb/ChangeLog | 6 ++++++

>  gdb/top.c     | 4 ----

>  gdb/top.h     | 3 ---

>  3 files changed, 6 insertions(+), 7 deletions(-)

> 

> diff --git a/gdb/top.c b/gdb/top.c

> index acd31afb9a9..8dbc7ced4dc 100644

> --- a/gdb/top.c

> +++ b/gdb/top.c

> @@ -270,14 +270,10 @@ void (*deprecated_call_command_hook) (struct cmd_list_element * c,

>  

>  void (*deprecated_context_hook) (int id);

>  

> -/* The highest UI number ever assigned.  */

> -static int highest_ui_num;

> -

>  /* See top.h.  */

>  

>  ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_)

>    : next (nullptr),

> -    num (++highest_ui_num),

>      call_readline (nullptr),

>      input_handler (nullptr),

>      command_editing (0),

> diff --git a/gdb/top.h b/gdb/top.h

> index fd992977155..92b096492f0 100644

> --- a/gdb/top.h

> +++ b/gdb/top.h

> @@ -65,9 +65,6 @@ struct ui

>    /* Pointer to next in singly-linked list.  */

>    struct ui *next;

>  

> -  /* Convenient handle (UI number).  Unique across all UIs.  */

> -  int num;

> -

>    /* The UI's command line buffer.  This is to used to accumulate

>       input until we have a whole command line.  */

>    struct buffer line_buffer;

> -- 

> 2.26.2

> 


I found it strange that this was not used in some kind of "info uis" command, but
in fact there is no way to list the UIs, probably because it wouldn't be useful.

I think this is fine to remove, worst case we re-add it if needed later.

Simon
Tom Tromey Sept. 15, 2020, 2:54 p.m. | #2
>> I noticed that nothing uses ui::num, so this patch removes it.

>> 

>> gdb/ChangeLog

>> 2020-07-27  Tom Tromey  <tromey@adacore.com>

>> 

>> * top.c (ui::ui): Update.

>> (highest_ui_num): Remove.

>> * top.h (struct ui) <num>: Remove.

[...]

Simon> I think this is fine to remove, worst case we re-add it if needed later.

I'm checking this in now.

Tom

Patch

diff --git a/gdb/top.c b/gdb/top.c
index acd31afb9a9..8dbc7ced4dc 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -270,14 +270,10 @@  void (*deprecated_call_command_hook) (struct cmd_list_element * c,
 
 void (*deprecated_context_hook) (int id);
 
-/* The highest UI number ever assigned.  */
-static int highest_ui_num;
-
 /* See top.h.  */
 
 ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_)
   : next (nullptr),
-    num (++highest_ui_num),
     call_readline (nullptr),
     input_handler (nullptr),
     command_editing (0),
diff --git a/gdb/top.h b/gdb/top.h
index fd992977155..92b096492f0 100644
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -65,9 +65,6 @@  struct ui
   /* Pointer to next in singly-linked list.  */
   struct ui *next;
 
-  /* Convenient handle (UI number).  Unique across all UIs.  */
-  int num;
-
   /* The UI's command line buffer.  This is to used to accumulate
      input until we have a whole command line.  */
   struct buffer line_buffer;