setjmp is a macro.
POSIX says it's unspecified whether setjmp is a macro or a function,
but C11 says it's a macro, and the C standard always wins.
Bug: https://github.com/android-ndk/ndk/issues/744
Test: ran tests
Change-Id: I4a1abc37724f8e9d9498f2093ef3c1f3b8253949
diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h
index d44946f..195f251 100644
--- a/libc/include/setjmp.h
+++ b/libc/include/setjmp.h
@@ -71,6 +71,8 @@
int setjmp(jmp_buf __env);
void longjmp(jmp_buf __env, int __value);
+#define setjmp(__env) setjmp(__env)
+
int sigsetjmp(sigjmp_buf __env, int __save_signal_mask)
__INTRODUCED_IN_ARM(9) __INTRODUCED_IN_MIPS(12) __INTRODUCED_IN_X86(12);
void siglongjmp(sigjmp_buf __env, int __value)
diff --git a/tests/headers/posix/setjmp_h.c b/tests/headers/posix/setjmp_h.c
index b6b75ee..6544d2a 100644
--- a/tests/headers/posix/setjmp_h.c
+++ b/tests/headers/posix/setjmp_h.c
@@ -30,6 +30,12 @@
#include "header_checks.h"
+// POSIX says it's undefined whether `setjmp` is a macro or a function,
+// but C11 says it's a macro, and the C standard always wins.
+#if !defined(setjmp)
+#error setjmp
+#endif
+
static void setjmp_h() {
TYPE(jmp_buf);
TYPE(sigjmp_buf);