Branch: Tag:

2015-11-27

2015-11-27 19:14:40 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Revert "setjmp and longjmp are standardized C89."

This reverts commit 0e9cd75e000d4d87c212721cb3494f609632807c.

They are standardized, but we only use them as fallback if sigsetjmp()
doesn't exist.

26:   #include "global.h"   #include <setjmp.h>    + #if defined(HAVE_SIGSETJMP) && defined(HAVE_SIGLONGJMP) + #define HAVE_AND_USE_SIGSETJMP + #define LOW_JMP_BUF sigjmp_buf + #define LOW_SETJMP(X) sigsetjmp(X, 0) + #define LOW_LONGJMP(X, Y) siglongjmp(X, Y) + #elif defined(HAVE__SETJMP) && defined(HAVE__LONGJMP) + #define HAVE_AND_USE__SETJMP + #define LOW_JMP_BUF jmp_buf + #define LOW_SETJMP(X) _setjmp(X) + #define LOW_LONGJMP(X, Y) _longjmp(X, Y) + #else + /* Assume we have setjmp and longjmp, they are after all defined by ANSI C. */ + #define HAVE_AND_USE_SETJMP + #define LOW_JMP_BUF jmp_buf + #define LOW_SETJMP(X) setjmp(X) + #define LOW_LONGJMP(X, Y) longjmp(X, Y) + #endif +    #if 1   PMOD_EXPORT extern const char msg_fatal_error[];   #define Pike_fatal \
87:   typedef struct JMP_BUF   {    struct JMP_BUF *previous; -  jmp_buf recovery; +  LOW_JMP_BUF recovery;    struct pike_frame *frame_pointer;    ptrdiff_t stack_pointer;    ptrdiff_t mark_sp;
128:   #endif      #define DEBUG_INIT_REC_ARGS , int on_stack, const char *location - #define SETJMP(X) setjmp(init_recovery(&X, 0, 1, PERR_LOCATION())->recovery) + #define SETJMP(X) LOW_SETJMP((init_recovery(&X, 0, 1, PERR_LOCATION())->recovery))   #define SETJMP_SP(jmp, stack_pop_levels) \ -  setjmp(init_recovery(&jmp, stack_pop_levels, 1, PERR_LOCATION())->recovery) +  LOW_SETJMP((init_recovery(&jmp, stack_pop_levels, 1, PERR_LOCATION())->recovery))   #else /* !PIKE_DEBUG */   #define DEBUG_INIT_REC_ARGS - #define SETJMP(X) setjmp(init_recovery(&X, 0)->recovery) + #define SETJMP(X) LOW_SETJMP((init_recovery(&X, 0)->recovery))   #define SETJMP_SP(jmp, stack_pop_levels) \ -  setjmp(init_recovery(&jmp, stack_pop_levels)->recovery) +  LOW_SETJMP((init_recovery(&jmp, stack_pop_levels)->recovery))   #define UNSETJMP(X) Pike_interpreter.recoveries=X.previous   #endif /* !PIKE_DEBUG */