From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 03/19] Only have one API for unfiltered output
Date: Fri, 21 Jan 2022 18:37:45 -0700 [thread overview]
Message-ID: <20220122013801.666659-4-tom@tromey.com> (raw)
In-Reply-To: <20220122013801.666659-1-tom@tromey.com>
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.)
---
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 0e22f24f1df..039066a9d03 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 = 0;
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);
#define SERVER_COMMAND_PREFIX "server "
server_command = startswith (cmd, SERVER_COMMAND_PREFIX);
diff --git a/gdb/top.c b/gdb/top.c
index a94ed5cebdb..5d90ebbdf19 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -873,7 +873,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);
}
@@ -1372,11 +1372,7 @@ command_line_input (const char *prompt_arg, const char *annotation_suffix)
++source_line_number;
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);
/* 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 f64ff68fa0d..48d68c6739d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -1867,12 +1867,6 @@ fputs_highlighted (const char *str, const compiled_regex &highlight,
fputs_filtered (str, stream);
}
-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. */
@@ -2045,12 +2039,6 @@ puts_filtered (const char *string)
fputs_filtered (string, gdb_stdout);
}
-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 83211a008f1..e506650cbdd 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -240,12 +240,8 @@ extern int fputc_unfiltered (int c, struct ui_file *);
extern int putchar_filtered (int c);
-extern int putchar_unfiltered (int c);
-
extern void puts_filtered (const char *);
-extern void puts_unfiltered (const char *);
-
extern void puts_filtered_tabular (char *string, int width, int right);
extern void vprintf_filtered (const char *, va_list) ATTRIBUTE_PRINTF (1, 0);
--
2.31.1
next prev parent reply other threads:[~2022-01-22 1:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-22 1:37 [PATCH 00/19] Simplify GDB output functions Tom Tromey
2022-01-22 1:37 ` [PATCH 01/19] Use unfiltered output in annotate.c Tom Tromey
2022-01-22 1:37 ` [PATCH 02/19] Remove some uses of printf_unfiltered Tom Tromey
2022-01-22 1:37 ` Tom Tromey [this message]
2022-01-22 1:37 ` [PATCH 04/19] Add puts_unfiltered method to ui_file Tom Tromey
2022-01-22 1:37 ` [PATCH 05/19] Add style-escape methods " Tom Tromey
2022-01-22 1:37 ` [PATCH 06/19] Remove vfprintf_styled_no_gdbfmt Tom Tromey
2022-01-22 1:37 ` [PATCH 07/19] Change the pager to a ui_file Tom Tromey
2022-01-22 1:37 ` [PATCH 08/19] Remove fputs_styled_unfiltered Tom Tromey
2022-01-22 1:37 ` [PATCH 09/19] Unify vprintf functions Tom Tromey
2022-01-22 1:37 ` [PATCH 10/19] Unify gdb puts functions Tom Tromey
2022-01-22 1:37 ` [PATCH 11/19] Unify gdb putc functions Tom Tromey
2022-01-22 1:37 ` [PATCH 13/19] Rename print_spaces_filtered Tom Tromey
2022-01-22 1:37 ` [PATCH 14/19] Rename puts_filtered_tabular Tom Tromey
2022-01-22 1:37 ` [PATCH 15/19] Rename fprintf_symbol_filtered Tom Tromey
2022-01-22 1:37 ` [PATCH 16/19] Remove ui_out_flag::unfiltered_output Tom Tromey
2022-01-22 1:37 ` [PATCH 17/19] Remove vfprintf_styled Tom Tromey
2022-01-22 1:38 ` [PATCH 18/19] Minor comment updates in utils.h Tom Tromey
2022-03-24 18:05 ` Pedro Alves
2022-03-28 20:29 ` Tom Tromey
2022-01-22 1:38 ` [PATCH 19/19] Remove unnecessary calls to wrap_here and gdb_flush Tom Tromey
2022-01-22 17:40 ` [PATCH 00/19] Simplify GDB output functions John Baldwin
2022-03-24 16:25 ` Tom Tromey
2022-03-24 18:08 ` Pedro Alves
2022-03-29 19:38 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220122013801.666659-4-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).