From 7becfd03bad526c02216eeb5ec2bebae694b1af1 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 10 Jan 2017 11:30:47 -0500 Subject: Change return type of ui_out redirect to void All implementations of redirect/do_redirect in the ui_out subsystem always return 0 (success). We can therefore clean it up and make them return void. gdb/ChangeLog: * 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. --- gdb/cli/cli-logging.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'gdb/cli/cli-logging.c') diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c index 8840736..9428624 100644 --- a/gdb/cli/cli-logging.c +++ b/gdb/cli/cli-logging.c @@ -130,13 +130,11 @@ set_logging_redirect (char *args, int from_tty, struct cmd_list_element *c) /* 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); } @@ -246,10 +244,7 @@ handle_redirections (int from_tty) /* 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 -- cgit v1.1