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: Tue, 29 Jan 2013 11:21:43 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2

Am 29.01.2013 11:03, schrieb Markus Armbruster:
> Andreas Färber <address@hidden> writes:
> 
>> b) Working around an issue resulting from hiding C statements inside a
>> preprocessor macro is totally backwards compared to properly using the C
>> language in the first place. Its mechanism for reuse are functions, and
>> for performance considerations static inline functions.
> 
> Nobody denies inline functions are to be preferred in many cases.
> 
> Valid exceptions include cases where we want genericity, which a macro
> can easily provide, but an inline function can't.
> 
>> Therefore I disagree with you that b) is not an entirely different
>> disussion as you repeatedly suggest and that according to a) it is not
>> *generally* necessary to put do { ... } while (0) into any random macro
>> that one writes. It depends on the contents and on the context.
> 
> I don't think Peter suggested to put do ... while (0) into random
> macros!  He asked to put it exactly into *statement-like* macros, as per
> standard C practice.  Most macros are expression-like.

Quoting PMM from last night:
<<<
"do ... while (0)" is completely standard practice
for writing robust macros in C. Patches which don't do that
should fail code review.
>>>

This is what sparked the most heated part of this debate! I completely
object to this generalized statement without restriction to
statement-like macros.

> I think you're overstating your case.  Statement-like macros should be
> rare.

This RFC was just a beginning. An average 50%+ of per target-*/ files
contained macros that were touched here. Even more files are in hw/. Per
file it was up to ~5 such macro definitions. And my main issue is
deriving a convention for new files from this discussion.

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]