This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Don't warn about missing noreturn for main
- To: aj at suse dot de, robertlipe at usa dot net
- Subject: Re: Don't warn about missing noreturn for main
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Sat, 30 Dec 2000 21:02:00 -0500 (EST)
- Cc: gcc-patches at gcc dot gnu dot org
> From: Andreas Jaeger <aj@suse.de>
>
> It's quite common to end main with exit (0) instead of a return value.
> But if you do this, and use -Wmissing-noreturn you get:
> t.c: In function `main':
> t.c:7: warning: function might be possible candidate for attribute `noreturn'
>
> Here's a patch (together with a corresponding testcase and
> documentation update) to suppress the warning. IMO there's no sense
> to warn about this for main.
Historical note: I proposed the same thing over a year ago but it got
shot down. The suggestion at the time was to either declare main as
noreturn in one's code or to return from main rather than exit. Using
`return' from main was how I eliminated most of these warnings from
gcc itself.
Perhaps this position has softened since then and you'll have more
success. Good luck. :-)
http://gcc.gnu.org/ml/gcc/1999-08n/msg00397.html
http://gcc.gnu.org/ml/gcc/1999-08n/msg00453.html
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions