qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 1/2] Add support for gcc format attribute gnu_printf


From: Stefan Weil
Subject: [Qemu-devel] [PATCH 1/2] Add support for gcc format attribute gnu_printf
Date: Mon, 13 Sep 2010 22:02:36 +0200

Since version 4.4.x, gcc supports additional format attributes.
    __attribute__ ((format (gnu_printf, 1, 2)))
should be used instead of
    __attribute__ ((format (printf, 1, 2))
because QEMU always uses standard format strings (even with mingw32).

For older compilers, we simply define gnu_printf = printf,
so they work with the new format attribute, too.

Signed-off-by: Stefan Weil <address@hidden>
---
 configure |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 4061cb7..1300879 100755
--- a/configure
+++ b/configure
@@ -148,6 +148,17 @@ for flag in $gcc_flags; do
     fi
 done
 
+# Check gnu_printf (supported by gcc >= 4.4.x).
+cat > $TMPC << EOF
+static void test(const char *format, ...)
+    __attribute__ ((format (gnu_printf, 1, 2)));
+static void test(const char *format, ...) {}
+int main(void) { test("\n"); return 0; }
+EOF
+if ! compile_prog "-Werror" ""; then
+    QEMU_CFLAGS="-Dgnu_printf=printf $QEMU_CFLAGS"
+fi
+
 # check that the C compiler works.
 cat > $TMPC <<EOF
 int main(void) {}
-- 
1.7.1




reply via email to

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