Remove interp_ui_out
authorTom Tromey <tom@tromey.com>
Mon, 30 Apr 2018 05:12:06 +0000 (23:12 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 25 May 2018 18:41:01 +0000 (12:41 -0600)
The function interp_ui_out simply calls the interp_ui_out method.
However, if it is passed a NULL interpreter, it first finds the
current interpreter.  I believe, though, that NULL is never passed
here, and I think it's simpler to just remove this function and
require callers to be more explicit.

ChangeLog
2018-05-25  Tom Tromey <tom@tromey.com>

* utils.c (fputs_maybe_filtered): Update.
* linespec.c (decode_line_full): Update.
* mi/mi-interp.c (mi_on_normal_stop_1, mi_tsv_modified)
(mi_print_breakpoint_for_event, mi_solib_loaded)
(mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
(mi_user_selected_context_changed): Update.
* mi/mi-main.c (mi_execute_command): Update.
* cli/cli-script.c (execute_control_command): Update.
* python/python.c (execute_gdb_command): Update.
* solib.c (info_sharedlibrary_command): Update.
* interps.c (interp_ui_out): Remove.
* interps.h (interp_ui_out): Remove.

gdb/ChangeLog
gdb/cli/cli-script.c
gdb/interps.c
gdb/interps.h
gdb/linespec.c
gdb/mi/mi-interp.c
gdb/mi/mi-main.c
gdb/python/python.c
gdb/solib.c
gdb/utils.c

index 1cf048bbb3beca4a09800b5cef8b09ccc5fb51ce..5cd551a4ef15f7ad7edc7c21c0270fbae0a5ae84 100644 (file)
@@ -1,3 +1,18 @@
+2018-05-25  Tom Tromey <tom@tromey.com>
+
+       * utils.c (fputs_maybe_filtered): Update.
+       * linespec.c (decode_line_full): Update.
+       * mi/mi-interp.c (mi_on_normal_stop_1, mi_tsv_modified)
+       (mi_print_breakpoint_for_event, mi_solib_loaded)
+       (mi_solib_unloaded, mi_command_param_changed, mi_memory_changed)
+       (mi_user_selected_context_changed): Update.
+       * mi/mi-main.c (mi_execute_command): Update.
+       * cli/cli-script.c (execute_control_command): Update.
+       * python/python.c (execute_gdb_command): Update.
+       * solib.c (info_sharedlibrary_command): Update.
+       * interps.c (interp_ui_out): Remove.
+       * interps.h (interp_ui_out): Remove.
+
 2018-05-25  Tom Tromey  <tom@tromey.com>
 
        * tui/tui-interp.c (as_tui_interp): Use dynamic_cast.
index a62e4fe1c19e00a85dfcd1a5c5d5408525d2bb07..72de8ec1c780a40dc641e25dded1ceabfa17200a 100644 (file)
@@ -689,7 +689,7 @@ execute_control_command (struct command_line *cmd, int from_tty)
      breakpoint commands while running the MI interpreter.  */
   interp *console = interp_lookup (current_ui, INTERP_CONSOLE);
   scoped_restore save_uiout
-    = make_scoped_restore (&current_uiout, interp_ui_out (console));
+    = make_scoped_restore (&current_uiout, console->interp_ui_out ());
 
   return execute_control_command_1 (cmd, from_tty);
 }
index 162cd838ec3b59ef76e36c461a232d7d259d93f1..58846258563dea7d093d3b4d2e09916c3c46121b 100644 (file)
@@ -251,18 +251,6 @@ set_top_level_interpreter (const char *name)
   interp_set (interp, true);
 }
 
-/* Returns the current interpreter.  */
-
-struct ui_out *
-interp_ui_out (struct interp *interp)
-{
-  struct ui_interp_info *ui_interp = get_current_interp_info ();
-
-  if (interp == NULL)
-    interp = ui_interp->current_interpreter;
-  return interp->interp_ui_out ();
-}
-
 void
 current_interp_set_logging (ui_file_up logfile,
                            bool logging_redirect)
index 067c9ddefd70a304ca24c5ba3716391146f08b78..694149a6ca1001acfe0d07478a54189246573e15 100644 (file)
@@ -98,7 +98,6 @@ extern struct interp *interp_lookup (struct ui *ui, const char *name);
    interpreter fails to initialize.  */
 extern void set_top_level_interpreter (const char *name);
 
-extern struct ui_out *interp_ui_out (struct interp *interp);
 extern const char *interp_name (struct interp *interp);
 
 /* Temporarily set the current interpreter, and reset it on
index dab50daa90bd768566c541dc7e840fc370720ce3..835650750cfd165d3f09764d9ff6f47deab2a5b6 100644 (file)
@@ -3293,7 +3293,7 @@ decode_line_full (const struct event_location *location, int flags,
 
   if (select_mode == NULL)
     {
-      if (interp_ui_out (top_level_interpreter ())->is_mi_like_p ())
+      if (top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ())
        select_mode = multiple_symbols_all;
       else
        select_mode = multiple_symbols_select_mode ();
index 7536817f43a72d96e1a4de66bc73f5a2c373edf9..99ce1eb5d64efe394e0437cb93c361afb83574b0 100644 (file)
@@ -625,7 +625,7 @@ mi_on_normal_stop_1 (struct bpstats *bs, int print_frame)
   /* Since this can be called when CLI command is executing,
      using cli interpreter, be sure to use MI uiout for output,
      not the current one.  */
-  struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ());
+  struct ui_out *mi_uiout = top_level_interpreter ()->interp_ui_out ();
   struct mi_interp *mi = (struct mi_interp *) top_level_interpreter ();
 
   if (print_frame)
@@ -802,7 +802,7 @@ mi_tsv_modified (const struct trace_state_variable *tsv)
       if (mi == NULL)
        continue;
 
-      mi_uiout = interp_ui_out (top_level_interpreter ());
+      mi_uiout = top_level_interpreter ()->interp_ui_out ();
 
       target_terminal::scoped_restore_terminal_state term_state;
       target_terminal::ours_for_output ();
@@ -829,7 +829,7 @@ mi_tsv_modified (const struct trace_state_variable *tsv)
 static void
 mi_print_breakpoint_for_event (struct mi_interp *mi, breakpoint *bp)
 {
-  ui_out *mi_uiout = interp_ui_out (mi);
+  ui_out *mi_uiout = mi->interp_ui_out ();
 
   /* We want the output from print_breakpoint to go to
      mi->event_channel.  One approach would be to just call
@@ -1090,7 +1090,7 @@ mi_solib_loaded (struct so_list *solib)
       if (mi == NULL)
        continue;
 
-      uiout = interp_ui_out (top_level_interpreter ());
+      uiout = top_level_interpreter ()->interp_ui_out ();
 
       target_terminal::scoped_restore_terminal_state term_state;
       target_terminal::ours_for_output ();
@@ -1118,7 +1118,7 @@ mi_solib_unloaded (struct so_list *solib)
       if (mi == NULL)
        continue;
 
-      uiout = interp_ui_out (top_level_interpreter ());
+      uiout = top_level_interpreter ()->interp_ui_out ();
 
       target_terminal::scoped_restore_terminal_state term_state;
       target_terminal::ours_for_output ();
@@ -1157,7 +1157,7 @@ mi_command_param_changed (const char *param, const char *value)
       if (mi == NULL)
        continue;
 
-      mi_uiout = interp_ui_out (top_level_interpreter ());
+      mi_uiout = top_level_interpreter ()->interp_ui_out ();
 
       target_terminal::scoped_restore_terminal_state term_state;
       target_terminal::ours_for_output ();
@@ -1193,7 +1193,7 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr,
       if (mi == NULL)
        continue;
 
-      mi_uiout = interp_ui_out (top_level_interpreter ());
+      mi_uiout = top_level_interpreter ()->interp_ui_out ();
 
       target_terminal::scoped_restore_terminal_state term_state;
       target_terminal::ours_for_output ();
@@ -1246,7 +1246,7 @@ mi_user_selected_context_changed (user_selected_what selection)
       if (mi == NULL)
        continue;
 
-      mi_uiout = interp_ui_out (top_level_interpreter ());
+      mi_uiout = top_level_interpreter ()->interp_ui_out ();
 
       mi_uiout->redirect (mi->event_channel);
       ui_out_redirect_pop redirect_popper (mi_uiout);
index 13556d4d93d13a60f0b621c20436aca8bd78613b..76e783daf9825b6c083dbc47a6afed2d3500f881 100644 (file)
@@ -1993,7 +1993,7 @@ mi_execute_command (const char *cmd, int from_tty)
 
       if (/* The notifications are only output when the top-level
             interpreter (specified on the command line) is MI.  */
-         interp_ui_out (top_level_interpreter ())->is_mi_like_p ()
+         top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ()
          /* Don't try report anything if there are no threads --
             the program is dead.  */
          && thread_count () != 0
index db37331dc48484e57863b335f632fc0aced286f1..c29e7d7a6b27e9cc21eae176144c5685131ce9ba 100644 (file)
@@ -609,7 +609,7 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
       /* Use the console interpreter uiout to have the same print format
        for console or MI.  */
       interp = interp_lookup (current_ui, "console");
-      current_uiout = interp_ui_out (interp);
+      current_uiout = interp->interp_ui_out ();
 
       scoped_restore preventer = prevent_dont_repeat ();
       if (to_string)
index 5011bd7df1dfe7c0df15e491915178ebf2ccc9b3..b28ebc628cb1a190b0450af246bb50b78e715485 100644 (file)
@@ -1093,7 +1093,7 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
            uiout->field_skip ("to");
          }
 
-       if (! interp_ui_out (top_level_interpreter ())->is_mi_like_p ()
+       if (! top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ()
            && so->symbols_loaded
            && !objfile_has_symbols (so->objfile))
          {
index 9c5bf68e5aaf2d038d94738f9e26b82b79d9d4df..a2e933bc8dc41348a7a689c3186a71e67100712f 100644 (file)
@@ -1683,7 +1683,7 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
       || batch_flag
       || (lines_per_page == UINT_MAX && chars_per_line == UINT_MAX)
       || top_level_interpreter () == NULL
-      || interp_ui_out (top_level_interpreter ())->is_mi_like_p ())
+      || top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ())
     {
       fputs_unfiltered (linebuffer, stream);
       return;
This page took 0.035728 seconds and 4 git commands to generate.