Received: from eggs.gnu.org ([208.118.235.92]:50229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4Gp1-0003ho-Ii for qemu-devel@nongnu.org; Wed, 22 Aug 2012 15:42:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4Goz-0007kf-VH for qemu-devel@nongnu.org; Wed, 22 Aug 2012 15:42:35 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:42521) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4Goz-0007kT-PS for qemu-devel@nongnu.org; Wed, 22 Aug 2012 15:42:33 -0400 From: Stefan Weil Date: Wed, 22 Aug 2012 21:42:32 +0200 Message-Id: <1345664552-2250-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] w32: Always use standard instead of native format strings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Blue Swirl , Stefan Weil GLib 2.0 include files use __printf__ for the format attribute which resolves to native format strings on w32 hosts. QEMU wants standard format strings instead of native format strings, so we simply change any declaration with __printf__ to use __gnu_printf__. This works because all basic printf functions support both kinds of format strings. This fixes a compiler warning: qapi/string-output-visitor.c: In function =E2=80=98print_type_int=E2=80=99= : qapi/string-output-visitor.c:34:5: warning: unknown conversion type chara= cter =E2=80=98l=E2=80=99 in format [-Wformat] qapi/string-output-visitor.c:34:5: warning: too many arguments for format= [-Wformat-extra-args] Signed-off-by: Stefan Weil --- compiler.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler.h b/compiler.h index 07ba1f8..c734a71 100644 --- a/compiler.h +++ b/compiler.h @@ -44,6 +44,11 @@ /* Use gnu_printf when supported (qemu uses standard format strings).= */ # define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2))) # define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m))) +# if defined(_WIN32) + /* Map __printf__ to __gnu_printf__ because we want standard format = strings + * even when MinGW or GLib include files use __printf__. */ +# define __printf__ __gnu_printf__ +# endif # endif #if defined(_WIN32) #define GCC_WEAK __attribute__((weak)) --=20 1.7.10