All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <tcminyard@gmail.com>
To: Bug 1651167 <1651167@bugs.launchpad.net>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Bug 1651167] [NEW] hw/ipmi/isa_ipmi_bt.c:283: suspect use of macro ?
Date: Thu, 22 Dec 2016 08:20:55 -0600	[thread overview]
Message-ID: <84800dca-907f-453b-c693-8ebf3d7b1e59@gmail.com> (raw)
In-Reply-To: <20161219154752.14563.46483.malonedeb@wampee.canonical.com>

On 12/19/2016 09:47 AM, dcb wrote:
> Public bug reported:
>
> I just had a go at compiling qemu trunk with
> llvm trunk. It said:
>
> hw/ipmi/isa_ipmi_bt.c:283:31: warning: logical not is only applied to
> the left hand side of this bitwise operator [-Wlogical-not-parentheses]
>
> Source code is
>
>             IPMI_BT_SET_HBUSY(ib->control_reg,
>                                !IPMI_BT_GET_HBUSY(ib->control_reg));
>
> That use of ! causes trouble. The SET and GET
> macros are defined as:
>
> #define IPMI_BT_GET_HBUSY(d)       (((d) >> IPMI_BT_HBUSY_BIT) & 0x1)
> #define IPMI_BT_SET_HBUSY(d, v)    (d) = (((d) & ~IPMI_BT_HBUSY_MASK) | \
>                                         (((v & 1) << IPMI_BT_HBUSY_BIT)))
>
> I can make the compiler shut up by adding extra () in the last
> use of v in the SET macro, like this:
>
> #define IPMI_BT_SET_HBUSY(d, v)    (d) = (((d) & ~IPMI_BT_HBUSY_MASK) | \
>                                         ((((v) & 1) << IPMI_BT_HBUSY_BIT)))
>
> I think this is standard good practice when using macro parameters
> anyway.

Yeah, that's the way things are supposed to be done.  I'll get a patch 
out on this.
There were a bunch of them.

Thanks,

-corey

>
> ** Affects: qemu
>       Importance: Undecided
>           Status: New
>

  reply	other threads:[~2016-12-22 14:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-19 15:47 [Qemu-devel] [Bug 1651167] [NEW] hw/ipmi/isa_ipmi_bt.c:283: suspect use of macro ? dcb
2016-12-22 14:20 ` Corey Minyard [this message]
2016-12-22 14:25 ` [Qemu-devel] [Bug 1651167] " cminyard
2016-12-22 14:30 ` [Qemu-devel] [PATCH] ipmi: Add parenthesis around some macro parameters minyard
2016-12-22 15:01   ` Eric Blake
2016-12-22 17:48     ` Corey Minyard
2016-12-22 19:18 ` [Qemu-devel] [PATCH v2] ipmi: Fix macro issues minyard
2016-12-22 22:17   ` Eric Blake
2016-12-23 14:07 ` [Qemu-devel] [PATCH v3] " minyard
2017-03-30 16:10   ` [Qemu-devel] [PATCH for-2.9? " Eric Blake
2017-04-24  7:38 ` [Qemu-devel] [Bug 1651167] Re: hw/ipmi/isa_ipmi_bt.c:283: suspect use of macro ? Thomas Huth

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=84800dca-907f-453b-c693-8ebf3d7b1e59@gmail.com \
    --to=tcminyard@gmail.com \
    --cc=1651167@bugs.launchpad.net \
    --cc=minyard@acm.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.