From owner-cvs-all Wed Jan 20 10:47:10 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA02206 for cvs-all-outgoing; Wed, 20 Jan 1999 10:47:10 -0800 (PST) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from ceia.nordier.com (m2-46-dbn.dial-up.net [196.34.155.110]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA02201 for ; Wed, 20 Jan 1999 10:47:04 -0800 (PST) (envelope-from rnordier@nordier.com) Received: (from rnordier@localhost) by ceia.nordier.com (8.8.7/8.6.12) id UAA06207; Wed, 20 Jan 1999 20:41:57 +0200 (SAT) From: Robert Nordier Message-Id: <199901201841.UAA06207@ceia.nordier.com> Subject: Re: -Werror In-Reply-To: <031a01be4495$52293240$0d79eb0a@deskfix.local> from "Jeroen C. van Gelderen" at "Jan 20, 99 05:52:52 pm" To: gelderen@mediaport.org (Jeroen C. van Gelderen) Date: Wed, 20 Jan 1999 20:41:55 +0200 (SAT) Cc: rnordier@nordier.com, peter@netplex.com.au, fenner@parc.xerox.com, bde@zeta.org.au, cvs-committers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk Jeroen C. van Gelderen wrote: > From: Robert Nordier > >For example, compiled with -Wall, the code fragment > > > > if (x = y) > > x = z + 1 & 7; > > > >causes two warnings > > > > suggest parentheses around assignment used as truth value > > suggest parentheses around + or - in operand of & > > > >but rewriting to eliminate the errors would violate a style(9) > >guideline (unnecessary parentheses). > > Maybe you should consider updating style(9). A lot of companies would > consider parentheses in the last line absolutely neccessary. Chances are > that requiring parentheses in the first line will catch a few errors. > Chances that extra parentheses in the first line will *cause* errors are > quite small. Especially when you rewrite the line like: > if( (x = y) != 0 ) > which *IMHO* is the only correct way. I guess there's probably something to be said for any particular way of doing it, assuming there was some thought behind the original style(9) recommendation. Though your point that additional parentheses are safer on the whole seems reasonable. > >There's an awful lot of BSD > >code like this, that could cause huge {Net,Open}BSD diffs if > >rewritten. > > Hmm, but I thought the other BSD(s?) used -Werror? That would reverse your > argument ;) Actually, my argument is only that consistency is important, and that proper guidelines, codifying *existing* practice (except where there is good reason to change) should exist. Although style(9) is useful, it is outdated in certain respects, and it doesn't really cover all the bases. Bruce spends a fair amount of time committing fixes for "style bugs" and pointing these out in submissions; and the choices he makes probably constitute the de facto FreeBSD style. But I'd suspect that, to many or most people, his decisions are, to some extent, inscrutable. This situation adds to the whole bde mystique, but it probably wastes Bruce's time (since style is really a trivial issue), and it doesn't help folks who would prefer to just DTRT themselves. > > >So (to give just one example) if -Werror if used, -Wall becomes > >problematic. And so -Werror may result in useful warnings getting > >turned off rather than on. > > Fix style(9) and that problem goes away. I think if we fix style(9) properly, and then make the many code changes that will permit -Werror to work, the whole issue may go away. This doesn't force -Werror as the default, but will at least allow it as an option. -- Robert Nordier To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message