Fix mach_dep.c to include sys/ucontext.h on Mac OS X 10.6.
authorIvan Maidanski <ivmai@mail.ru>
Thu, 15 Sep 2011 15:38:30 +0000 (19:38 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 15 Sep 2011 15:38:30 +0000 (19:38 +0400)
* include/private/gc_priv.h (DARWIN): Include AvailabilityMacros.h
(unless MAC_OS_X_VERSION_MAX_ALLOWED already defined).
* mach_dep.c (GC_with_callee_saves_pushed): Include sys/ucontext.h
(instead of ucontext.h) if Mac OS X 10.6 or higher.

include/private/gc_priv.h
mach_dep.c

index b11b4ff..8e78cb8 100644 (file)
@@ -498,6 +498,10 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc;
 #endif
 
 #if defined(DARWIN)
+# ifndef MAC_OS_X_VERSION_MAX_ALLOWED
+#   include <AvailabilityMacros.h>
+                /* Include this header just to import the above macro.  */
+# endif
 # if defined(POWERPC)
 #   if CPP_WORDSZ == 32
 #     define GC_THREAD_STATE_T          ppc_thread_state_t
index 35497aa..7b038dc 100644 (file)
@@ -174,7 +174,12 @@ asm static void PushMacRegisters()
 #if !defined(HAVE_PUSH_REGS) && defined(UNIX_LIKE)
 # include <signal.h>
 # ifndef NO_GETCONTEXT
-#   include <ucontext.h>
+#   if defined(DARWIN) \
+       && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 /*MAC_OS_X_VERSION_10_6*/)
+#     include <sys/ucontext.h>
+#   else
+#     include <ucontext.h>
+#   endif /* !DARWIN */
 #   ifdef GETCONTEXT_FPU_EXCMASK_BUG
 #     include <fenv.h>
 #   endif