From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gproxy3-pub.mail.unifiedlayer.com (gproxy3-pub.mail.unifiedlayer.com [69.89.30.42]) by sourceware.org (Postfix) with ESMTPS id A06DD385841A for ; Sat, 22 Jan 2022 01:38:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A06DD385841A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw15.mail.unifiedlayer.com (unknown [10.0.90.130]) by progateway5.mail.pro1.eigbox.com (Postfix) with ESMTP id 1469F10047D84 for ; Sat, 22 Jan 2022 01:38:13 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id B5M4nMKiVikTnB5M4nyZrJ; Sat, 22 Jan 2022 01:38:13 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=CeHNWJnl c=1 sm=1 tr=0 ts=61eb6005 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=DghFqjY3_ZEA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=ozymWj-pnKYYQCnA9F0A:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=sVts19IW9I4zOD7Y3fP17S7x7IUSJYI9MwHmg15CXVo=; b=MbIca6TU+yBEWOFSWmVN5T2Xwv 0enENl6P6eLQl/p+2+DpnVuMJHEC15BT447+z62upabSpnFLshxDvdvXBGH5HiBCo1jMbnhSyHr65 OoNlJPnEVVchYllRKTHIwK3gp; Received: from 75-166-128-165.hlrn.qwest.net ([75.166.128.165]:40604 helo=prentzel.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nB5M4-001DkZ-7w; Fri, 21 Jan 2022 18:38:12 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 19/19] Remove unnecessary calls to wrap_here and gdb_flush Date: Fri, 21 Jan 2022 18:38:01 -0700 Message-Id: <20220122013801.666659-20-tom@tromey.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220122013801.666659-1-tom@tromey.com> References: <20220122013801.666659-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.128.165 X-Source-L: No X-Exim-ID: 1nB5M4-001DkZ-7w X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-128-165.hlrn.qwest.net (prentzel.Home) [75.166.128.165]:40604 X-Source-Auth: tom+tromey.com X-Email-Count: 20 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3031.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Jan 2022 01:38:16 -0000 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. Now that the pager is just an ordinary stream, this isn't needed, and a simple call to gdb_flush is enough. 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. --- 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 12b078244b9..2deef7fc053 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -841,7 +841,6 @@ echo_command (const char *text, int from_tty) gdb_stdout->reset_style (); /* Force this output to appear now. */ - gdb_stdout->wrap_here (0); gdb_flush (gdb_stdout); } 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) } /* 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): */ - /* 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); - /* 3. The system-level buffer. */ + /* 2. The system-level buffer. */ gdb_stdout_serial = serial_fdopen (fileno (ui->outstream)); if (gdb_stdout_serial) { diff --git a/gdb/main.c b/gdb/main.c index 84d11b7bbc9..418d3a5bc02 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -1121,7 +1121,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); } @@ -1135,7 +1134,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); } @@ -1151,7 +1149,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. */ @@ -1172,7 +1169,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 2263a4c90ea..02a91ff80e2 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1498,7 +1498,6 @@ output_command (const char *exp, int from_tty) annotate_value_end (); - gdb_stdout->wrap_here (0); gdb_flush (gdb_stdout); } diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 39307d92296..5293f6f750f 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 b8c1618f65d..031f919302a 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1365,7 +1365,6 @@ command_line_input (const char *prompt_arg, const char *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); diff --git a/gdb/utils.c b/gdb/utils.c index 0b23e54f185..3d190e08260 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 = 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); } -- 2.31.1