A couple of build fixes for Win64
authorIan Lynagh <igloo@earth.li>
Tue, 24 Apr 2012 16:19:58 +0000 (17:19 +0100)
committerIan Lynagh <igloo@earth.li>
Tue, 24 Apr 2012 16:19:58 +0000 (17:19 +0100)
includes/Rts.h
rts/eventlog/EventLog.c

index c1f4f05..89efb15 100644 (file)
@@ -168,7 +168,7 @@ void _assertFail(const char *filename, unsigned int linenum)
 #define FMT_Word64 "lu"
 #define FMT_Int64  "ld"
 #else
-#if defined(mingw32_HOST_OS)
+#if defined(mingw32_HOST_OS) && defined(i386_HOST_ARCH)
 /* mingw doesn't understand %llu/%lld - it treats them as 32-bit
    rather than 64-bit */
 #define FMT_Word64 "I64u"
index a310377..66b589e 100644 (file)
@@ -237,7 +237,10 @@ initEventLogging(void)
         // Forked process, eventlog already started by the parent
         // before fork
         event_log_pid = getpid();
-        sprintf(event_log_filename, "%s.%d.eventlog", prog, event_log_pid);
+        // We don't have a FMT* symbol for pid_t, so we go via Word64
+        // to be sure of not losing range. It would be nicer to have a
+        // FMT* symbol or similar, though.
+        sprintf(event_log_filename, "%s.%" FMT_Word64 ".eventlog", prog, (StgWord64)event_log_pid);
     }
     stgFree(prog);