Fix warnings in the RTS
authorIan Lynagh <igloo@earth.li>
Tue, 25 Mar 2008 16:03:14 +0000 (16:03 +0000)
committerIan Lynagh <igloo@earth.li>
Tue, 25 Mar 2008 16:03:14 +0000 (16:03 +0000)
For some reason this causes build failures for me in my 32-bit chroot,

includes/Cmm.h
includes/Storage.h
rts/sm/Storage.c

index 715d2b2..d47e6fd 100644 (file)
 #define BITMAP_BITS(bitmap) ((bitmap) >> BITMAP_BITS_SHIFT)
 
 /* Debugging macros */
-#define LOOKS_LIKE_INFO_PTR(p)                         \
-   ((p) != NULL &&                                     \
-     (TO_W_(%INFO_TYPE(%STD_INFO(p))) != INVALID_OBJECT) &&    \
+#define LOOKS_LIKE_INFO_PTR(p)                                  \
+   ((p) != NULL &&                                              \
+    LOOKS_LIKE_INFO_PTR_NOT_NULL(p))
+
+#define LOOKS_LIKE_INFO_PTR_NOT_NULL(p)                         \
+   ( (TO_W_(%INFO_TYPE(%STD_INFO(p))) != INVALID_OBJECT) &&     \
      (TO_W_(%INFO_TYPE(%STD_INFO(p))) <  N_CLOSURE_TYPES))
 
 #define LOOKS_LIKE_CLOSURE_PTR(p) (LOOKS_LIKE_INFO_PTR(GET_INFO(UNTAG(p))))
index 9257bcd..238b858 100644 (file)
@@ -304,7 +304,10 @@ void dirty_MUT_VAR(StgRegTable *reg, StgClosure *p);
    -------------------------------------------------------------------------- */
 
 #define LOOKS_LIKE_INFO_PTR(p) \
-   (p && ((StgInfoTable *)(INFO_PTR_TO_STRUCT(p)))->type != INVALID_OBJECT && \
+   (p && LOOKS_LIKE_INFO_PTR_NOT_NULL(p))
+
+#define LOOKS_LIKE_INFO_PTR_NOT_NULL(p) \
+   (((StgInfoTable *)(INFO_PTR_TO_STRUCT(p)))->type != INVALID_OBJECT && \
     ((StgInfoTable *)(INFO_PTR_TO_STRUCT(p)))->type < N_CLOSURE_TYPES)
 
 #define LOOKS_LIKE_CLOSURE_PTR(p) \
index 68dfb19..3ede82d 100644 (file)
@@ -116,7 +116,8 @@ initStorage( void )
   /* Sanity check to make sure the LOOKS_LIKE_ macros appear to be
    * doing something reasonable.
    */
-  ASSERT(LOOKS_LIKE_INFO_PTR(&stg_BLACKHOLE_info));
+  /* We use the NOT_NULL variant or gcc warns that the test is always true */
+  ASSERT(LOOKS_LIKE_INFO_PTR_NOT_NULL(&stg_BLACKHOLE_info));
   ASSERT(LOOKS_LIKE_CLOSURE_PTR(&stg_dummy_ret_closure));
   ASSERT(!HEAP_ALLOCED(&stg_dummy_ret_closure));