From patchwork Sun Sep 23 10:00:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 186204 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 443FA2C0088 for ; Sun, 23 Sep 2012 20:56:16 +1000 (EST) Received: from localhost ([::1]:49542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFj0x-00078w-5V for incoming@patchwork.ozlabs.org; Sun, 23 Sep 2012 06:02:15 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizd-0004lI-Py for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TFizc-0007qO-It for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:53 -0400 Received: from mail-wg0-f41.google.com ([74.125.82.41]:45819) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizc-0007nk-Bg for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:52 -0400 Received: by wgbds1 with SMTP id ds1so1991321wgb.4 for ; Sun, 23 Sep 2012 03:00:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=pB4SKGJrpeFwbMXVsGRXndosFlqtf1l+PP+XST41SNk=; b=CeGExDl4u7+RduVp9unid6j3RFHjz2iDh+7UI5hr68Yf/3Ec6gXXHGJHY/VrZmlrrW bP+Od0kDyqDYIfJZWjHVmma0yEr4DFSTb0+xsdgLjWhnGzj5mG+i+uDF4xQNuwLMeZKN XSbKKgmH5h3aslKzSwqgnr0LeDerxPw+YheI0jkgkl1ooTgNX+YhZFovlLvwrlec4z8T pbcobfpRH2lPpbs7MI8vY7xxuiOWCCVNPHTRWwPF7PMg5zy2aOEcTO9ero+67b2/216P 2c3Pksj27TggHdApjDttTU1vO0CpeGficOqeCqEzFrpIB/XcVMZ7DA5JxiTWbRKR4ilQ P3EA== Received: by 10.180.8.40 with SMTP id o8mr7620553wia.9.1348394451447; Sun, 23 Sep 2012 03:00:51 -0700 (PDT) Received: from localhost ([109.224.133.37]) by mx.google.com with ESMTPS id l6sm8307748wiz.4.2012.09.23.03.00.50 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Sep 2012 03:00:51 -0700 (PDT) From: Stefan Hajnoczi To: Anthony Liguori Date: Sun, 23 Sep 2012 11:00:20 +0100 Message-Id: <1348394420-28298-15-git-send-email-stefanha@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1348394420-28298-1-git-send-email-stefanha@gmail.com> References: <1348394420-28298-1-git-send-email-stefanha@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.41 Cc: Stefan Weil , qemu-devel@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 14/14] w32: Always use standard instead of native format strings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: 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 ‘print_type_int’: qapi/string-output-visitor.c:34:5: warning: unknown conversion type character ‘l’ in format [-Wformat] qapi/string-output-visitor.c:34:5: warning: too many arguments for format [-Wformat-extra-args] Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- 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))