+2017-01-10  Simon Marchi  <simon.marchi@ericsson.com>
+
+       * cli-out.c (cli_ui_out::do_redirect): Change return type to
+       void.
+       * cli-out.h (cli_ui_out::do_redirect): Likewise.
+       * mi/mi-out.c (mi_ui_out::do_redirect): Likewise.
+       * mi/mi-out.h (mi_ui_out::do_redirect): Likewise.
+       * ui-out.c (ui_out::redirect): Likewise.
+       * ui-out.h (ui_out::redirect, ui_out::do_redirect): Likewise.
+       * cli/cli-logging.c (set_logging_redirect): Update call site of
+       ui_out::redirect.
+       (handle_redirections): Likewise.
+       * scm-ports.c (ioscm_with_output_to_port_worker): Likewise.
+       * top.c (execute_command_to_string): Likewise.
+       * utils.c (do_ui_out_redirect_pop): Likewise.
+
 2017-01-10  Simon Marchi  <simon.marchi@ericsson.com>
 
        * stack.c (_initialize_stack): Update "frame" command help message.
 
    and make it therefore active.  OUTSTREAM as NULL will pop the last pushed
    output stream; it is an internal error if it does not exist.  */
 
-int
+void
 cli_ui_out::do_redirect (ui_file *outstream)
 {
   if (outstream != NULL)
     m_streams.push_back (outstream);
   else
     m_streams.pop_back ();
-
-  return 0;
 }
 
 /* local functions */
 
     ATTRIBUTE_PRINTF (2,0);
   virtual void do_wrap_hint (const char *identstring) override;
   virtual void do_flush () override;
-  virtual int do_redirect (struct ui_file * outstream) override;
+  virtual void do_redirect (struct ui_file *outstream) override;
 
   bool suppress_output ()
   { return m_suppress_output; }
 
 
   /* There is a former output pushed on the ui_out_redirect stack.  We
      want to replace it by OUTPUT so we must pop the former value
-     first.  We should either do both the pop and push or to do
-     neither of it.  At least do not try to push OUTPUT if the pop
-     already failed.  */
+     first.  Ideally, we should either do both the pop and push or do
+     neither of them.  */
 
-  if (uiout->redirect (NULL) < 0
-      || uiout->redirect (output) < 0)
-    warning (_("Current output protocol does not support redirection"));
+  uiout->redirect (NULL);
+  uiout->redirect (output);
 
   do_cleanups (cleanups);
 }
 
   /* Don't do the redirect for MI, it confuses MI's ui-out scheme.  */
   if (!current_uiout->is_mi_like_p ())
-    {
-      if (current_uiout->redirect (output) < 0)
-       warning (_("Current output protocol does not support redirection"));
-    }
+    current_uiout->redirect (output);
 }
 
 static void
 
     gdb_stderr = port_file;
   else
     {
-      if (current_uiout->redirect (port_file) < 0)
-       warning (_("Current output protocol does not support redirection"));
-      else
-       make_cleanup_ui_out_redirect_pop (current_uiout);
+      current_uiout->redirect (port_file);
+      make_cleanup_ui_out_redirect_pop (current_uiout);
 
       gdb_stdout = port_file;
     }
 
   gdb_flush (m_streams.back ());
 }
 
-int
+void
 mi_ui_out::do_redirect (ui_file *outstream)
 {
   if (outstream != NULL)
     m_streams.push_back (outstream);
   else
     m_streams.pop_back ();
-
-  return 0;
 }
 
 void
 
     ATTRIBUTE_PRINTF (2,0);
   virtual void do_wrap_hint (const char *identstring) override;
   virtual void do_flush () override;
-  virtual int do_redirect (struct ui_file * outstream) override;
+  virtual void do_redirect (struct ui_file *outstream) override;
 
   virtual bool do_is_mi_like_p () override
   { return true; }
 
 
   make_cleanup_ui_file_delete (str_file);
 
-  if (current_uiout->redirect (str_file) < 0)
-    warning (_("Current output protocol does not support redirection"));
-  else
-    make_cleanup_ui_out_redirect_pop (current_uiout);
+  current_uiout->redirect (str_file);
+  make_cleanup_ui_out_redirect_pop (current_uiout);
 
   scoped_restore save_stdout
     = make_scoped_restore (&gdb_stdout, str_file);
 
   do_flush ();
 }
 
-int
+void
 ui_out::redirect (ui_file *outstream)
 {
-  return do_redirect (outstream);
+  do_redirect (outstream);
 }
 
 /* Test the flags against the mask given.  */
 
   void flush ();
 
   /* Redirect the output of a ui_out object temporarily.  */
-  int redirect (ui_file *outstream);
+  void redirect (ui_file *outstream);
 
   ui_out_flags test_flags (ui_out_flags mask);
 
     ATTRIBUTE_PRINTF (2,0) = 0;
   virtual void do_wrap_hint (const char *identstring) = 0;
   virtual void do_flush () = 0;
-  virtual int do_redirect (struct ui_file * outstream) = 0;
+  virtual void do_redirect (struct ui_file *outstream) = 0;
 
   /* Set as not MI-like by default.  It is overridden in subclasses if
      necessary.  */
 
 {
   struct ui_out *uiout = (struct ui_out *) arg;
 
-  if (uiout->redirect (NULL) < 0)
-    warning (_("Cannot restore redirection of the current output protocol"));
+  uiout->redirect (NULL);
 }
 
 /* Return a new cleanup that pops the last redirection by ui_out_redirect