This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Don't warn about missing noreturn for main


 > 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]