Date: Wed, 27 Mar 1996 14:38:41 -0700 (MST) From: Terry Lambert <terry@lambert.org> To: bde@zeta.org.au (Bruce Evans) Cc: bde@zeta.org.au, terry@lambert.org, freebsd-current@FreeBSD.org, j@uriah.heep.sax.de Subject: Re: lint Message-ID: <199603272138.OAA02042@phaeton.artisoft.com> In-Reply-To: <199603272038.HAA20036@godzilla.zeta.org.au> from "Bruce Evans" at Mar 28, 96 07:38:51 am
next in thread | previous 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 */ Hmmmmmmm.... that's interesting, actually. But if that worked, then you could make "exit" intrinsically work without the NOTREACHED (or the __dead or __dead2). I may have to take a look at the lexer to see if it's possible to add state for exit... if someone gets to it before I do (I expect it'll be about 1998 before I do anything on it 8-)), then so much the better. Could you: #define exit( x) lint_exit(x); \ /* NOTREACHED*/ And make sure the lint lib defined lint_exit, and not exit? This wouldn't fix "return" from main, unfortunately... Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603272138.OAA02042>