mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: Compiler warning about comparing result of !!test_bit() to an integer
Date: Mon, 27 Apr 2015 16:17:33 +0100	[thread overview]
Message-ID: <20118.1430147853@warthog.procyon.org.uk> (raw)
In-Reply-To: <alpine.LNX.2.00.1504271619160.16113@pobox.suse.cz>

Jiri Kosina <jkosina@suse.cz> wrote:

> gcc-5 became somehow very picky about '!!' usages. I recall quite some 
> internal discussions with our gcc guys, which resulted in upstream gcc 
> bugzillas being filled about gcc warning in completely legitimate cases.

I suspect it's more that it's picky about '!' usages - which covers '!!'.  I'm
guessing they're trying to pick up people doing if(!x==y) when they mean
if(!(x==y)) or somesuch.
Jiri Kosina <jkosina@suse.cz> wrote:

> This is because we want to handle autorepeat (i.e. value 2) correctly. Now 
> that you ask, it seems to me that we actually should be doing
> 
> 	!!test_bit(usage->code, input->key) != !!value

I wonder if you could cast to bool instead?  test_bit() possibly *should*
return a bool these days, thus rendering the '!!' unnecessary.

> to be really exact (i.e. so that we really can't have oscilating state).
> 
> I'll think about it a little bit more, and eventually probably fix it this 
> way with your Reported-by: if you are OK with that.

Yep.

David

      parent reply	other threads:[~2015-04-27 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 14:13 David Howells
2015-04-27 14:25 ` Jiri Kosina
2015-04-27 15:17 ` David Howells [this message]

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=20118.1430147853@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®