Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jan 1999 16:31:29 +0200 (SAT)
From:      Robert Nordier <rnordier@nordier.com>
To:        peter@netplex.com.au (Peter Wemm)
Cc:        fenner@parc.xerox.com, bde@zeta.org.au, cvs-committers@FreeBSD.ORG
Subject:   Re: -Werror
Message-ID:  <199901201431.QAA02757@ceia.nordier.com>
In-Reply-To: <199901201228.UAA19912@spinner.netplex.com.au> from Peter Wemm at "Jan 20, 99 08:28:18 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Wemm wrote:
> Bill Fenner wrote:
> > Or should simply be caught by --don't-be-lazy .  -Werror doesn't help
> > when the committer thinks that it's so obvious and simple that there's
> > no need to even try building it.
> > 
> >   Bill
> 
> The last time the warnings, etc, thing came up, the consensis was:
> 
> In development mode, all practical warnings turned on.
> In release mode, turn them off.  It's no use scaring the users about 
> something they have little or no control over.
> 
> Personally, I'd be quite happy to have -Werror turned on during
> development, providing that it doesn't make it into any releases.

One consequence of -Werror is that is forces a trade-off between

    o the number of warnings it is practical to turn on
    o the amount of rewriting of existing code it is practical to do

Particularly in the case of a compiler (versus a good-quality lint
tool), warnings have a probability of accuracy that ranges from
fairly low to extremely high.

The effect -Werror has is to force a binary choice: either take
the warning completely seriously (and rewrite any correct code that
confuses the compiler), or turn the warning off.

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).  There's an awful lot of BSD
code like this, that could cause huge {Net,Open}BSD diffs if
rewritten.

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.

--
Robert Nordier

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901201431.QAA02757>