Patchwork sparc: 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-5-git-send-email-weil@mail.berlios.de>
Download mbox | patch
Permalink /patch/49870/
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>
---
 sparc-dis.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Aurelien Jarno - April 13, 2010, 10:17 p.m.
On Fri, Apr 09, 2010 at 10:49:53PM +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.

> ---
>  sparc-dis.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/sparc-dis.c b/sparc-dis.c
> index 83a12ae..611e74f 100644
> --- a/sparc-dis.c
> +++ b/sparc-dis.c
> @@ -2778,7 +2778,7 @@ print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
>                /* Can't do simple format if source and dest are different.  */
>                continue;
>  
> -          (*info->fprintf_func) (stream, opcode->name);
> +          (*info->fprintf_func) (stream, "%s", opcode->name);
>  
>            {
>              const char *s;
> -- 
> 1.5.6.5
> 
> 
> 
>

Patch

diff --git a/sparc-dis.c b/sparc-dis.c
index 83a12ae..611e74f 100644
--- a/sparc-dis.c
+++ b/sparc-dis.c
@@ -2778,7 +2778,7 @@  print_insn_sparc (bfd_vma memaddr, disassemble_info *info)
               /* Can't do simple format if source and dest are different.  */
               continue;
 
-          (*info->fprintf_func) (stream, opcode->name);
+          (*info->fprintf_func) (stream, "%s", opcode->name);
 
           {
             const char *s;