Patchwork sh4: Fix compiler warning (fprintf format string)

login
register
mail settings
Submitter Stefan Weil
Date April 9, 2010, 8:49 p.m.
Message ID <1270846193-5667-4-git-send-email-weil@mail.berlios.de>
Download mbox | patch
Permalink /patch/49869/
State New
Headers show

Comments

Stefan Weil - April 9, 2010, 8:49 p.m.
When argument checking is enabled, gcc throws this error:

error: format not a string literal and no format arguments

The patch rewrites the statement to satisfy the compiler.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 sh4-dis.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Aurelien Jarno - April 13, 2010, 10:17 p.m.
On Fri, Apr 09, 2010 at 10:49:52PM +0200, Stefan Weil wrote:
> When argument checking is enabled, gcc throws this error:
> 
> error: format not a string literal and no format arguments
> 
> The patch rewrites the statement to satisfy the compiler.
> 
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Thanks, applied.

> ---
>  sh4-dis.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sh4-dis.c b/sh4-dis.c
> index 41fd866..078a6b2 100644
> --- a/sh4-dis.c
> +++ b/sh4-dis.c
> @@ -1493,10 +1493,10 @@ print_insn_ppi (int field_b, struct disassemble_info *info)
>  		  print_dsp_reg (field_b & 0xf, fprintf_fn, stream);
>  		  break;
>  		case DSP_REG_X:
> -		  fprintf_fn (stream, sx_tab[(field_b >> 6) & 3]);
> +		  fprintf_fn (stream, "%s", sx_tab[(field_b >> 6) & 3]);
>  		  break;
>  		case DSP_REG_Y:
> -		  fprintf_fn (stream, sy_tab[(field_b >> 4) & 3]);
> +		  fprintf_fn (stream, "%s", sy_tab[(field_b >> 4) & 3]);
>  		  break;
>  		case A_MACH:
>  		  fprintf_fn (stream, "mach");
> -- 
> 1.5.6.5
> 
> 
> 
>

Patch

diff --git a/sh4-dis.c b/sh4-dis.c
index 41fd866..078a6b2 100644
--- a/sh4-dis.c
+++ b/sh4-dis.c
@@ -1493,10 +1493,10 @@  print_insn_ppi (int field_b, struct disassemble_info *info)
 		  print_dsp_reg (field_b & 0xf, fprintf_fn, stream);
 		  break;
 		case DSP_REG_X:
-		  fprintf_fn (stream, sx_tab[(field_b >> 6) & 3]);
+		  fprintf_fn (stream, "%s", sx_tab[(field_b >> 6) & 3]);
 		  break;
 		case DSP_REG_Y:
-		  fprintf_fn (stream, sy_tab[(field_b >> 4) & 3]);
+		  fprintf_fn (stream, "%s", sy_tab[(field_b >> 4) & 3]);
 		  break;
 		case A_MACH:
 		  fprintf_fn (stream, "mach");