Paolo Bonzini wrote: > exit is declared as a nonreturning built-in by GCC > (devel/gcc/gcc/builtins.def):
Indeed, the fact that it's a built-in makes a difference: ========================== foo.c ================================ extern /*__attribute__ ((__noreturn__))*/ void exit (int); static __attribute__ ((__noreturn__)) void handler (int sig) { exit (0); } ================================================================= $ gcc -Wall -Wmissing-noreturn -c foo.c $ gcc -Wall -Wmissing-noreturn -c foo.c -Dexit=otherfunc foo.c: In function 'handler': foo.c:5:1: warning: 'noreturn' function does return This also answers Eric's question whether we should do something in gnulib's <stdlib.h> replacement. I'm applying Bernhard's patch, with comments. > For non-GCC compilers I don't think we care about warnings, do we? Right. Bruno 2011-10-07 Bernhard Voelker <m...@bernhard-voelker.de> raise tests: Avoid a GCC warning. * tests/test-raise.c (handler): Use _Noreturn. --- a/tests/test-raise.c +++ b/tests/test-raise.c @@ -25,7 +25,10 @@ SIGNATURE_CHECK (raise, int, (int)); #include "macros.h" -static void +/* It is safe to use _Noreturn here: exit() never returns, and GCC knows that + exit() is a non-returning function, even on platforms where its declaration + in <stdlib.h> does not have the 'noreturn' attribute. */ +static _Noreturn void handler (int sig) { exit (0); -- In memoriam Anna Politkovskaya <http://en.wikipedia.org/wiki/Anna_Politkovskaya>