All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu: printf related build fixes
@ 2010-03-02 13:25 Michael S. Tsirkin
  2010-03-02 15:29 ` [Qemu-devel] " Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2010-03-02 13:25 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

Some versions of glibc (e.g. globc 2.5 that ships with rhel5.4)
make printf a macro. This makes using preprocessor within calls
to printf illegal. Move preprocessor use outside printf calls.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 qemu-img.c |    5 +++--
 readline.c |    1 +
 vl.c       |   16 +++++++++++-----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index cbba4fc..435a9c1 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -58,7 +58,8 @@ 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"
+    const char h[] = 
+          ("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"
@@ -93,7 +94,7 @@ static void help(void)
            "  '-d' deletes a snapshot\n"
            "  '-l' lists all snapshots in the given image\n"
            );
-    printf("\nSupported formats:");
+    printf("%s\nSupported formats:", h);
     bdrv_iterate_format(format_print, NULL);
     printf("\n");
     exit(1);
diff --git a/readline.c b/readline.c
index 7834af0..92f9cd1 100644
--- a/readline.c
+++ b/readline.c
@@ -28,6 +28,7 @@
 #define IS_ESC  1
 #define IS_CSI  2
 
+#undef printf
 #define printf do_not_use_printf
 
 void readline_show_prompt(ReadLineState *rs)
diff --git a/vl.c b/vl.c
index 4ef6a78..7804001 100644
--- a/vl.c
+++ b/vl.c
@@ -4080,7 +4080,8 @@ static void version(void)
 static void help(int exitcode)
 {
     version();
-    printf("usage: %s [options] [disk_image]\n"
+    const char h[] =
+          ("usage: %s [options] [disk_image]\n"
            "\n"
            "'disk_image' is a raw hard image image for IDE hard disk 0\n"
            "\n"
@@ -4098,15 +4099,20 @@ static void help(int exitcode)
            "ctrl-alt        toggle mouse and keyboard grab\n"
            "\n"
            "When using -nographic, press 'ctrl-a h' to get some help.\n"
-           ,
-           "qemu",
-           DEFAULT_RAM_SIZE,
+           );
 #ifndef _WIN32
+    printf(h, "qemu",
+           DEFAULT_RAM_SIZE,
            DEFAULT_NETWORK_SCRIPT,
            DEFAULT_NETWORK_DOWN_SCRIPT,
-#endif
            DEFAULT_GDBSTUB_PORT,
            "/tmp/qemu.log");
+#else
+    printf(h, "qemu",
+           DEFAULT_RAM_SIZE,
+           DEFAULT_GDBSTUB_PORT,
+           "/tmp/qemu.log");
+#endif
     exit(exitcode);
 }
 
-- 
1.7.0.18.g0d53a5

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

* [Qemu-devel] Re: [PATCH] qemu: printf related build fixes
  2010-03-02 13:25 [Qemu-devel] [PATCH] qemu: printf related build fixes Michael S. Tsirkin
@ 2010-03-02 15:29 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2010-03-02 15:29 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

On Tue, Mar 02, 2010 at 03:25:40PM +0200, Michael S. Tsirkin wrote:
> Some versions of glibc (e.g. globc 2.5 that ships with rhel5.4)
> make printf a macro. This makes using preprocessor within calls
> to printf illegal. Move preprocessor use outside printf calls.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Looks like this was solved differently meanwhile.
Pls disregard.

-- 
MST

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

end of thread, other threads:[~2010-03-02 15:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-02 13:25 [Qemu-devel] [PATCH] qemu: printf related build fixes Michael S. Tsirkin
2010-03-02 15:29 ` [Qemu-devel] " Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.