diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-03-18 09:46:30 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-03-18 09:46:30 +0000 |
commit | 5c9b5ac72d1a7d8326f234d5a2fb6ca5be1070e6 (patch) | |
tree | d610e2324e311de068a7f52413b111d2097611e5 /newlib | |
parent | dd801fdabd7e6d80e69cbde473b723a6ef7cff86 (diff) | |
download | newlib-5c9b5ac72d1a7d8326f234d5a2fb6ca5be1070e6.zip newlib-5c9b5ac72d1a7d8326f234d5a2fb6ca5be1070e6.tar.gz newlib-5c9b5ac72d1a7d8326f234d5a2fb6ca5be1070e6.tar.bz2 |
* libc/include/machine/setjmp.h (sigsetjmp): Use GCC extension to
evaluate first parameter only once.
(siglongjmp): Ditto.
Diffstat (limited to 'newlib')
-rw-r--r-- | newlib/ChangeLog | 6 | ||||
-rw-r--r-- | newlib/libc/include/machine/setjmp.h | 23 |
2 files changed, 29 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 34986d3..20db001 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -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> * configure.in: Add new check to see if compiler supports diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h index 7a61fcf..fe05ee1 100644 --- a/newlib/libc/include/machine/setjmp.h +++ b/newlib/libc/include/machine/setjmp.h @@ -236,6 +236,27 @@ typedef int sigjmp_buf[_JBLEN+2]; # define _CYGWIN_WORKING_SIGSETJMP #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,\ sigprocmask (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\ setjmp (env)) @@ -244,6 +265,8 @@ typedef int sigjmp_buf[_JBLEN+2]; sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\ longjmp (env, val)) +#endif + #ifdef __cplusplus } #endif |