Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Mar 1996 07:38:51 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, terry@lambert.org
Cc:        freebsd-current@freebsd.org, j@uriah.heep.sax.de
Subject:   Re: lint
Message-ID:  <199603272038.HAA20036@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help

>> It doesn't understand them even with -g.  I think the author plans to
>> fix this.  There has to be a way to tell lint that certain functions
>> don't return, and __attribute__((__noreturn__)) is a good way.

>Putting "/* NOTREACHED*/" after the function call is the traditional
>lint method... assuming this is supposed to be an implementation of
>a traditional lint, instead of some new thing.

Not according to lint man pages:

"BUGS
The routines exit(2) [sic] ... and other functions that do not return are
not understood; this causes various incorrect diagnostics".

/*NOTREACHED*/ only works for the function call, not for the function
declaration.  You have to put the comment after thousands of calls to
exit() instead of after one declaration of exit.  If /*NOTREACHED*/
worked to qualify function declarations, then you might be able to
implement it using __dead, __dead2 or __attribute__((__noreturn__)).
E.g.,

#define __dead		/*NOTREACHED*/	/* probably misplaced */
#define __dead2		/*NOTREACHED*/	/* more likely to work */

Bruce



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