[commit: ghc] master: Fix printf formats for pathchar on Windows (where it's wchar_t, not char) (356f793)

git at git.haskell.org git at git.haskell.org
Wed Sep 4 12:37:50 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/356f793917439c37c140e3e76963e2f0e391dc64/ghc

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

commit 356f793917439c37c140e3e76963e2f0e391dc64
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Wed Sep 4 11:00:12 2013 +0100

    Fix printf formats for pathchar on Windows (where it's wchar_t, not char)


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

356f793917439c37c140e3e76963e2f0e391dc64
 includes/rts/Linker.h |    2 ++
 rts/CheckUnload.c     |    8 ++++----
 rts/Linker.c          |    2 --
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/includes/rts/Linker.h b/includes/rts/Linker.h
index e900e85..28f0a0e 100644
--- a/includes/rts/Linker.h
+++ b/includes/rts/Linker.h
@@ -16,8 +16,10 @@
 
 #if defined(mingw32_HOST_OS)
 typedef wchar_t pathchar;
+#define PATH_FMT "ls"
 #else
 typedef char    pathchar;
+#define PATH_FMT "s"
 #endif
 
 /* initialize the object linker */
diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c
index a758b06..0485ed4 100644
--- a/rts/CheckUnload.c
+++ b/rts/CheckUnload.c
@@ -254,7 +254,7 @@ void checkUnload (StgClosure *static_objects)
 
   // Mark every unloadable object as unreferenced initially
   for (oc = unloaded_objects; oc; oc = oc->next) {
-      IF_DEBUG(linker, debugBelch("Checking whether to unload %s\n",
+      IF_DEBUG(linker, debugBelch("Checking whether to unload %" PATH_FMT "\n",
                                   oc->fileName));
       oc->referenced = rtsFalse;
   }
@@ -290,12 +290,12 @@ void checkUnload (StgClosure *static_objects)
           } else {
               prev->next = oc->next;
           }
-          IF_DEBUG(linker, debugBelch("Unloading object file %s\n",
+          IF_DEBUG(linker, debugBelch("Unloading object file %" PATH_FMT "\n",
                                       oc->fileName));
           freeObjectCode(oc);
       } else {
-          IF_DEBUG(linker, debugBelch("Object file still in use: %s\n",
-                                      oc->fileName));
+          IF_DEBUG(linker, debugBelch("Object file still in use: %"
+                                      PATH_FMT "\n", oc->fileName));
       }
   }
 
diff --git a/rts/Linker.c b/rts/Linker.c
index 6490242..c8451b0 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -169,7 +169,6 @@ static ObjectCode* mkOc( pathchar *path, char *image, int imageSize,
 #define struct_stat struct _stat
 #define open wopen
 #define WSTR(s) L##s
-#define PATH_FMT "S"
 #else
 #define pathcmp strcmp
 #define pathlen strlen
@@ -177,7 +176,6 @@ static ObjectCode* mkOc( pathchar *path, char *image, int imageSize,
 #define pathstat stat
 #define struct_stat struct stat
 #define WSTR(s) s
-#define PATH_FMT "s"
 #endif
 
 static pathchar* pathdup(pathchar *path)





More information about the ghc-commits mailing list