Skip to contentSkip to conversation

target-i386: Fix compiler warning

PATCH Applied Stefan Weil 2 participants 2 messages Apr 1, 2010 – Apr 8, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-i386: Fix compiler warning

With argument checking for cpu_fprintf, gcc throws this warning:

CC i386-softmmu/helper.o
cc1: warnings being treated as errors
/qemu/ar7/target-i386/helper.c: In function ‘cpu_x86_dump_seg_cache’:
/qemu/ar7/target-i386/helper.c:220: error: format not a string literal and no format arguments

The code is correct, but current gcc versions don't detect this. Therefore the patch rewrites the statement to satisfy the compiler.

---
 target-i386/helper.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
target-i386/helper.c +4 -3
index 136ca8d..67c1224 100644
@@ -214,9 +214,10 @@ cpu_x86_dump_seg_cache(CPUState *env, FILE *f,
                 "Reserved", "IntGate64", "TrapGate64"
             }
         };
-        cpu_fprintf(f, sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
-                                    [(sc->flags & DESC_TYPE_MASK)
-                                     >> DESC_TYPE_SHIFT]);
+        cpu_fprintf(f, "%s",
+                    sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
+                                 [(sc->flags & DESC_TYPE_MASK)
+                                  >> DESC_TYPE_SHIFT]);
     }
 done:
     cpu_fprintf(f, "\n");
Signature · 1 line
1.7.0
#1 lore raw
Quoted 9 lines · Stefan Weil

With argument checking for cpu_fprintf, gcc throws this warning:

CC i386-softmmu/helper.o
cc1: warnings being treated as errors
/qemu/ar7/target-i386/helper.c: In function ‘cpu_x86_dump_seg_cache’:
/qemu/ar7/target-i386/helper.c:220: error: format not a string literal and no format arguments

The code is correct, but current gcc versions don't detect this. Therefore the patch rewrites the statement to satisfy the compiler.

Thanks, applied.

Quoted 29 lines
---
 target-i386/helper.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
target-i386/helper.c +4 -3
index 136ca8d..67c1224 100644
@@ -214,9 +214,10 @@ cpu_x86_dump_seg_cache(CPUState *env, FILE *f,
                 "Reserved", "IntGate64", "TrapGate64"
             }
         };
-        cpu_fprintf(f, sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
-                                    [(sc->flags & DESC_TYPE_MASK)
-                                     >> DESC_TYPE_SHIFT]);
+        cpu_fprintf(f, "%s",
+                    sys_type_name[(env->hflags & HF_LMA_MASK) ? 1 : 0]
+                                 [(sc->flags & DESC_TYPE_MASK)
+                                  >> DESC_TYPE_SHIFT]);
     }
 done:
     cpu_fprintf(f, "\n");
Signature · 1 line
1.7.0
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net