I'M USING NOSTDLIB! So I can't use C's abort
. In fact I'm implementing a variant of it
I get the following warning in clang
a.c:12:1: warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
in GCC it says
a.c:12:1: warning: ‘noreturn’ function does return
Is this a problem or fix-able? It seems like gettid is implicit even though the man pages says it is in unistd.h.
#include <signal.h>
#define _GNU_SOURCE
#include <unistd.h>
#ifndef __clang__
[[noreturn]]
#endif
__attribute__ ((__noreturn__))
void test()
{
kill(gettid(), SIGABRT);
}
int main() {
test();
return 0;
}
You can do:
__attribute__ ((__noreturn__))
void test(void)
{
kill(gettid(), SIGABRT);
__builtin_unreachable();
}