mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-13 17:20:21 +02:00
Avoid clash with system setjmp/longjmp on IA64
Problem was that if an application includes both libguile.h and the system's setjmp.h, and is compiled on IA64, it gets compile errors because of jmp_buf, setjmp and longjmp being multiply defined. * libguile/__scm.h (__ia64__): Define scm_i_jmp_buf, SCM_I_SETJMP and SCM_I_LONGJMP instead of jmp_buf, setjmp and longjmp. (all other platforms): Map scm_i_jmp_buf, SCM_I_SETJMP and SCM_I_LONGJMP to jmp_buf, setjmp and longjmp. * libguile/continuations.c (scm_make_continuation): Use `SCM_I_SETJMP' instead of `setjmp'. (copy_stack_and_call): Use `SCM_I_LONJMP' instead of `longjmp'. (scm_ia64_longjmp): Use type `scm_i_jmp_buf' instead of `jmp_buf'. * libguile/continuations.h (scm_t_contregs): Use type `scm_i_jmp_buf' instead of `jmp_buf'. * libguile/threads.c (suspend): Use `SCM_I_SETJMP' instead of `setjmp'. * libguile/threads.h (scm_i_thread): Use type `scm_i_jmp_buf' instead of `jmp_buf'. * libguile/throw.c (JBJMPBUF, make_jmpbuf, jmp_buf_and_retval): Use type `scm_i_jmp_buf' instead of `jmp_buf'. (scm_c_catch): Use `SCM_I_SETJMP' instead of `setjmp'. (scm_ithrow): Use `SCM_I_LONGJMP' instead of `longjmp'.
This commit is contained in:
parent
40c9875d7c
commit
e4d87bf9fd
6 changed files with 26 additions and 17 deletions
|
@ -409,19 +409,28 @@
|
|||
typedef struct {
|
||||
ucontext_t ctx;
|
||||
int fresh;
|
||||
} jmp_buf;
|
||||
# define setjmp(JB) \
|
||||
} scm_i_jmp_buf;
|
||||
# define SCM_I_SETJMP(JB) \
|
||||
( (JB).fresh = 1, \
|
||||
getcontext (&((JB).ctx)), \
|
||||
((JB).fresh ? ((JB).fresh = 0, 0) : 1) )
|
||||
# define longjmp(JB,VAL) scm_ia64_longjmp (&(JB), VAL)
|
||||
void scm_ia64_longjmp (jmp_buf *, int);
|
||||
# define SCM_I_LONGJMP(JB,VAL) scm_ia64_longjmp (&(JB), VAL)
|
||||
void scm_ia64_longjmp (scm_i_jmp_buf *, int);
|
||||
# else /* ndef __ia64__ */
|
||||
# include <setjmp.h>
|
||||
# endif /* ndef __ia64__ */
|
||||
# endif /* ndef _CRAY1 */
|
||||
#endif /* ndef vms */
|
||||
|
||||
/* For any platform where SCM_I_SETJMP hasn't been defined in some
|
||||
special way above, map SCM_I_SETJMP, SCM_I_LONGJMP and
|
||||
scm_i_jmp_buf to setjmp, longjmp and jmp_buf. */
|
||||
#ifndef SCM_I_SETJMP
|
||||
#define scm_i_jmp_buf jmp_buf
|
||||
#define SCM_I_SETJMP setjmp
|
||||
#define SCM_I_LONGJMP longjmp
|
||||
#endif
|
||||
|
||||
/* James Clark came up with this neat one instruction fix for
|
||||
* continuations on the SPARC. It flushes the register windows so
|
||||
* that all the state of the process is contained in the stack.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue