From 68ed90d8b2f31f9bcae7b869413819eb8fa0aa40 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 25 Mar 2008 16:03:14 +0000 Subject: [PATCH] Fix warnings in the RTS For some reason this causes build failures for me in my 32-bit chroot, --- includes/Cmm.h | 9 ++++++--- includes/Storage.h | 5 ++++- rts/sm/Storage.c | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/includes/Cmm.h b/includes/Cmm.h index 715d2b2..d47e6fd 100644 --- a/includes/Cmm.h +++ b/includes/Cmm.h @@ -407,9 +407,12 @@ #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)))) diff --git a/includes/Storage.h b/includes/Storage.h index 9257bcd..238b858 100644 --- a/includes/Storage.h +++ b/includes/Storage.h @@ -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) \ diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index 68dfb19..3ede82d 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -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)); -- 1.7.10.4