egcs, RFC: patch for possible -Wmissing-noreturn warning
Jeffrey A Law
law@cygnus.com
Mon Oct 12 13:10:00 GMT 1998
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
More information about the Gcc-patches
mailing list