From owner-freebsd-toolchain@FreeBSD.ORG Mon Oct 17 15:25:48 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id E1250106567F; Mon, 17 Oct 2011 15:25:48 +0000 (UTC) Date: Mon, 17 Oct 2011 15:25:48 +0000 From: Alexander Best To: freebsd-toolchain@freebsd.org Message-ID: <20111017152548.GA66978@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: disable -Wtautological-compare for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2011 15:25:49 -0000 hi there, any chance we could disable -Wtautological-compare for clang? i don't think comparing an unsigned int against < 0 is worth a warning. actually it's always nice to have such a seatbelt, in case somebody changes the type to int and forgets to introduce such a check. cheers. alex From owner-freebsd-toolchain@FreeBSD.ORG Mon Oct 17 17:11:38 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 713C0106566B for ; Mon, 17 Oct 2011 17:11:38 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from ainaz.pair.com (ainaz.pair.com [209.68.2.66]) by mx1.freebsd.org (Postfix) with ESMTP id 538098FC08 for ; Mon, 17 Oct 2011 17:11:38 +0000 (UTC) Received: from [10.11.127.239] (unknown [12.228.211.90]) by ainaz.pair.com (Postfix) with ESMTPSA id 162583F40F for ; Mon, 17 Oct 2011 12:56:15 -0400 (EDT) Date: Mon, 17 Oct 2011 09:56:23 -0700 (PDT) From: Gerald Pfeifer To: freebsd-toolchain@freebsd.org In-Reply-To: <20111017152548.GA66978@freebsd.org> Message-ID: References: <20111017152548.GA66978@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [toolchain] disable -Wtautological-compare for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2011 17:11:38 -0000 On Mon, 17 Oct 2011, Alexander Best wrote: > any chance we could disable -Wtautological-compare for clang? i don't > think comparing an unsigned int against < 0 is worth a warning. actually > it's always nice to have such a seatbelt, in case somebody changes the > type to int and forgets to introduce such a check. I am on the fence on this one, for when I used the equivalent warning in GCC this did found a number of real issues that I then addressed for Wine (as an example). Gerald From owner-freebsd-toolchain@FreeBSD.ORG Mon Oct 17 17:30:41 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F15C10656D8 for ; Mon, 17 Oct 2011 17:30:41 +0000 (UTC) (envelope-from rdivacky@vlakno.cz) Received: from vlakno.cz (lev.vlakno.cz [46.28.110.116]) by mx1.freebsd.org (Postfix) with ESMTP id C3FB88FC18 for ; Mon, 17 Oct 2011 17:30:40 +0000 (UTC) Received: by vlakno.cz (Postfix, from userid 1002) id 827FE7F383E; Mon, 17 Oct 2011 19:12:46 +0200 (CEST) Date: Mon, 17 Oct 2011 19:12:46 +0200 From: Roman Divacky To: Gerald Pfeifer Message-ID: <20111017171246.GA4161@freebsd.org> References: <20111017152548.GA66978@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-toolchain@freebsd.org Subject: Re: [toolchain] disable -Wtautological-compare for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2011 17:30:41 -0000 On Mon, Oct 17, 2011 at 09:56:23AM -0700, Gerald Pfeifer wrote: > On Mon, 17 Oct 2011, Alexander Best wrote: > > any chance we could disable -Wtautological-compare for clang? i don't > > think comparing an unsigned int against < 0 is worth a warning. actually > > it's always nice to have such a seatbelt, in case somebody changes the > > type to int and forgets to introduce such a check. > > I am on the fence on this one, for when I used the equivalent warning > in GCC this did found a number of real issues that I then addressed for > Wine (as an example). I also think this warning is very useful. Even in the "< 0" case, just think of the case when one meant "> 0" but typed the opposite. roman From owner-freebsd-toolchain@FreeBSD.ORG Mon Oct 17 17:42:13 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37AF7106564A for ; Mon, 17 Oct 2011 17:42:13 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id DBA168FC0C for ; Mon, 17 Oct 2011 17:42:12 +0000 (UTC) Received: from [10.30.101.53] ([209.117.142.2]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p9HHds8W089698 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Mon, 17 Oct 2011 11:39:55 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Mon, 17 Oct 2011 11:39:39 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <12466AAB-625F-4D20-80E6-2D4235ED81EC@bsdimp.com> References: <20111017152548.GA66978@freebsd.org> To: Gerald Pfeifer X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Mon, 17 Oct 2011 11:39:55 -0600 (MDT) Cc: freebsd-toolchain@freebsd.org Subject: Re: [toolchain] disable -Wtautological-compare for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2011 17:42:13 -0000 I'm all for leaving it on because things like char are signed on some = architectures and unsigned on others. This leads to bugs that only = appear on one architecture. This warning will, at least, flag those = usages. On Oct 17, 2011, at 10:56 AM, Gerald Pfeifer wrote: > On Mon, 17 Oct 2011, Alexander Best wrote: >> any chance we could disable -Wtautological-compare for clang? i don't=20= >> think comparing an unsigned int against < 0 is worth a warning. = actually=20 >> it's always nice to have such a seatbelt, in case somebody changes = the=20 >> type to int and forgets to introduce such a check. >=20 > I am on the fence on this one, for when I used the equivalent warning > in GCC this did found a number of real issues that I then addressed = for > Wine (as an example). >=20 > Gerald > _______________________________________________ > freebsd-toolchain@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-toolchain > To unsubscribe, send any mail to = "freebsd-toolchain-unsubscribe@freebsd.org" >=20 >=20 From owner-freebsd-toolchain@FreeBSD.ORG Mon Oct 17 22:40:39 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mandree.no-ip.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 73535106566B for ; Mon, 17 Oct 2011 22:40:39 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by apollo.emma.line.org (Postfix) with ESMTP id A244123CF84 for ; Tue, 18 Oct 2011 00:28:42 +0200 (CEST) Message-ID: <4E9CAC1A.5040709@FreeBSD.org> Date: Tue, 18 Oct 2011 00:28:42 +0200 From: Matthias Andree User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Mnenhy/0.8.3 Thunderbird/3.1.15 MIME-Version: 1.0 To: freebsd-toolchain@freebsd.org References: <20111017152548.GA66978@freebsd.org> In-Reply-To: <20111017152548.GA66978@freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: disable -Wtautological-compare for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2011 22:40:39 -0000 Am 17.10.2011 17:25, schrieb Alexander Best: > any chance we could disable -Wtautological-compare for clang? i don't think > comparing an unsigned int against < 0 is worth a warning. actually it's always > nice to have such a seatbelt, in case somebody changes the type to int and > forgets to introduce such a check. If your code must be unclean in such a way that it uses deliberately dead code "just in case someone breaks the semantics", can you not use -Wno-tautological-compare in that situation? Unless someone goes to paranoia mode and sprays unneeded checks like you suggest all over the code like an ugly graffity, all such warnings are worth investigating. In code I've hand my eyes and/or hands on, the better part of these warnings were pointing to true bugs. So, objection. From owner-freebsd-toolchain@FreeBSD.ORG Tue Oct 18 05:01:26 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4FC21065670 for ; Tue, 18 Oct 2011 05:01:26 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from ainaz.pair.com (ainaz.pair.com [209.68.2.66]) by mx1.freebsd.org (Postfix) with ESMTP id 86AFF8FC14 for ; Tue, 18 Oct 2011 05:01:26 +0000 (UTC) Received: from [10.11.127.239] (unknown [12.228.211.90]) by ainaz.pair.com (Postfix) with ESMTPSA id 3B73D3F40F for ; Tue, 18 Oct 2011 01:01:25 -0400 (EDT) Date: Mon, 17 Oct 2011 22:01:31 -0700 (PDT) From: Gerald Pfeifer To: freebsd-toolchain@freebsd.org In-Reply-To: <4E9CAC1A.5040709@FreeBSD.org> Message-ID: References: <20111017152548.GA66978@freebsd.org> <4E9CAC1A.5040709@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [toolchain] disable -Wtautological-compare for clang X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2011 05:01:26 -0000 On Tue, 18 Oct 2011, Matthias Andree wrote: >> any chance we could disable -Wtautological-compare for clang? i don't >> think comparing an unsigned int against < 0 is worth a warning. >> actually it's always nice to have such a seatbelt, in case somebody >> changes the type to int and forgets to introduce such a check. > If your code must be unclean in such a way that it uses deliberately > dead code "just in case someone breaks the semantics", can you not use > -Wno-tautological-compare in that situation? It's not as straightforward, sadly, which is why I mentioned I am on the fence somehow. if (TYPE_MIN <= var && var <= TYPE_MAX) or if (var < TYPE_MIN || var > TYPE_MAX) are not that uncommon, in well written application, and if TYPE_MIN then evaluates to 0, we'll get a warning. > Unless someone goes to paranoia mode and sprays unneeded checks like you > suggest all over the code like an ugly graffity, all such warnings are > worth investigating. In code I've hand my eyes and/or hands on, the > better part of these warnings were pointing to true bugs. In my experience some were, while others were of the class above. Gerald