[commit: ghc] wip/erikd/remove-nat: rts: Fix C compiler warnings on Windows (cb3f4e6)
git at git.haskell.org
git at git.haskell.org
Wed May 11 03:04:04 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/erikd/remove-nat
Link : http://ghc.haskell.org/trac/ghc/changeset/cb3f4e647ab1baf7e670d3ec4474d1ac74b45099/ghc
>---------------------------------------------------------------
commit cb3f4e647ab1baf7e670d3ec4474d1ac74b45099
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date: Wed May 11 11:05:40 2016 +1000
rts: Fix C compiler warnings on Windows
Specifcally we want the MinGW compiler to use ISO print format
specfifiers.
>---------------------------------------------------------------
cb3f4e647ab1baf7e670d3ec4474d1ac74b45099
includes/stg/Types.h | 5 +++++
rts/Linker.c | 6 +++---
rts/Trace.c | 16 +++++++++-------
3 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/includes/stg/Types.h b/includes/stg/Types.h
index 1a61c8b..0ad3c5c 100644
--- a/includes/stg/Types.h
+++ b/includes/stg/Types.h
@@ -21,6 +21,11 @@
#ifndef STGTYPES_H
#define STGTYPES_H
+#if defined(mingw32_HOST_OS)
+/* Inform mingw we want the ISO rather than Windows printf format specifiers. */
+#define __USE_MINGW_ANSI_STDIO 1
+#endif
+
/* ISO C 99 says:
* "C++ implementations should define these macros only when
* __STDC_LIMIT_MACROS is defined before <stdint.h> is included."
diff --git a/rts/Linker.c b/rts/Linker.c
index 981df25..109d17d 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -3799,9 +3799,9 @@ ocVerifyImage_PEi386 ( ObjectCode* oc )
IF_DEBUG(linker, i=1);
if (i == 0) return 1;
- debugBelch( "sectab offset = %" FMT_Int "\n", ((UChar*)sectab) - ((UChar*)hdr) );
- debugBelch( "symtab offset = %" FMT_Int "\n", ((UChar*)symtab) - ((UChar*)hdr) );
- debugBelch( "strtab offset = %" FMT_Int "\n", ((UChar*)strtab) - ((UChar*)hdr) );
+ debugBelch( "sectab offset = %" FMT_SizeT "\n", ((UChar*)sectab) - ((UChar*)hdr) );
+ debugBelch( "symtab offset = %" FMT_SizeT "\n", ((UChar*)symtab) - ((UChar*)hdr) );
+ debugBelch( "strtab offset = %" FMT_SizeT "\n", ((UChar*)strtab) - ((UChar*)hdr) );
debugBelch("\n" );
debugBelch( "Machine: 0x%x\n", (UInt32)(hdr->Machine) );
diff --git a/rts/Trace.c b/rts/Trace.c
index cf47e16..2e81487 100644
--- a/rts/Trace.c
+++ b/rts/Trace.c
@@ -6,6 +6,8 @@
*
* ---------------------------------------------------------------------------*/
+#include "PosixSource.h"
+
// external headers
#include "Rts.h"
@@ -424,18 +426,18 @@ void traceCapsetEvent (EventTypeNum tag,
tracePreface();
switch (tag) {
case EVENT_CAPSET_CREATE: // (capset, capset_type)
- debugBelch("created capset %" FMT_Word " of type %d\n", (W_)capset, (int)info);
+ debugBelch("created capset %" FMT_Word32 " of type %d\n", capset, (int)info);
break;
case EVENT_CAPSET_DELETE: // (capset)
- debugBelch("deleted capset %" FMT_Word "\n", (W_)capset);
+ debugBelch("deleted capset %" FMT_Word32 "\n", capset);
break;
case EVENT_CAPSET_ASSIGN_CAP: // (capset, capno)
- debugBelch("assigned cap %" FMT_Word " to capset %" FMT_Word "\n",
- (W_)info, (W_)capset);
+ debugBelch("assigned cap %" FMT_Word " to capset %" FMT_Word32 "\n",
+ info, capset);
break;
case EVENT_CAPSET_REMOVE_CAP: // (capset, capno)
- debugBelch("removed cap %" FMT_Word " from capset %" FMT_Word "\n",
- (W_)info, (W_)capset);
+ debugBelch("removed cap %" FMT_Word " from capset %" FMT_Word32 "\n",
+ info, capset);
break;
}
RELEASE_LOCK(&trace_utx);
@@ -738,7 +740,7 @@ void traceThreadLabel_(Capability *cap,
ACQUIRE_LOCK(&trace_utx);
tracePreface();
debugBelch("cap %d: thread %" FMT_Word " has label %s\n",
- cap->no, (W_)tso->id, label);
+ cap->no, tso->id, label);
RELEASE_LOCK(&trace_utx);
} else
#endif
More information about the ghc-commits
mailing list