qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros


From: Andreas Färber
Subject: Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros
Date: Mon, 28 Jan 2013 20:02:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2

Am 28.01.2013 19:29, schrieb Peter Maydell:
> On 28 January 2013 18:22, Richard Henderson <address@hidden> wrote:
>> On 01/27/2013 05:32 AM, Andreas Färber wrote:
>>> +#define LOG_DISAS(...) G_STMT_START \
>>> +    if (ALPHA_DEBUG_DISAS) { \
>>> +        qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__); \
>>> +    } \
>>> +    G_STMT_END
>>
>>
>> I see zero advantage to using G_STMT_START/END over the
>> shorter and significantly more obvious direct use of do/while.
> 
> Strong agreement -- G_STMT_START/END is just pointless
> obfuscation without even the rationale of matching a
> glib interface.

I happened to know them from another project and think their semantic is
much more clear if you read them out loud: statement start .. end vs. do
... while zero. We don't semantically want a loop, we use it as error
detection tool, it could just as well be (__extension__({...})) or
whatever funkiness of the day there is. :) A macro can be redefined,
replacing do { ... } while (0) is manual work.

I wouldn't mind a Q... or QEMU_... macro if you oppose the G, but best
if we can avoid it in the first place!

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]