svn commit: r328430 - head/sbin/devd

Bruce Evans brde at optusnet.com.au
Fri Jan 26 10:49:42 UTC 2018


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


More information about the svn-src-all mailing list