qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] io: fix build on FreeBSD


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] io: fix build on FreeBSD
Date: Thu, 25 Feb 2016 09:37:18 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 02/25/2016 09:32 AM, Daniel P. Berrange wrote:

>>> +        if (
>>> +#ifdef EAI_ADDRFAMILY
>>> +            gaierr == EAI_ADDRFAMILY ||
>>> +#endif
>>>              gaierr == EAI_FAMILY ||
>>
>> I'm not the biggest-fan of mid-expression #ifdefs. Can we rewrite this
>> to look more like:
>>
>> #ifndef EAI_ADDRFAMILY
>> #define EAI_ADDRFAMILY EAI_FAMILY
>> #endif
>>
>> and leave the conditional expression unchanged?
> 
> I think that'll cause gcc  6 to whine about you checking the same
> value twice in the conditional, like how it complains that EWOULDBLOCK
> and EAGAIN are the same.

Oh, right. That's annoying.  What about:

#ifndef EAI_ADDRFAMILY
#define EAI_ADDRFAMILY 0
#endif

if ((EAI_ADDRFAMILY && gaierr == EAIADDRFAMILY) ||
    gaierr == EAI_FAMILY...

to shut up gcc 6, while still hoisting the preprocessor logic outside of
the expression?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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