* libc/include/machine/setjmp.h (sigsetjmp): Use GCC extension to

evaluate first parameter only once.
	(siglongjmp): Ditto.
This commit is contained in:
Corinna Vinschen 2005-03-18 09:46:30 +00:00
parent dd801fdabd
commit 5c9b5ac72d
2 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2005-03-18 Corinna Vinschen <corinna@vinschen.de>
* libc/include/machine/setjmp.h (sigsetjmp): Use GCC extension to
evaluate first parameter only once.
(siglongjmp): Ditto.
2005-03-17 Jeff Johnston <jjohnstn@redhat.com> 2005-03-17 Jeff Johnston <jjohnstn@redhat.com>
* configure.in: Add new check to see if compiler supports * configure.in: Add new check to see if compiler supports

View File

@ -236,6 +236,27 @@ typedef int sigjmp_buf[_JBLEN+2];
# define _CYGWIN_WORKING_SIGSETJMP # define _CYGWIN_WORKING_SIGSETJMP
#endif #endif
#if defined(__GNUC__)
#define sigsetjmp(env, savemask) \
({ \
sigjmp_buf *_sjbuf = &(env); \
((*_sjbuf)[_SAVEMASK] = savemask,\
sigprocmask (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
setjmp (*_sjbuf)); \
})
#define siglongjmp(env, val) \
({ \
sigjmp_buf *_sjbuf = &(env); \
((((*_sjbuf)[_SAVEMASK]) ? \
sigprocmask (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
: 0), \
longjmp (*_sjbuf, val)); \
})
#else /* !__GNUC__ */
#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\ #define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
sigprocmask (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\ sigprocmask (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
setjmp (env)) setjmp (env))
@ -244,6 +265,8 @@ typedef int sigjmp_buf[_JBLEN+2];
sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\ sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
longjmp (env, val)) longjmp (env, val))
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif