summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2012-07-27 23:12:49 +0200
committerGabor Greif <ggreif@gmail.com>2012-07-29 21:31:56 +0200
commitab14d99b524cef7fe412e30f7607fc76da72563a (patch)
treed40220ef9c5e94cd05724f3b6df4e75e1f5a04d3
parentc7a7c49a81fa92bc46d04a9200be2afc5e4d1338 (diff)
downloadhaskell-ab14d99b524cef7fe412e30f7607fc76da72563a.tar.gz
GHCConstants.h should not contain preprocessor definitions
-rw-r--r--includes/mkDerivedConstants.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c
index 4042498c5d..3fcf12849f 100644
--- a/includes/mkDerivedConstants.c
+++ b/includes/mkDerivedConstants.c
@@ -79,8 +79,12 @@
field_offset_(str(s_type,field),s_type,field);
/* An access macro for use in C-- sources. */
+#if defined(GEN_HASKELL)
+#define struct_field_macro(str) /* nothing */
+#else
#define struct_field_macro(str) \
printf("#define " str "(__ptr__) REP_" str "[__ptr__+OFFSET_" str "]\n");
+#endif
/* Outputs the byte offset and MachRep for a field */
#define struct_field(s_type, field) \
@@ -125,8 +129,12 @@
closure_size(s_type)
/* An access macro for use in C-- sources. */
+#if defined(GEN_HASKELL)
+#define closure_field_macro(str) /* nothing */
+#else
#define closure_field_macro(str) \
printf("#define " str "(__ptr__) REP_" str "[__ptr__+SIZEOF_StgHeader+OFFSET_" str "]\n");
+#endif
#define closure_field_offset_(str, s_type,field) \
def_offset(str, OFFSET(s_type,field) - TYPE_SIZE(StgHeader));
@@ -134,8 +142,12 @@
#define closure_field_offset(s_type,field) \
closure_field_offset_(str(s_type,field),s_type,field)
+#if defined(GEN_HASKELL)
+#define closure_payload_macro(str) /* nothing */
+#else
#define closure_payload_macro(str) \
printf("#define " str "(__ptr__,__ix__) W_[__ptr__+SIZEOF_StgHeader+OFFSET_" str " + WDS(__ix__)]\n");
+#endif
#define closure_payload(s_type,field) \
closure_field_offset_(str(s_type,field),s_type,field); \
@@ -164,26 +176,39 @@
def_offset(str(s_type,field), OFFSET(s_type,field) - TYPE_SIZE(StgHeader) - TYPE_SIZE(StgTSOProfInfo));
/* Full byte offset for a TSO field, for use from Cmm */
+#if defined(GEN_HASKELL)
+#define tso_field_offset_macro(str) /* nothing */
+#else
#define tso_field_offset_macro(str) \
printf("#define TSO_OFFSET_" str " (SIZEOF_StgHeader+SIZEOF_OPT_StgTSOProfInfo+OFFSET_" str ")\n");
+#endif
#define tso_field_offset(s_type, field) \
tso_payload_offset(s_type, field); \
tso_field_offset_macro(str(s_type,field));
+#if defined(GEN_HASKELL)
+#define tso_field_macro(str) /* nothing */
+#else
#define tso_field_macro(str) \
printf("#define " str "(__ptr__) REP_" str "[__ptr__+TSO_OFFSET_" str "]\n")
+#endif
+
#define tso_field(s_type, field) \
field_type(s_type, field); \
tso_field_offset(s_type,field); \
tso_field_macro(str(s_type,field))
+#if defined(GEN_HASKELL)
+#define opt_struct_size(s_type, option) /* nothing */
+#else
#define opt_struct_size(s_type, option) \
printf("#ifdef " #option "\n"); \
printf("#define SIZEOF_OPT_" #s_type " SIZEOF_" #s_type "\n"); \
printf("#else\n"); \
printf("#define SIZEOF_OPT_" #s_type " 0\n"); \
printf("#endif\n\n");
+#endif
#define FUN_OFFSET(sym) (OFFSET(Capability,f.sym) - OFFSET(Capability,r))