On 25 February 2016 at 11:41, Daniel P. Berrange <berra...@redhat.com> wrote: > On Thu, Feb 25, 2016 at 09:37:18AM -0700, Eric Blake wrote: >> >> 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? > > To be honest, I think the preprocessor check inside the expression isn't > a big deal and clearer than playing games like this.
I wasn't a fan of putting the preprocessor check inside the expression either, but no clear and concise alternative came to mind. I think it's easier to see both intent and effect with the preoprocessor check than with the above.