[patch/rfa]: Add _setjmp/_longjmp macros
Corinna Vinschen
vinschen@redhat.com
Mon Jun 23 23:28:00 GMT 2008
On Jan 13 17:32, Corinna Vinschen wrote:
> Hi,
>
> SUSv3 defines a _setjmp/_longjmp pair of functions, which are equivalent
> to setjmp/longjmp, except that they shall never manipulate the signal
> mask:
>
> http://www.opengroup.org/onlinepubs/009695399/functions/_setjmp.html
>
> The below patch adds _setjmp and _longjmp as macros calling
> sigsetjmp/siglongjmp.
I applied the below additional patch as obvious. It defines both
interfaces as functions when building for Cygwin.
Corinna
* libc/include/machine/setjmp.h (_longjmp): Define as function on
Cygwin.
(_setjmp): Ditto.
Index: libc/include/machine/setjmp.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/machine/setjmp.h,v
retrieving revision 1.35
diff -u -p -r1.35 setjmp.h
--- libc/include/machine/setjmp.h 15 Jan 2008 09:41:06 -0000 1.35
+++ libc/include/machine/setjmp.h 21 Jun 2008 18:45:53 -0000
@@ -307,11 +307,16 @@ typedef int sigjmp_buf[_JBLEN+2];
#endif
-/* POSIX _setjmp/_longjmp macros, maintained for XSI compatibility. These
+/* POSIX _setjmp/_longjmp, maintained for XSI compatibility. These
are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
New applications should use sigsetjmp/siglongjmp instead. */
+#ifdef __CYGWIN__
+extern void _longjmp(jmp_buf, int);
+extern int _setjmp(jmp_buf);
+#else
#define _setjmp(env) sigsetjmp ((env), 0)
#define _longjmp(env, val) siglongjmp ((env), (val))
+#endif
#ifdef __cplusplus
}
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
More information about the Newlib
mailing list