[commit: ghc] master: Use intptr_t for offset values in mkDerivedConstants (3f39164)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/3f39164534af07ddd49d7bd2a1c0e1b171903ce3

>---------------------------------------------------------------

commit 3f39164534af07ddd49d7bd2a1c0e1b171903ce3
Author: Ian Lynagh <[email protected]>
Date:   Thu Sep 13 23:31:19 2012 +0100

    Use intptr_t for offset values in mkDerivedConstants
    
    This means that we get e.g.
        pc_OFFSET_stgEagerBlackholeInfo = -24
    rather than
        pc_OFFSET_stgEagerBlackholeInfo = 18446744073709551592

>---------------------------------------------------------------

 includes/mkDerivedConstants.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c
index 9840446..e014d15 100644
--- a/includes/mkDerivedConstants.c
+++ b/includes/mkDerivedConstants.c
@@ -26,6 +26,7 @@
 #include "Stable.h"
 #include "Capability.h"
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -45,7 +46,7 @@ enum Mode { Gen_Haskell_Type, Gen_Haskell_Value, Gen_Haskell_Wrappers, Gen_Haske
         printf("    , pc_OFFSET_" str " :: Int\n");                         \
         break;                                                              \
     case Gen_Haskell_Value:                                                 \
-        printf("    , pc_OFFSET_" str " = %" FMT_SizeT "\n", (size_t)offset); \
+        printf("    , pc_OFFSET_" str " = %" PRIdPTR "\n", (intptr_t)offset); \
         break;                                                              \
     case Gen_Haskell_Wrappers:                                              \
         printf("oFFSET_" str " :: DynFlags -> Int\n");                      \
@@ -55,7 +56,7 @@ enum Mode { Gen_Haskell_Type, Gen_Haskell_Value, Gen_Haskell_Wrappers, Gen_Haske
         printf("    oFFSET_" str ",\n");                                    \
         break;                                                              \
     case Gen_Header:                                                        \
-        printf("#define OFFSET_" str " %" FMT_SizeT "\n", (size_t)offset);  \
+        printf("#define OFFSET_" str " %" PRIdPTR "\n", (intptr_t)offset);  \
         break;                                                              \
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.