From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 8FC10386EC0E; Tue, 29 Mar 2022 19:43:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8FC10386EC0E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Remove unnecessary calls to wrap_here and gdb_flush X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 6b0c1154230afc0bf878993f11154dd0b3adda1a X-Git-Newrev: ebfc93611b641bae0ca3ecca2ba20c7d677968b9 Message-Id: <20220329194336.8FC10386EC0E@sourceware.org> Date: Tue, 29 Mar 2022 19:43:36 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Mar 2022 19:43:36 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Debfc93611b64= 1bae0ca3ecca2ba20c7d677968b9 commit ebfc93611b641bae0ca3ecca2ba20c7d677968b9 Author: Tom Tromey Date: Mon Jan 3 17:12:22 2022 -0700 Remove unnecessary calls to wrap_here and gdb_flush =20 Various spots in gdb currently know about the wrap buffer, and so are careful to call wrap_here to be certain that all output has been flushed. =20 Now that the pager is just an ordinary stream, this isn't needed, and a simple call to gdb_flush is enough. =20 Similarly, there are places where gdb prints to gdb_stderr, but first flushes gdb_stdout. stderr_file already flushes gdb_stdout, so these aren't needed. Diff: --- gdb/cli/cli-cmds.c | 1 - gdb/exceptions.c | 10 +++------- gdb/main.c | 4 ---- gdb/printcmd.c | 1 - gdb/psymtab.c | 1 - gdb/top.c | 1 - gdb/utils.c | 6 ------ 7 files changed, 3 insertions(+), 21 deletions(-) diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 6a03f25c206..e12ccee2e48 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -846,7 +846,6 @@ echo_command (const char *text, int from_tty) gdb_stdout->reset_style (); =20 /* Force this output to appear now. */ - gdb_stdout->wrap_here (0); gdb_flush (gdb_stdout); } =20 diff --git a/gdb/exceptions.c b/gdb/exceptions.c index 64a36273a61..fdb65b3dc4b 100644 --- a/gdb/exceptions.c +++ b/gdb/exceptions.c @@ -46,19 +46,15 @@ print_flush (void) } =20 /* We want all output to appear now, before we print the error. We - have 3 levels of buffering we have to flush (it's possible that + have 2 levels of buffering we have to flush (it's possible that some of these should be changed to flush the lower-level ones too): */ =20 - /* 1. The _filtered buffer. */ - if (filtered_printing_initialized ()) - gdb_stdout->wrap_here (0); - - /* 2. The stdio buffer. */ + /* 1. The stdio buffer. */ gdb_flush (gdb_stdout); gdb_flush (gdb_stderr); =20 - /* 3. The system-level buffer. */ + /* 2. The system-level buffer. */ gdb_stdout_serial =3D serial_fdopen (fileno (ui->outstream)); if (gdb_stdout_serial) { diff --git a/gdb/main.c b/gdb/main.c index 0723ea4ae65..acb7a45fb7c 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -1124,7 +1124,6 @@ captured_main_1 (struct captured_main_args *context) if (print_version) { print_gdb_version (gdb_stdout, false); - gdb_stdout->wrap_here (0); gdb_printf ("\n"); exit (0); } @@ -1138,7 +1137,6 @@ captured_main_1 (struct captured_main_args *context) if (print_configuration) { print_gdb_configuration (gdb_stdout); - gdb_stdout->wrap_here (0); gdb_printf ("\n"); exit (0); } @@ -1154,7 +1152,6 @@ captured_main_1 (struct captured_main_args *context) print_gdb_version (gdb_stdout, true); if (symarg) gdb_printf (".."); - gdb_stdout->wrap_here (0); gdb_printf ("\n"); gdb_flush (gdb_stdout); /* Force to screen during slow operations. */ @@ -1175,7 +1172,6 @@ captured_main_1 (struct captured_main_args *context) print_gdb_version (gdb_stdout, true); if (symarg) gdb_printf (".."); - gdb_stdout->wrap_here (0); gdb_printf ("\n"); gdb_flush (gdb_stdout); /* Force to screen during slow operations. */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 396d1feda5b..3930d089836 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1493,7 +1493,6 @@ output_command (const char *exp, int from_tty) =20 annotate_value_end (); =20 - gdb_stdout->wrap_here (0); gdb_flush (gdb_stdout); } =20 diff --git a/gdb/psymtab.c b/gdb/psymtab.c index a3aa4aeaec4..b31ce877b62 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1426,7 +1426,6 @@ partial_symtab::expand_dependencies (struct objfile *= objfile) gdb_puts ("and "); gdb_stdout->wrap_here (0); gdb_printf ("%s...", dependencies[i]->filename); - gdb_stdout->wrap_here (0); /* Flush output */ gdb_flush (gdb_stdout); } dependencies[i]->expand_psymtab (objfile); diff --git a/gdb/top.c b/gdb/top.c index 05b2b43402e..a28e72f77f3 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1358,7 +1358,6 @@ command_line_input (const char *prompt_arg, const cha= r *annotation_suffix) /* Make sure that all output has been output. Some machines may let you get away with leaving out some of the gdb_flush, but not all. */ - gdb_stdout->wrap_here (0); gdb_flush (gdb_stdout); gdb_flush (gdb_stderr); =20 diff --git a/gdb/utils.c b/gdb/utils.c index 8d3a89cf036..2df9b1d7dcf 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -146,9 +146,6 @@ vwarning (const char *string, va_list args) term_state.emplace (); target_terminal::ours_for_output (); } - if (filtered_printing_initialized ()) - gdb_stdout->wrap_here (0); /* Force out any buffered output. */ - gdb_flush (gdb_stdout); if (warning_pre_print) gdb_puts (warning_pre_print, gdb_stderr); gdb_vprintf (gdb_stderr, string, args); @@ -650,9 +647,6 @@ void print_sys_errmsg (const char *string, int errcode) { const char *err =3D safe_strerror (errcode); - /* We want anything which was printed on stdout to come out first, before - this message. */ - gdb_flush (gdb_stdout); gdb_printf (gdb_stderr, "%s: %s.\n", string, err); }