The stack base problem on Mac OS X can easily be fixed by using the preprocessor macros __APPLE__ and __MACH__ instead of the macro macosx, which is not defined by GCC on Mac OS X.

Hans Boehm's garbage collector now also uses __APPLE__ and __MACH__ and Apple's documentation says "To define a section of code to be compiled on Mac OS X system you should define a section using __APPLE__ with __MACH__ macros.". See http://developer.apple.com/technotes/tn2002/tn2071.html#Section10 for details.

The attached patch updates the preprocessor directives in gc_os_dep.c. The patch also separates the definition of the variable result in scm_get_stack_base() from the variable initialisation. If the definition and the initialisation are not separated GCC 3.3 complains about an unused variable on Mac OS X and HP-UX.

Index: gc_os_dep.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/gc_os_dep.c,v
retrieving revision 1.22
diff -u -r1.22 gc_os_dep.c
--- gc_os_dep.c 13 Nov 2003 18:19:02 -0000      1.22
+++ gc_os_dep.c 24 May 2004 11:59:22 -0000
@@ -266,7 +266,8 @@
 #   define MACOS
 #   define mach_type_known
 # endif
-# if defined(macosx)
+# if defined(macosx) || \
+     defined(__APPLE__) && defined(__MACH__) && defined(__ppc__)
 #    define MACOSX
 #    define POWERPC
 #    define mach_type_known
@@ -1878,7 +1879,9 @@
 void *scm_get_stack_base()
 {
     word dummy;
-    void *result = &dummy;  /* initialize to silence compiler */
+    void *result;
+   
+    result = &dummy;  /* initialize to silence compiler */
 
 #   define STACKBOTTOM_ALIGNMENT_M1 ((word)STACK_GRAN - 1)
 
_______________________________________________
Bug-guile mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-guile

Reply via email to