setjmp.h 984 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef _SETJMP_H
  2. #define _SETJMP_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. #include <bits/setjmp.h>
  8. typedef struct __jmp_buf_tag {
  9. __jmp_buf __jb;
  10. unsigned long __fl;
  11. unsigned long __ss[128/sizeof(long)];
  12. } jmp_buf[1];
  13. #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
  14. #define __setjmp_attr __attribute__((__returns_twice__))
  15. #else
  16. #define __setjmp_attr
  17. #endif
  18. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  19. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  20. || defined(_BSD_SOURCE)
  21. typedef jmp_buf sigjmp_buf;
  22. int sigsetjmp (sigjmp_buf, int) __setjmp_attr;
  23. _Noreturn void siglongjmp (sigjmp_buf, int);
  24. #endif
  25. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  26. || defined(_BSD_SOURCE)
  27. int _setjmp (jmp_buf) __setjmp_attr;
  28. _Noreturn void _longjmp (jmp_buf, int);
  29. #endif
  30. int setjmp (jmp_buf) __setjmp_attr;
  31. _Noreturn void longjmp (jmp_buf, int);
  32. #define setjmp setjmp
  33. #undef __setjmp_attr
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif