svn commit: r217048 - head/share/man/man9

John Baldwin jhb at freebsd.org
Thu Jan 6 12:47:53 UTC 2011


On Thursday, January 06, 2011 4:02:43 am Julian Elischer wrote:
> On 1/6/11 12:33 AM, Edward Tomasz Napierala wrote:
> > Author: trasz
> > Date: Thu Jan  6 08:33:48 2011
> > New Revision: 217048
> > URL: http://svn.freebsd.org/changeset/base/217048
> >
> > Log:
> >    Get rid of bad advice regarding /* NOTREACHED */.  Compilers don't
> >    really need it (one can use __dead2 instead), and style(9) was not
> >    even consistent with itself in this regard.
> >
> > Modified:
> >    head/share/man/man9/style.9
> >
> > Modified: head/share/man/man9/style.9
> > 
==============================================================================
> > --- head/share/man/man9/style.9	Thu Jan  6 08:13:30 2011	(r217047)
> > +++ head/share/man/man9/style.9	Thu Jan  6 08:33:48 2011	(r217048)
> > @@ -470,9 +470,6 @@ statement that cascade should have a
> >   .Li FALLTHROUGH
> >   comment.
> >   Numerical arguments should be checked for accuracy.
> > -Code that cannot be reached should have a
> > -.Li NOTREACHED
> > -comment.
> 
> I object STRONGLY to this change.
> 
> The NOTREACHED is also to help the reader understand what has happened 
> and as an afterthought
> was also useful in LINT.  I know know of no technological change to 
> the average reader that makes
> it less useful.

Clutter.  It should be very obvious that exit(), err*(), pthread_exit(), 
kthread_exit(), kproc_exit() and even usage() all terminate without returning 
(the last not required, just a very common convention).  If you look at most 
code, NOTREACHED is actually used sparingly if at all.  Needless clutter makes 
code harder to parse (less of it fits into a single editor window) and should 
be avoided.  Most cases of 'ARGSUSED' are probably worse than 'NOTREACHED' 
abuses.

Also, our code in general has not followed this rule.  Some older code (back 
when lint was used before compilers (and lint) supported things like __dead2) 
still uses it, but new code tends to not use it.  __dead2 is actually far more 
useful than NOTREACHED since the compiler groks it (whereas compilers ignore 
NOTREACHED comments).

-- 
John Baldwin


More information about the svn-src-all mailing list