All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Ed Maste <emaste@freebsd.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] io: fix build on FreeBSD
Date: Thu, 25 Feb 2016 09:37:18 -0700	[thread overview]
Message-ID: <56CF2DBE.4070708@redhat.com> (raw)
In-Reply-To: <20160225163202.GI10515@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-02-25 16:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 15:31 [Qemu-devel] [PATCH] io: fix build on FreeBSD Ed Maste
2016-02-25 15:46 ` [Qemu-trivial] " Daniel P. Berrange
2016-02-25 15:46   ` [Qemu-devel] " Daniel P. Berrange
2016-02-25 16:29 ` Eric Blake
2016-02-25 16:32   ` Daniel P. Berrange
2016-02-25 16:37     ` Eric Blake [this message]
2016-02-25 16:41       ` Daniel P. Berrange
2016-02-26 14:25         ` Ed Maste

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56CF2DBE.4070708@redhat.com \
    --to=eblake@redhat.com \
    --cc=berrange@redhat.com \
    --cc=emaste@freebsd.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.