qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Avoid issue with pp-directive in macro


From: Bruce Rogers
Subject: [Qemu-devel] [PATCH] Avoid issue with pp-directive in macro
Date: Fri, 07 Aug 2009 16:15:22 -0600

When building for SLES10, I ran into a build failure which results from printf 
being a macro, and two files which have an #include preprocessing directive 
within the macro arguments.  There are other pp-directives,but the #include was 
the only one causing problems.  (This was with gcc 4.x btw.)

It is undefined behavior to include pp-directives within macro arguments, and 
pretty much any of the std-c defined functions can be implemented as macros, so 
this patch avoids the issue by ensuring we are not using the macro version in 
the problematic cases.

Signed-off-by: Bruce Rogers <address@hidden>

 qemu-img.c |    2 +-
 vl.c       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index 070fe2e..581a908 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -58,7 +58,7 @@ static void format_print(void *opaque, const char *name)
 /* Please keep in synch with qemu-img.texi */
 static void help(void)
 {
-    printf("qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 Fabrice 
Bellard\n"
+    (printf)("qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 
Fabrice Bellard\n"
            "usage: qemu-img command [command options]\n"
            "QEMU disk image utility\n"
            "\n"
diff --git a/vl.c b/vl.c
index fdd4f03..0bea27f 100644
--- a/vl.c
+++ b/vl.c
@@ -4337,7 +4337,7 @@ static void version(void)
 static void help(int exitcode)
 {
     version();
-    printf("usage: %s [options] [disk_image]\n"
+    (printf)("usage: %s [options] [disk_image]\n"
            "\n"
            "'disk_image' is a raw hard image image for IDE hard disk 0\n"
            "\n"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]