[project @ 2002-12-12 15:17:52 by simonmar]
authorsimonmar <unknown>
Thu, 12 Dec 2002 15:17:53 +0000 (15:17 +0000)
committersimonmar <unknown>
Thu, 12 Dec 2002 15:17:53 +0000 (15:17 +0000)
Fix some issues with hschooks.c, and hopefully clear up (or at least
document) the mess regarding which versions of Rts.h and RtsFlags.h
are included.

ghc/compiler/Makefile
ghc/compiler/parser/hschooks.c

index f3142b2..ee0473c 100644 (file)
@@ -294,7 +294,11 @@ HS_OBJS     += $(C_OBJS)
 # Big Fudge to get around inherent problem that Makefile setup
 # has got with 'mkdependC'.
 # 
-SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt) -I$(GHC_INCLUDE_DIR)
+SRC_MKDEPENDC_OPTS += -D__GLASGOW_HASKELL__=$(ProjectVersionInt)
+
+# XXX not really correct, hschooks.c actually gets include files like
+# RtsFlags.c from the installed GHC, but we can't tell mkdependC about that.
+SRC_MKDEPENDC_OPTS += -I$(GHC_INCLUDE_DIR)
 
 # -----------------------------------------------------------------------------
 #              Haskell compilations
@@ -328,7 +332,7 @@ SRC_HC_OPTS += -package concurrent -package util
 endif
 endif
 
-SRC_CC_OPTS += -Iparser -I. -I$(GHC_INCLUDE_DIR) -O
+SRC_CC_OPTS += -Iparser -I. -O
 SRC_HC_OPTS += -recomp $(GhcHcOpts) $(GhcStage$(stage)HcOpts)
 SRC_HC_OPTS += -H16M
 
index d3836fe..adc985b 100644 (file)
@@ -6,51 +6,37 @@ in instead of the defaults.
 
 #include <string.h>
 
-#if __GLASGOW_HASKELL__ >= 400
-#include "../rts/Rts.h"
-#else
-#include "rtsdefs.h"
-#endif
-
-#if __GLASGOW_HASKELL__ >= 505
-#include "../rts/Rts.h"
+/* For GHC 4.08, we are relying on the fact that RtsFlags has
+ * compatibile layout with the current version, because we're
+ * #including the current version of RtsFlags.h below.  4.08 didn't
+ * ship with its own RtsFlags.h, unfortunately.   For later GHC
+ * versions, we #include the correct RtsFlags.h.
+ */
+#if __GLASGOW_HASKELL__ < 502
+#include "../includes/Rts.h"
 #include "../includes/RtsFlags.h"
 #else
 #include "Rts.h"
 #include "RtsFlags.h"
 #endif
 
-#if __GLASGOW_HASKELL__ >= 502
-#include "RtsFlags.h"
-#endif
-
-#if __GLASGOW_HASKELL__ >= 408
 #include "HsFFI.h"
-#endif
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
-#if __GLASGOW_HASKELL__ >= 504
-
-char *ghc_rts_opts = "-H8m -K8m";
-
-#else
-
 void
 defaultsHook (void)
 {
-#if __GLASGOW_HASKELL__ >= 408
     RtsFlags.GcFlags.heapSizeSuggestion = 6*1024*1024 / BLOCK_SIZE;
     RtsFlags.GcFlags.maxStkSize         = 8*1024*1024 / sizeof(W_);
-#endif
 #if __GLASGOW_HASKELL__ >= 411
+    /* GHC < 4.11 didn't have these */
     RtsFlags.GcFlags.giveStats = COLLECT_GC_STATS;
     RtsFlags.GcFlags.statsFile = stderr;
 #endif
 }
-#endif
 
 void
 enableTimingStats( void )      /* called from the driver */
@@ -64,13 +50,11 @@ enableTimingStats( void )   /* called from the driver */
 void
 setHeapSize( HsInt size )
 {
-#if __GLASGOW_HASKELL__ >= 408
     RtsFlags.GcFlags.heapSizeSuggestion = size / BLOCK_SIZE;
     if (RtsFlags.GcFlags.maxHeapSize != 0 &&
        RtsFlags.GcFlags.heapSizeSuggestion > RtsFlags.GcFlags.maxHeapSize) {
        RtsFlags.GcFlags.maxHeapSize = RtsFlags.GcFlags.heapSizeSuggestion;
     }
-#endif
 }
 
 void