summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coro.c16
-rw-r--r--coro.h3
2 files changed, 11 insertions, 8 deletions
diff --git a/coro.c b/coro.c
index d02c4db..c95de5e 100644
--- a/coro.c
+++ b/coro.c
@@ -81,13 +81,7 @@ coro_init (void)
coro_transfer ((coro_context *)new_coro, (coro_context *)create_coro);
-#if HAVE_CFI
- asm (".cfi_startproc");
-#endif
func ((void *)arg);
-#if HAVE_CFI
- asm (".cfi_endproc");
-#endif
/* the new coro returned. bad. just abort() for now */
abort ();
@@ -102,7 +96,15 @@ static void
trampoline (int sig)
{
if (setjmp (((coro_context *)new_coro)->env))
- coro_init (); /* start it */
+ {
+#if HAVE_CFI
+ asm (".cfi_startproc");
+#endif
+ coro_init (); /* start it */
+#if HAVE_CFI
+ asm (".cfi_endproc");
+#endif
+ }
else
trampoline_count++;
}
diff --git a/coro.h b/coro.h
index 0293293..993dab6 100644
--- a/coro.h
+++ b/coro.h
@@ -40,6 +40,7 @@
* Reported by Michael_G_Schwern.
* 2006-11-26 Use _setjmp instead of setjmp on GNU/Linux.
* 2007-04-27 Set unwind frame info if gcc 3+ and ELF is detected.
+ * Use _setjmp instead of setjmp on _XOPEN_SOURCE >= 600.
*/
#ifndef CORO_H
@@ -174,7 +175,7 @@ struct coro_context {
jmp_buf env;
};
-#if CORO_LINUX
+#if CORO_LINUX || (_XOPEN_SOURCE >= 600)
# define coro_transfer(p,n) do { if (!_setjmp ((p)->env)) _longjmp ((n)->env, 1); } while (0)
#else
# define coro_transfer(p,n) do { if (!setjmp ((p)->env)) longjmp ((n)->env, 1); } while (0)