Download raw body.
mark got_privsep_exec_child as __dead
> So __dead and __attribute__ ((__noreturn__)) are different from
> a void return type, in the sense that they inform the compiler
> that the program will stop its execution at the end of the function?
>
> What is the advantage over just calling exit()?
>
It's a hint for the compiler. I think it allows some optimizations like
eliminating dead code. It will also prevent some warnings. As a silly
example, compiling the program below will generate a warning:
test.c:17:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
If you mark g() __dead, it will compile without warnings as it should
because g won't return. If you call exit directly in h() instead of
going via g(), the compiler will be happy since exit() is marked __dead
in stdlib.h.
#include <stdio.h>
#include <stdlib.h>
void
g(void)
{
exit(0);
}
int
h(int exit)
{
if (exit)
g();
else
return 42;
}
int
main(void)
{
h(1);
return 0;
}
mark got_privsep_exec_child as __dead