From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYyzB-0006Y1-Rb for qemu-devel@nongnu.org; Thu, 25 Feb 2016 11:41:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYyz8-0001CL-2Q for qemu-devel@nongnu.org; Thu, 25 Feb 2016 11:41:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40372) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYyz7-0001CE-TO for qemu-devel@nongnu.org; Thu, 25 Feb 2016 11:41:50 -0500 Date: Thu, 25 Feb 2016 16:41:45 +0000 From: "Daniel P. Berrange" Message-ID: <20160225164145.GJ10515@redhat.com> References: <1456414292-55363-1-git-send-email-emaste@freebsd.org> <56CF2BCE.6090504@redhat.com> <20160225163202.GI10515@redhat.com> <56CF2DBE.4070708@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <56CF2DBE.4070708@redhat.com> Subject: Re: [Qemu-devel] [PATCH] io: fix build on FreeBSD Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Ed Maste , qemu-devel@nongnu.org On Thu, Feb 25, 2016 at 09:37:18AM -0700, Eric Blake wrote: > 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? To be honest, I think the preprocessor check inside the expression isn't a big deal and clearer than playing games like this. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|