From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAuQV-0002g1-Qu for qemu-devel@nongnu.org; Thu, 11 Dec 2008 17:54:35 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAuQT-0002ds-AD for qemu-devel@nongnu.org; Thu, 11 Dec 2008 17:54:34 -0500 Received: from [199.232.76.173] (port=47202 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAuQT-0002de-2t for qemu-devel@nongnu.org; Thu, 11 Dec 2008 17:54:33 -0500 Received: from fmmailgate02.web.de ([217.72.192.227]:55910) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LAuQS-0006mM-Kl for qemu-devel@nongnu.org; Thu, 11 Dec 2008 17:54:32 -0500 Message-Id: <95DE7E4E-25A2-4D0C-9A59-FBDCE503522E@web.de> From: =?ISO-8859-1?Q?Andreas_F=E4rber?= In-Reply-To: <494189E9.4040007@codemonkey.ws> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Subject: Re: [Qemu-devel] [PATCH 01/13] hw/ppc.c: LOG_IRQ macro Date: Thu, 11 Dec 2008 23:54:08 +0100 References: <1228933464-7670-1-git-send-email-ehabkost@redhat.com> <1228933464-7670-2-git-send-email-ehabkost@redhat.com> <494189E9.4040007@codemonkey.ws> Sender: andreas.faerber@web.de Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost Am 11.12.2008 um 22:45 schrieb Anthony Liguori: > Eduardo Habkost wrote: >> This macro will avoid some #ifdefs in the code and create a single >> point >> where the logging call can be changed in the future. >> >> Signed-off-by: Eduardo Habkost >> --- >> hw/ppc.c | 10 ++++++++++ >> 1 files changed, 10 insertions(+), 0 deletions(-) >> >> diff --git a/hw/ppc.c b/hw/ppc.c >> index 60d6e86..cbd69e0 100644 >> --- a/hw/ppc.c >> +++ b/hw/ppc.c >> @@ -31,6 +31,16 @@ >> //#define PPC_DEBUG_IRQ >> //#define PPC_DEBUG_TB >> +#ifdef PPC_DEBUG_IRQ >> +# define LOG_IRQ(...) do { \ >> + if (loglevel & CPU_LOG_INT) \ >> + fprintf(logfile, __VA_ARGS__); \ >> + } while (0) >> +#else >> +# define LOG_IRQ(...) do { } while (0) >> +#endif >> > > This style of macro is less ideal than: > > #define LOG_IRQ(fmt, ...) fprintf(logfile, fmt, ## __VA_ARGS__). Now that the TCG conversion is done, does QEMU still require GCC? I remember we had issues with such macros in Mono's eGLib due to some compilers needing "fmt..." instead of "fmt, ..." and some not supporting "__VA_ARGS__" but "...". It might make sense then to put such logging macros in a central place (qemu-common.h?) to avoid having to cope with such annoyances in all those source files. Andreas