This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: egcs, RFC: patch for possible -Wmissing-noreturn warning
- To: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Subject: Re: egcs, RFC: patch for possible -Wmissing-noreturn warning
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 12 Oct 1998 12:20:10 -0600
- cc: egcs-patches at cygnus dot com, egcs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <199810111726.NAA19753@caip.rutgers.edu>you write:
> The problem is that I'm getting a small number of false
> positives when `static inline void' functions are used.
I wonder if we actually perform enough analysis on static inlines to determine
can_reach_end in c-decl.c (which in turn determines
current_function_returns_null.
> I'm also
> getting some hits when exit() is called from main(). Although
> technically correct (its thus a function which doesn't `return',) I
> think its one case which should not be flagged.
[ ... ]
>
> Also if I have:
>
> > main()
> > {
> > return 0;
> > }
>
> all's well.
>
>
> However, if I have:
>
> > main()
> > {
> > exit(0);
> > }
>
> I get:
>
> > foo.c: In function `main':
> > foo.c:4: warning: function does not return, and is not declared `noreturn'
>
> Again, this is technically correct. But should we offer a pass from
> `main', or do we encourage people to use the `return', not `exit' style?
Not sure. I hate making special exceptions like this, but given that we've
already made several for "main" I guess another isn't so bad.
jeff