From patchwork Fri Aug 7 22:15:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Rogers X-Patchwork-Id: 30988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id B3483B7B63 for ; Sat, 8 Aug 2009 08:17:38 +1000 (EST) Received: from localhost ([127.0.0.1]:45523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZXkj-0007G6-CK for incoming@patchwork.ozlabs.org; Fri, 07 Aug 2009 18:17:33 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MZXin-0006nU-Va for qemu-devel@nongnu.org; Fri, 07 Aug 2009 18:15:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MZXij-0006lG-4t for qemu-devel@nongnu.org; Fri, 07 Aug 2009 18:15:33 -0400 Received: from [199.232.76.173] (port=32822 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MZXij-0006lB-0h for qemu-devel@nongnu.org; Fri, 07 Aug 2009 18:15:29 -0400 Received: from lucius.provo.novell.com ([137.65.248.127]:4996) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MZXii-0001ma-4x for qemu-devel@nongnu.org; Fri, 07 Aug 2009 18:15:28 -0400 Received: from INET-PRV1-MTA by lucius.provo.novell.com with Novell_GroupWise; Fri, 07 Aug 2009 16:15:25 -0600 Message-Id: <4A7C531A020000480007DF91@lucius.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 8.0.0 Date: Fri, 07 Aug 2009 16:15:22 -0600 From: "Bruce Rogers" To: Mime-Version: 1.0 Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: Novell Netware 6 SP3 Subject: [Qemu-devel] [PATCH] Avoid issue with pp-directive in macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 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"