From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LAv1A-0007bq-DH for qemu-devel@nongnu.org; Thu, 11 Dec 2008 18:32:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LAv19-0007a9-7E for qemu-devel@nongnu.org; Thu, 11 Dec 2008 18:32:27 -0500 Received: from [199.232.76.173] (port=33435 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LAv18-0007Zn-Pk for qemu-devel@nongnu.org; Thu, 11 Dec 2008 18:32:26 -0500 Received: from mx2.redhat.com ([66.187.237.31]:36777) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LAv17-00039v-G6 for qemu-devel@nongnu.org; Thu, 11 Dec 2008 18:32:25 -0500 Date: Thu, 11 Dec 2008 21:31:24 -0200 From: Eduardo Habkost Subject: Re: [Qemu-devel] [PATCH 01/13] hw/ppc.c: LOG_IRQ macro Message-ID: <20081211233124.GB5157@blackpad> References: <1228933464-7670-1-git-send-email-ehabkost@redhat.com> <1228933464-7670-2-git-send-email-ehabkost@redhat.com> <494189E9.4040007@codemonkey.ws> <95DE7E4E-25A2-4D0C-9A59-FBDCE503522E@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <95DE7E4E-25A2-4D0C-9A59-FBDCE503522E@web.de> Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: qemu-devel@nongnu.org On Thu, Dec 11, 2008 at 11:54:08PM +0100, Andreas F=E4rber wrote: > > 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 =20 >>> 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 =20 > remember we had issues with such macros in Mono's eGLib due to some =20 > compilers needing "fmt..." instead of "fmt, ..." and some not supportin= g=20 > "__VA_ARGS__" but "...". I chose __VA_ARGS__ because I expected it to be more commonly supported o= n other compilers. GCC documentation mentions "fmt..." as a GCC extension. > > It might make sense then to put such logging macros in a central place = =20 > (qemu-common.h?) to avoid having to cope with such annoyances in all =20 > those source files. Yes. I plan to unify all those debug macros somewhere, later. But I want to do this one step at a time. This first series is just to keep exactly the same behavior with a cleaner code. After that, we can make all targets use similar macros and then unify them on a single place. --=20 Eduardo