Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753113AbbD0PRi (ORCPT ); Mon, 27 Apr 2015 11:17:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45079 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753086AbbD0PRh (ORCPT ); Mon, 27 Apr 2015 11:17:37 -0400 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <8828.1430144003@warthog.procyon.org.uk> To: Jiri Kosina Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org Subject: Re: Compiler warning about comparing result of !!test_bit() to an integer MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20117.1430147853.1@warthog.procyon.org.uk> Date: Mon, 27 Apr 2015 16:17:33 +0100 Message-ID: <20118.1430147853@warthog.procyon.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1279 Lines: 32 Jiri Kosina 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 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/