From owner-freebsd-current Wed Mar 27 13:41:00 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id NAA00713 for current-outgoing; Wed, 27 Mar 1996 13:41:00 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id NAA00694 for ; Wed, 27 Mar 1996 13:40:56 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id OAA02042; Wed, 27 Mar 1996 14:38:42 -0700 From: Terry Lambert Message-Id: <199603272138.OAA02042@phaeton.artisoft.com> Subject: Re: lint To: bde@zeta.org.au (Bruce Evans) Date: Wed, 27 Mar 1996 14:38:41 -0700 (MST) Cc: bde@zeta.org.au, terry@lambert.org, freebsd-current@FreeBSD.org, j@uriah.heep.sax.de In-Reply-To: <199603272038.HAA20036@godzilla.zeta.org.au> from "Bruce Evans" at Mar 28, 96 07:38:51 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk > >> 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.