qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 17/25] audio: remove gcc specific audio_MIN, aud


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 17/25] audio: remove gcc specific audio_MIN, audio_MAX
Date: Thu, 20 Aug 2015 00:31:40 +0100

On 19 August 2015 at 19:17, Gerd Hoffmann <address@hidden> wrote:
> On Do, 2015-08-06 at 20:28 +0200, Kővágó, Zoltán wrote:
>> Currently the gcc specific version only evaluates the arguments once,
>> while the generic version evaluates one argument twice, which can cause
>> debugging headaches when an argument has a side effect.
>
> The answer to that is "don't do that".  Do we have macro calls with side
> effects in the tree?
>
>> This patch at least provides consistent behavior between compilers.
>
> Makes sense.
>
>> -#else
>>  #define audio_MIN(a, b) ((a)>(b)?(b):(a))
>>  #define audio_MAX(a, b) ((a)<(b)?(b):(a))
>> -#endif
>
> include/qemu/osdep.h already provides MIN/MAX macros.
>
> I think we should either define audio_MIN (and audio_MAX) to those, or
> simply do s/audio_MIN/MIN/ in audio/*.c

My vote is for the latter. Incidentally we already assume both
typeof and statement expr support in our compilers, so we could
upgrade our local MIN/MAX implementations to use them if we
really needed. (We'd have to rename them though, since the
system implementation likely does the eval-twice thing.)

A quick grep doesn't show any audio_MIN/MAX which need to
avoid multiple-evaluation, though.

thanks
-- PMM



reply via email to

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