public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA 0/2] Two trivial cli-out patches
@ 2018-04-23 15:32 Tom Tromey
  2018-04-23 15:33 ` [RFA 2/2] Reindent cli-out.h Tom Tromey
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom Tromey @ 2018-04-23 15:32 UTC (permalink / raw)
  To: gdb-patches

While looking into ui-out a bit, I found a couple of oddities in
cli-out.  This short series fixes both.

Regression tested by the buildbot.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFA 1/2] Remove cli_ui_out::out_field_fmt
  2018-04-23 15:32 [RFA 0/2] Two trivial cli-out patches Tom Tromey
  2018-04-23 15:33 ` [RFA 2/2] Reindent cli-out.h Tom Tromey
@ 2018-04-23 15:33 ` Tom Tromey
  2018-04-24 11:25 ` [RFA 0/2] Two trivial cli-out patches Pedro Alves
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2018-04-23 15:33 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I noticed that cli_ui_out::out_field_fmt is only used by a single
caller, and it can easily be replaced by fputs_filtered.  So, this
patch removes it.

ChangeLog
2018-04-22  Tom Tromey  <tom@tromey.com>

	* cli-out.c (cli_ui_out::out_field_fmt): Remove.
	(cli_ui_out::do_field_string): Use fputs_filtered.
	* cli-out.h (class cli_ui_out) <out_field_fmt>: Remove.
---
 gdb/ChangeLog |  6 ++++++
 gdb/cli-out.c | 18 +-----------------
 gdb/cli-out.h |  2 --
 3 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/gdb/cli-out.c b/gdb/cli-out.c
index 1679ed4bd2..ad0a34ed39 100644
--- a/gdb/cli-out.c
+++ b/gdb/cli-out.c
@@ -156,7 +156,7 @@ cli_ui_out::do_field_string (int fldno, int width, ui_align align,
     spaces (before);
 
   if (string)
-    out_field_fmt (fldno, fldname, "%s", string);
+    fputs_filtered (string, m_streams.back ());
 
   if (after)
     spaces (after);
@@ -238,22 +238,6 @@ cli_ui_out::do_redirect (ui_file *outstream)
 
 /* local functions */
 
-/* Like cli_ui_out::do_field_fmt, but takes a variable number of args
-   and makes a va_list and does not insert a separator.  */
-
-/* VARARGS */
-void
-cli_ui_out::out_field_fmt (int fldno, const char *fldname,
-			   const char *format, ...)
-{
-  va_list args;
-
-  va_start (args, format);
-  vfprintf_filtered (m_streams.back (), format, args);
-
-  va_end (args);
-}
-
 void
 cli_ui_out::field_separator ()
 {
diff --git a/gdb/cli-out.h b/gdb/cli-out.h
index b95c9987de..adbd244456 100644
--- a/gdb/cli-out.h
+++ b/gdb/cli-out.h
@@ -68,8 +68,6 @@ protected:
 private:
 
   void field_separator ();
-  void out_field_fmt (int fldno, const char *fldname, const char *format, ...)
-    ATTRIBUTE_PRINTF (4, 5);
 
   std::vector<ui_file *> m_streams;
   bool m_suppress_output;
-- 
2.13.6

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFA 2/2] Reindent cli-out.h
  2018-04-23 15:32 [RFA 0/2] Two trivial cli-out patches Tom Tromey
@ 2018-04-23 15:33 ` Tom Tromey
  2018-04-23 15:33 ` [RFA 1/2] Remove cli_ui_out::out_field_fmt Tom Tromey
  2018-04-24 11:25 ` [RFA 0/2] Two trivial cli-out patches Pedro Alves
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2018-04-23 15:33 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I noticed that cli-out.h had incorrect indentation in some spots.
This fixes it.

ChangeLog
2018-04-22  Tom Tromey  <tom@tromey.com>

	* cli-out.h: Reindent.
---
 gdb/ChangeLog |  4 ++++
 gdb/cli-out.h | 16 +++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/gdb/cli-out.h b/gdb/cli-out.h
index adbd244456..f701da7bf3 100644
--- a/gdb/cli-out.h
+++ b/gdb/cli-out.h
@@ -35,24 +35,26 @@ public:
 protected:
 
   virtual void do_table_begin (int nbrofcols, int nr_rows,
-				  const char *tblid) override;
+			       const char *tblid) override;
   virtual void do_table_body () override;
   virtual void do_table_end () override;
   virtual void do_table_header (int width, ui_align align,
-			     const std::string &col_name,
-			     const std::string &col_hdr) override;
+				const std::string &col_name,
+				const std::string &col_hdr) override;
   /* Note: level 0 is the top-level so LEVEL is always greater than
      zero.  */
   virtual void do_begin (ui_out_type type, const char *id) override;
   virtual void do_end (ui_out_type type) override;
   virtual void do_field_int (int fldno, int width, ui_align align,
-			  const char *fldname, int value) override;
+			     const char *fldname, int value) override;
   virtual void do_field_skip (int fldno, int width, ui_align align,
-			   const char *fldname) override;
+			      const char *fldname) override;
   virtual void do_field_string (int fldno, int width, ui_align align,
-			     const char *fldname, const char *string) override;
+				const char *fldname,
+				const char *string) override;
   virtual void do_field_fmt (int fldno, int width, ui_align align,
-			  const char *fldname, const char *format, va_list args)
+			     const char *fldname, const char *format,
+			     va_list args)
     override ATTRIBUTE_PRINTF (6,0);
   virtual void do_spaces (int numspaces) override;
   virtual void do_text (const char *string) override;
-- 
2.13.6

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA 0/2] Two trivial cli-out patches
  2018-04-23 15:32 [RFA 0/2] Two trivial cli-out patches Tom Tromey
  2018-04-23 15:33 ` [RFA 2/2] Reindent cli-out.h Tom Tromey
  2018-04-23 15:33 ` [RFA 1/2] Remove cli_ui_out::out_field_fmt Tom Tromey
@ 2018-04-24 11:25 ` Pedro Alves
  2 siblings, 0 replies; 4+ messages in thread
From: Pedro Alves @ 2018-04-24 11:25 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 04/23/2018 04:32 PM, Tom Tromey wrote:
> While looking into ui-out a bit, I found a couple of oddities in
> cli-out.  This short series fixes both.
> 
OK for both.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-24 11:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-23 15:32 [RFA 0/2] Two trivial cli-out patches Tom Tromey
2018-04-23 15:33 ` [RFA 2/2] Reindent cli-out.h Tom Tromey
2018-04-23 15:33 ` [RFA 1/2] Remove cli_ui_out::out_field_fmt Tom Tromey
2018-04-24 11:25 ` [RFA 0/2] Two trivial cli-out patches Pedro Alves

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).