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
signature.asc
Description: OpenPGP digital signature