diff options
author | Simon Marlow <simonmar@microsoft.com> | 2006-06-08 14:34:38 +0000 |
---|---|---|
committer | Simon Marlow <simonmar@microsoft.com> | 2006-06-08 14:34:38 +0000 |
commit | 1046d33458f1f4a12c119dcf07fad9eaaa2a37f9 (patch) | |
tree | 755a571fee7f3f12ce94ce995aa461648bbbc375 /includes | |
parent | a9e6c4411ab70eb2d16aba32c96ee963d86ebdae (diff) | |
download | haskell-1046d33458f1f4a12c119dcf07fad9eaaa2a37f9.tar.gz |
Make it so that StgWord/StgInt are longs
This means we can use a %ld format specifier for StgWord/StgInt with
printf and not get shouted at by gcc.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/StgTypes.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/includes/StgTypes.h b/includes/StgTypes.h index ac2f78e27c..7f2c08e5e2 100644 --- a/includes/StgTypes.h +++ b/includes/StgTypes.h @@ -48,11 +48,14 @@ typedef unsigned char StgWord8; typedef signed short StgInt16; typedef unsigned short StgWord16; -#if SIZEOF_UNSIGNED_INT == 4 +#if SIZEOF_LONG == 4 +typedef signed long StgInt32; +typedef unsigned long StgWord32; +#elif SIZEOF_INT == 4 typedef signed int StgInt32; typedef unsigned int StgWord32; #else -#error GHC untested on this architecture: sizeof(unsigned int) != 4 +#error GHC untested on this architecture: sizeof(int) != 4 #endif #ifdef SUPPORT_LONG_LONGS @@ -77,6 +80,12 @@ typedef unsigned __int64 StgWord64; /* * Define the standard word size we'll use on this machine: make it * big enough to hold a pointer. + * + * It's useful if StgInt/StgWord are always the same as long, so that + * we can use a consistent printf format specifier without warnings on + * any platform. Fortunately this works at the moement; if it breaks + * in the future we'll have to start using macros for format + * specifiers (c.f. FMT_StgWord64 in Rts.h). */ #if SIZEOF_VOID_P == 8 |