summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/include/setjmp.h2
-rw-r--r--tests/headers/posix/setjmp_h.c6
2 files changed, 8 insertions, 0 deletions
diff --git a/libc/include/setjmp.h b/libc/include/setjmp.h
index d44946f7e..195f2515a 100644
--- a/libc/include/setjmp.h
+++ b/libc/include/setjmp.h
@@ -71,6 +71,8 @@ void _longjmp(jmp_buf __env, int __value);
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 b6b75eea7..6544d2a88 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);