From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nd0Xd-0001Sk-FW for qemu-devel@nongnu.org; Thu, 04 Feb 2010 07:10:37 -0500 Received: from [199.232.76.173] (port=46443 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nd0Xc-0001SS-TW for qemu-devel@nongnu.org; Thu, 04 Feb 2010 07:10:36 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nd0Xb-0002ng-It for qemu-devel@nongnu.org; Thu, 04 Feb 2010 07:10:36 -0500 Received: from mail2.shareable.org ([80.68.89.115]:47739) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nd0Xb-0002nK-39 for qemu-devel@nongnu.org; Thu, 04 Feb 2010 07:10:35 -0500 Date: Thu, 4 Feb 2010 12:10:27 +0000 From: Jamie Lokier Subject: Re: [Qemu-devel] "Enable _FORTIFY_SOURCE=2" result in building failure for qemu-img.c Message-ID: <20100204121027.GA10297@shareable.org> References: <201002041504.52626.sheng@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201002041504.52626.sheng@linux.intel.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sheng Yang Cc: "Kirill A. Shutemov" , Anthony Liguori , qemu-devel@nongnu.org, Juan Quintela Sheng Yang wrote: > 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" > "Command syntax:\n" > #define DEF(option, callback, arg_string) \ > " " arg_string "\n" > #include "qemu-img-cmds.h" > #undef DEF > #undef GEN_DOCS > .... > > Seems gcc take "printf" as a marco. I added a "#undef printf" before the line, > then it works... > > So any clue on what's happened and how to fix? You can't have preprocessor directives inside the arguments of a macro call. Yes it's occasionally annoying like this. You can prevent the macro call without #undef by writing: (printf)("qemu-img version " ...etc) I'm not sure if Glibc is compliant with ISO C by making printf into a macro that takes arguments. Certain functions such as putchar() are specified as being allowed to be macros, which implies the other standard functions aren't. -- Jamie