From owner-freebsd-toolchain@FreeBSD.ORG Mon Nov 7 00:39:53 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 71419106566B; Mon, 7 Nov 2011 00:39:53 +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 295E48FC0C; Mon, 7 Nov 2011 00:39:49 +0000 (UTC) Received: from 63.imp.bsdimp.com (63.imp.bsdimp.com [10.0.0.63]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id pA70YiN2062233 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Sun, 6 Nov 2011 17:34:44 -0700 (MST) (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: <20111106205805.GA78142@freebsd.org> Date: Sun, 6 Nov 2011 17:34:33 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20111105102102.GA54596@freebsd.org> <20111106172835.GO2258@hoeg.nl> <20111106203316.GA73216@freebsd.org> <4EB6F38E.2080006@FreeBSD.org> <20111106205805.GA78142@freebsd.org> To: Alexander Best 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]); Sun, 06 Nov 2011 17:34:44 -0700 (MST) Cc: freebsd-toolchain@FreeBSD.org, Dimitry Andric Subject: Re: [poc] buildkernel + clang + -Werror 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, 07 Nov 2011 00:39:53 -0000 On Nov 6, 2011, at 1:58 PM, Alexander Best wrote: > On Sun Nov 6 11, Dimitry Andric wrote: >> On 2011-11-06 21:33, Alexander Best wrote: >> ...=20 >>> the problem is, something like >>>=20 >>> uint x; >>>=20 >>> if (x < 0) ... >>>=20 >>> clang will warn about this, yet it is 100% valid code so my vote = would be to >>> make such an error into a warning. >>=20 >> Sorry, but checking something unsigned to be smaller than zero is = bogus, >> or at the least superfluous, and it's perfectly sane to warn about = this, >> especially since the compiler is not going to emit code for it at = all. >=20 > there was a discussion with the topic > "disable -Wtautological-compare for clang" on freebsd-toolchain@ and = most of > the devs considered this code *not* to be bogus. ;) The code actually is bogus. It may be masking a real problem, because = often times it is a "sanity check" to make sure that you aren't doing = something naughty, like passing -1 for the length. However, if you then = pass the unsigned through a signed value, it suddenly becomes negative, = and you have a hard to spot bug. IIR the the tread, there weren't too = many people offering an opinion... Warner=