lkml.org 
[lkml]   [2015]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Compiler warning about comparing result of !!test_bit() to an integer
Date
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


\
 
 \ /
  Last update: 2015-04-27 17:41    [W:0.037 / U:0.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site