On 10/05/2011 04:46 PM, Eric Blake wrote:
-static void
+static _Noreturn void
handler (int sig)
{
exit (0);
While this patch removes a gcc warning of type
"function might be possible candidate for attribute 'noreturn'"
on some platform, it introduces a gcc warning of type
"'noreturn' function does return" on other platforms (namely
on those where<stdlib.h> does not declare exit() as a non-
returning function).
Shouldn't that imply that gnulib's <stdlib.h> replacement should be
taught to guarantee that exit() is declared noreturn even if the
system's header is missing that information?
Or, avoiding a change to gnulib's <stdlib.h>, why not use this?
static _Noreturn void
handler (int sig)
{
while (1)
exit (0);
}
That is, the while(1) construct should be sufficient for gcc to detect
an infloop condition which is another way to satisfy handler's noreturn
marking, even if exit() itself was not marked noreturn.
--
Eric Blake ebl...@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org