public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: fix printf format warning about non-string literal
@ 2010-03-29 22:54 Mike Frysinger
  2010-03-29 23:11 ` [PATCH v2] " Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2010-03-29 22:54 UTC (permalink / raw)
  To: gdb-patches

This is the normal "passing a buffer straight to printf makes GCC warn".
While we know this particular case is fine, the trend in this source tree
is to fix this anyways to avoid the warnings.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
2010-03-29  Mike Frysinger  <vapier@gentoo.org>

	* sim-utils.c (sim_io_eprintf_cpu): Use %s with printf string.

 sim/common/sim-utils.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index fb84eb3..9f9104e 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -170,7 +170,7 @@ sim_io_eprintf_cpu (sim_cpu *cpu, const char *fmt, ...)
   va_list ap;
 
   va_start (ap, fmt);
-  sim_io_eprintf (sd, sim_cpu_msg_prefix (cpu));
+  sim_io_eprintf (sd, "%s", sim_cpu_msg_prefix (cpu));
   sim_io_evprintf (sd, fmt, ap);
   va_end (ap);
 }
-- 
1.7.0.2

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

* [PATCH v2] sim: fix printf format warning about non-string literal
  2010-03-29 22:54 [PATCH] sim: fix printf format warning about non-string literal Mike Frysinger
@ 2010-03-29 23:11 ` Mike Frysinger
  2010-03-30 16:50   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2010-03-29 23:11 UTC (permalink / raw)
  To: gdb-patches

This is the normal "passing a buffer straight to printf makes GCC warn".
While we know this particular case is fine, the trend in this source tree
is to fix this anyways to avoid the warnings.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
	- also fix same issue in hw_option_handler()

2010-03-29  Mike Frysinger  <vapier@gentoo.org>

	* sim-utils.c (sim_io_eprintf_cpu): Use %s with printf string.
	* sim-hw.c (hw_option_handler): Likewise.

 sim/common/sim-hw.c    |    2 +-
 sim/common/sim-utils.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sim/common/sim-hw.c b/sim/common/sim-hw.c
index d9868d3..7481492 100644
--- a/sim/common/sim-hw.c
+++ b/sim/common/sim-hw.c
@@ -257,7 +257,7 @@ hw_option_handler (struct sim_state *sd, sim_cpu *cpu, int opt,
 
     case OPTION_HW_DEVICE:
       {
-	hw_tree_parse (STATE_HW (sd)->tree, arg);
+	hw_tree_parse (STATE_HW (sd)->tree, "%s", arg);
 	return SIM_RC_OK;
       }
 
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index fb84eb3..9f9104e 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -170,7 +170,7 @@ sim_io_eprintf_cpu (sim_cpu *cpu, const char *fmt, ...)
   va_list ap;
 
   va_start (ap, fmt);
-  sim_io_eprintf (sd, sim_cpu_msg_prefix (cpu));
+  sim_io_eprintf (sd, "%s", sim_cpu_msg_prefix (cpu));
   sim_io_evprintf (sd, fmt, ap);
   va_end (ap);
 }
-- 
1.7.0.2

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

* Re: [PATCH v2] sim: fix printf format warning about non-string literal
  2010-03-29 23:11 ` [PATCH v2] " Mike Frysinger
@ 2010-03-30 16:50   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2010-03-30 16:50 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

Mike> 2010-03-29  Mike Frysinger  <vapier@gentoo.org>
Mike> 	* sim-utils.c (sim_io_eprintf_cpu): Use %s with printf string.
Mike> 	* sim-hw.c (hw_option_handler): Likewise.

This is ok.

Tom

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

end of thread, other threads:[~2010-03-30 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-29 22:54 [PATCH] sim: fix printf format warning about non-string literal Mike Frysinger
2010-03-29 23:11 ` [PATCH v2] " Mike Frysinger
2010-03-30 16:50   ` Tom Tromey

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