Commit 5a3fdc0c authored by Ian Lynagh's avatar Ian Lynagh

Fix build on Win32, and handle the FMT_* #defines in a slightly nicer way

parent d7b57949
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment