Elliott Hughes | 13da600 | 2025-02-03 10:42:13 -0800 | [diff] [blame] | 1 | // Copyright (C) 2017 The Android Open Source Project |
| 2 | // SPDX-License-Identifier: BSD-2-Clause |
Elliott Hughes | 21b56eb | 2017-10-20 17:57:17 -0700 | [diff] [blame] | 3 | |
| 4 | #include <setjmp.h> |
| 5 | |
| 6 | #include "header_checks.h" |
| 7 | |
Elliott Hughes | bf74815 | 2018-07-17 13:55:36 -0700 | [diff] [blame] | 8 | // POSIX says it's undefined whether `setjmp` is a macro or a function, |
| 9 | // but C11 says it's a macro, and the C standard always wins. |
| 10 | #if !defined(setjmp) |
| 11 | #error setjmp |
| 12 | #endif |
| 13 | |
Elliott Hughes | 21b56eb | 2017-10-20 17:57:17 -0700 | [diff] [blame] | 14 | static void setjmp_h() { |
| 15 | TYPE(jmp_buf); |
| 16 | TYPE(sigjmp_buf); |
| 17 | |
| 18 | FUNCTION(_longjmp, void (*f)(jmp_buf, int)); |
| 19 | FUNCTION(longjmp, void (*f)(jmp_buf, int)); |
| 20 | FUNCTION(siglongjmp, void (*f)(sigjmp_buf, int)); |
| 21 | |
| 22 | FUNCTION(_setjmp, int (*f)(jmp_buf)); |
| 23 | FUNCTION(setjmp, int (*f)(jmp_buf)); |
| 24 | #if defined(__GLIBC__) |
| 25 | FUNCTION(__sigsetjmp, int (*f)(sigjmp_buf, int)); |
| 26 | #else |
| 27 | FUNCTION(sigsetjmp, int (*f)(sigjmp_buf, int)); |
| 28 | #endif |
| 29 | } |