]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove ALL_UIS
authorTom Tromey <tom@tromey.com>
Sat, 16 May 2020 15:58:45 +0000 (09:58 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 16 May 2020 15:58:46 +0000 (09:58 -0600)
Continuing my goal of removing the "ALL_*" iterator macros, this
removes ALL_UIS, replacing it with an iterator adaptor.

gdb/ChangeLog
2020-05-16  Tom Tromey  <tom@tromey.com>

* top.c (quit_force): Update.
* infrun.c (handle_no_resumed): Update.
* top.h (all_uis): New function.
(ALL_UIS): Remove.

gdb/ChangeLog
gdb/infrun.c
gdb/top.c
gdb/top.h

index 8d6901efe67ce640bdd22e3d9338ae516e24de9e..def9db59b83b02b690299249a8a99c91cecf9c06 100644 (file)
@@ -1,3 +1,10 @@
+2020-05-16  Tom Tromey  <tom@tromey.com>
+
+       * top.c (quit_force): Update.
+       * infrun.c (handle_no_resumed): Update.
+       * top.h (all_uis): New function.
+       (ALL_UIS): Remove.
+
 2020-05-16  Simon Marchi  <simon.marchi@efficios.com>
 
        * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Fix condition.
index 601a2acca429969cf54ca5c3891273dad51ed2e3..95fc3bfe45930b53c33cb4de165db9c070449ad8 100644 (file)
@@ -5045,10 +5045,9 @@ handle_no_resumed (struct execution_control_state *ecs)
 {
   if (target_can_async_p ())
     {
-      struct ui *ui;
       int any_sync = 0;
 
-      ALL_UIS (ui)
+      for (ui *ui : all_uis ())
        {
          if (ui->prompt_state == PROMPT_BLOCKED)
            {
index 3589d6b6ce74a81780cc34ad6595a32e339ea6c0..c62eb57695c21365d360b1afc6049aadea8d67fd 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1782,12 +1782,11 @@ quit_force (int *exit_arg, int from_tty)
     {
       if (write_history_p && history_filename)
        {
-         struct ui *ui;
          int save = 0;
 
          /* History is currently shared between all UIs.  If there's
             any UI with a terminal, save history.  */
-         ALL_UIS (ui)
+         for (ui *ui : all_uis ())
            {
              if (input_interactive_p (ui))
                {
index e98772a51e68ab8cb4b50136217966c521224ff5..fd992977155f139f962244dad1c171a46420c175 100644 (file)
--- a/gdb/top.h
+++ b/gdb/top.h
@@ -22,6 +22,7 @@
 
 #include "gdbsupport/buffer.h"
 #include "gdbsupport/event-loop.h"
+#include "gdbsupport/next-iterator.h"
 #include "value.h"
 
 struct tl_interp_info;
@@ -206,9 +207,12 @@ public:
 #define SWITCH_THRU_ALL_UIS()          \
   for (switch_thru_all_uis stau_state; !stau_state.done (); stau_state.next ())
 
-/* Traverse over all UIs.  */
-#define ALL_UIS(UI)                            \
-  for (UI = ui_list; UI; UI = UI->next)                \
+/* An adapter that can be used to traverse over all UIs.  */
+static inline
+next_adapter<ui> all_uis ()
+{
+  return next_adapter<ui> (ui_list);
+}
 
 /* Register the UI's input file descriptor in the event loop.  */
 extern void ui_register_input_event_handler (struct ui *ui);