diff options
author | Ian Lynagh <igloo@earth.li> | 2012-04-27 01:27:48 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-04-27 01:27:48 +0100 |
commit | 5a3fdc0ce364a26362f6aee5ce6075eb10e8f811 (patch) | |
tree | a4c62c24a803ffd3264cf60a994a71fcf8d63320 /includes | |
parent | d7b57949f3a9e42751f60fd09ddebd299b8762e7 (diff) | |
download | haskell-5a3fdc0ce364a26362f6aee5ce6075eb10e8f811.tar.gz |
Fix build on Win32, and handle the FMT_* #defines in a slightly nicer way
Diffstat (limited to 'includes')
-rw-r--r-- | includes/Rts.h | 13 | ||||
-rw-r--r-- | includes/stg/Types.h | 23 |
2 files changed, 16 insertions, 20 deletions
diff --git a/includes/Rts.h b/includes/Rts.h index e060e14915..501b9dcbfc 100644 --- a/includes/Rts.h +++ b/includes/Rts.h @@ -145,19 +145,6 @@ void _assertFail(const char *filename, unsigned int linenum) #define FMT_SizeT "zu" #define FMT_HexSizeT "zx" -#define FMT_Word "zu" -#define FMT_Int "zd" - -/* - * Getting printf formats right for platform-dependent typedefs - */ -#if SIZEOF_LONG == 8 -#define FMT_Word64 "lu" -#define FMT_Int64 "ld" -#else -#define FMT_Word64 "llu" -#define FMT_Int64 "lld" -#endif /* ----------------------------------------------------------------------------- Time values in the RTS diff --git a/includes/stg/Types.h b/includes/stg/Types.h index e05690ac6e..0c71ea4782 100644 --- a/includes/stg/Types.h +++ b/includes/stg/Types.h @@ -54,12 +54,16 @@ typedef unsigned char StgWord8; typedef signed short StgInt16; typedef unsigned short StgWord16; -#if SIZEOF_LONG == 4 -typedef signed long StgInt32; -typedef unsigned long StgWord32; -#elif SIZEOF_INT == 4 +#if SIZEOF_INT == 4 typedef signed int StgInt32; typedef unsigned int StgWord32; +#define FMT_Word32 "u" +#define FMT_Int32 "d" +#elif SIZEOF_LONG == 4 +typedef signed long StgInt32; +typedef unsigned long StgWord32; +#define FMT_Word32 "lu" +#define FMT_Int32 "ld" #else #error GHC untested on this architecture: sizeof(int) != 4 #endif @@ -67,12 +71,13 @@ typedef unsigned int StgWord32; #if SIZEOF_LONG == 8 typedef signed long StgInt64; typedef unsigned long StgWord64; -#elif defined(__MSVC__) -typedef __int64 StgInt64; -typedef unsigned __int64 StgWord64; +#define FMT_Word64 "lu" +#define FMT_Int64 "ld" #elif SIZEOF_LONG_LONG == 8 typedef signed long long int StgInt64; typedef unsigned long long int StgWord64; +#define FMT_Word64 "llu" +#define FMT_Int64 "lld" #else #error cannot find a way to define StgInt64 #endif @@ -93,12 +98,16 @@ typedef StgInt64 StgInt; typedef StgWord64 StgWord; typedef StgInt32 StgHalfInt; typedef StgWord32 StgHalfWord; +#define FMT_Word FMT_Word64 +#define FMT_Int FMT_Int64 #else #if SIZEOF_VOID_P == 4 typedef StgInt32 StgInt; typedef StgWord32 StgWord; typedef StgInt16 StgHalfInt; typedef StgWord16 StgHalfWord; +#define FMT_Word FMT_Word32 +#define FMT_Int FMT_Int32 #else #error GHC untested on this architecture: sizeof(void *) != 4 or 8 #endif |