Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2018 21:49:35 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Ed Schouten <ed@nuxi.nl>
Cc:        Warner Losh <imp@bsdimp.com>, Eitan Adler <eadler@freebsd.org>,  src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r328430 - head/sbin/devd
Message-ID:  <20180126212938.E1040@besplex.bde.org>
In-Reply-To: <CABh_MKnA994NSh%2B8W=aEDGxg5JFWcMZr4EVe-_KHJ8xN9-vkfQ@mail.gmail.com>
References:  <201801260440.w0Q4efhg008105@repo.freebsd.org> <CANCZdfosuC0CTig=6_p3D5g0fDPhCVW3%2B4HAEbD4EQ4%2B3TetpA@mail.gmail.com> <CABh_MKnA994NSh%2B8W=aEDGxg5JFWcMZr4EVe-_KHJ8xN9-vkfQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 26 Jan 2018, Ed Schouten wrote:

> static void usage(void) __dead2;
>
> This should be spelled:
>
> [[noreturn]] static void usage();

That would be as silly as __dead2, and has a worse syntactic style
(attributes before the return type mess up the formatting).  It is
obvious even to lint that usage() doesn't return, since it finishes
with exit() and exit() is declared as not returning.

(lint in FreeBSD was actually documented as not understanding exit(),
and it never understood __dead2 or C++, so usage() and all other uses
of exit() would need /* NOTREACHED */ after them for lint, but that
would be even uglier than [[noreturn]] and the style bug of doing it
for usage() is less common than the style bug of declaring usage() as
__dead2.)

This file has further style bugs which make the whole prototype dead.
With normal style, or even with functions sorted alphabetically, main()
is before usage() so a forward declaration of usage() is needed.  However,
in this file, usage() is before main().  Also, this file usage a random
style for declaring forward prototypes when they are not needed.  It
declares unnecessary ones for usage() and event_loop(), and a necessary
one for devdlog(), but doesn't declare unnecessary ones for approx. 5
other functions.

Bruce



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