From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 5B85A385801E; Tue, 29 Mar 2022 19:42:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B85A385801E 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] Only have one API for unfiltered output X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 830df12588cfa80be673e710bee22761752ead11 X-Git-Newrev: dcf1a2c8d2f5776796927d147f40214d23c818de Message-Id: <20220329194215.5B85A385801E@sourceware.org> Date: Tue, 29 Mar 2022 19:42:15 +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:42:15 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Ddcf1a2c8d2f5= 776796927d147f40214d23c818de commit dcf1a2c8d2f5776796927d147f40214d23c818de Author: Tom Tromey Date: Sat Jan 1 12:18:47 2022 -0700 Only have one API for unfiltered output =20 At the end of this series, the use of unfiltered output will be very restricted -- only places that definitely need it will use it. To this end, I thought it would be good to reduce the number of _unfiltered APIs that are exposed. This patch changes gdb so that only printf_unfiltered exists. (After this patch, the f* variants still exist as well, but those will be removed later.) Diff: --- gdb/event-top.c | 6 +----- gdb/top.c | 8 ++------ gdb/utils.c | 12 ------------ gdb/utils.h | 4 ---- 4 files changed, 3 insertions(+), 27 deletions(-) diff --git a/gdb/event-top.c b/gdb/event-top.c index 3ba7239518e..7de3c91a3a3 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -673,11 +673,7 @@ handle_line_of_input (struct buffer *cmd_line_buffer, cmd_line_buffer->used_size =3D 0; =20 if (from_tty && annotation_level > 1) - { - printf_unfiltered (("\n\032\032post-")); - puts_unfiltered (annotation_suffix); - printf_unfiltered (("\n")); - } + printf_unfiltered (("\n\032\032post-%s\n"), annotation_suffix); =20 #define SERVER_COMMAND_PREFIX "server " server_command =3D startswith (cmd, SERVER_COMMAND_PREFIX); diff --git a/gdb/top.c b/gdb/top.c index 7831b4f96ca..afd3c94283d 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -866,7 +866,7 @@ gdb_readline_no_editing (const char *prompt) /* Don't use a _filtered function here. It causes the assumed character position to be off, since the newline we read from the user is not accounted for. */ - puts_unfiltered (prompt); + printf_unfiltered ("%s", prompt); gdb_flush (gdb_stdout); } =20 @@ -1365,11 +1365,7 @@ command_line_input (const char *prompt_arg, const ch= ar *annotation_suffix) ++source_line_number; =20 if (from_tty && annotation_level > 1) - { - puts_unfiltered ("\n\032\032pre-"); - puts_unfiltered (annotation_suffix); - puts_unfiltered ("\n"); - } + printf_unfiltered ("\n\032\032pre-%s\n", annotation_suffix); =20 /* Don't use fancy stuff if not talking to stdin. */ if (deprecated_readline_hook diff --git a/gdb/utils.c b/gdb/utils.c index 48aedb034b9..a0717213f0f 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1868,12 +1868,6 @@ fputs_highlighted (const char *str, const compiled_r= egex &highlight, fputs_filtered (str, stream); } =20 -int -putchar_unfiltered (int c) -{ - return fputc_unfiltered (c, gdb_stdout); -} - /* Write character C to gdb_stdout using GDB's paging mechanism and return= C. May return nonlocally. */ =20 @@ -2046,12 +2040,6 @@ puts_filtered (const char *string) fputs_filtered (string, gdb_stdout); } =20 -void -puts_unfiltered (const char *string) -{ - fputs_unfiltered (string, gdb_stdout); -} - /* Return a pointer to N spaces and a null. The pointer is good until the next call to here. */ const char * diff --git a/gdb/utils.h b/gdb/utils.h index 2cd0cff0766..cd73af4651a 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -243,12 +243,8 @@ extern int fputc_unfiltered (int c, struct ui_file *); =20 extern int putchar_filtered (int c); =20 -extern int putchar_unfiltered (int c); - extern void puts_filtered (const char *); =20 -extern void puts_unfiltered (const char *); - extern void puts_filtered_tabular (char *string, int width, int right); =20 extern void vprintf_filtered (const char *, va_list) ATTRIBUTE_PRINTF (1, = 0);