Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH] sim: ppc: fix printf warnings
Date: Tue, 29 Jun 2021 22:33:51 -0400	[thread overview]
Message-ID: <20210630023351.25490-1-vapier@gentoo.org> (raw)
In-Reply-To: <SN6PR11MB2893D2C8C16B19C106725301C4029@SN6PR11MB2893.namprd11.prod.outlook.com>

This code hits some format-zero-length warnings, so hack the code
like we did in the common layers.
---
 sim/ppc/ChangeLog   |  6 ++++++
 sim/ppc/main.c      |  2 ++
 sim/ppc/sim_calls.c | 10 ++++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index b41d20230d95..7a23d68842bd 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,9 @@
+2021-06-29  Mike Frysinger  <vapier@gentoo.org>
+
+	* main.c (sim_io_error): Add comment
+	* sim_calls.c (sim_io_error): Likewise.  Change "" to " ".
+	(error): Likewise.
+
 2021-06-20  Mike Frysinger  <vapier@gentoo.org>
 
 	* Makefile.in (INLINE_CFLAGS): Change to $(SIM_INLINE).
diff --git a/sim/ppc/main.c b/sim/ppc/main.c
index 0c1a070fc2c2..2d4d7e402753 100644
--- a/sim/ppc/main.c
+++ b/sim/ppc/main.c
@@ -214,6 +214,8 @@ sim_io_flush_stdoutput(void)
   }
 }
 
+/* Glue to use sim-fpu module.  */
+
 void
 sim_io_error (SIM_DESC sd, const char *msg, ...)
 {
diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c
index 14d4d6586c78..ee9d123b1872 100644
--- a/sim/ppc/sim_calls.c
+++ b/sim/ppc/sim_calls.c
@@ -372,6 +372,8 @@ sim_io_flush_stdoutput(void)
   }
 }
 
+/* Glue to use sim-fpu module.  */
+
 void
 sim_io_error (SIM_DESC sd, const char *fmt, ...)
 {
@@ -379,7 +381,9 @@ sim_io_error (SIM_DESC sd, const char *fmt, ...)
   va_start(ap, fmt);
   callbacks->evprintf_filtered (callbacks, fmt, ap);
   va_end(ap);
-  callbacks->error (callbacks, "");
+  /* Printing a space here avoids empty printf compiler warnings.  Not ideal,
+     but we want error's side-effect where it halts processing.  */
+  callbacks->error (callbacks, " ");
 }
 
 /****/
@@ -391,7 +395,9 @@ error (const char *msg, ...)
   va_start(ap, msg);
   callbacks->evprintf_filtered (callbacks, msg, ap);
   va_end(ap);
-  callbacks->error (callbacks, "");
+  /* Printing a space here avoids empty printf compiler warnings.  Not ideal,
+     but we want error's side-effect where it halts processing.  */
+  callbacks->error (callbacks, " ");
 }
 
 void *
-- 
2.31.1


  parent reply	other threads:[~2021-06-30  2:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-28  3:24 [PATCH 1/3] sim: callback: drop unused printf helpers Mike Frysinger via Gdb-patches
2021-06-28  3:24 ` [PATCH 2/3] sim: callback: add printf attributes Mike Frysinger via Gdb-patches
2021-06-29  7:01   ` Aktemur, Tankut Baris via Gdb-patches
2021-06-29 14:32     ` Mike Frysinger via Gdb-patches
2021-06-29 16:03       ` Aktemur, Tankut Baris via Gdb-patches
2021-06-29 20:35         ` Mike Frysinger via Gdb-patches
2021-07-02  0:34         ` Mike Frysinger via Gdb-patches
2021-07-02  7:16           ` Aktemur, Tankut Baris via Gdb-patches
2021-06-30  2:33     ` Mike Frysinger via Gdb-patches [this message]
2021-06-28  3:24 ` [PATCH 3/3] sim: io: add printf attributes to vprintf funcs too Mike Frysinger via Gdb-patches

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=20210630023351.25490-1-vapier@gentoo.org \
    --to=gdb-patches@sourceware.org \
    --cc=vapier@gentoo.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