More windows woe

Jost Berthold berthold at
Tue Sep 3 21:56:03 CEST 2013

> From: Simon Peyton-Jones <simonpj at>
> To: "Edward Z. Yang" <ezyang at MIT.EDU>, Simon Marlow
> 	<marlowsd at>
> Cc: "ghc-devs at" <ghc-devs at>
> Subject: RE: More windows woe
> Message-ID:
> 	<59543203684B2244980D7E4057D5FBC1485BB7AB at>
> Content-Type: text/plain; charset="utf-8"
> Simon Marlow: please help!
> At the moment windows builds are hosed, which is a Bad Situation.
> Actually it turns out that what want is
>    debugBelch("Checking whether to unload %S\n", oc->fileName));
> That is, use "%S" rather than "%s" as format specifier for wide chars.
> Sadly, this works on Windows, but not on Linux:
> rts/CheckUnload.c:260:13:
>       error: format ?%S? expects argument of type ?wchar_t *?, but argument 2 has type ?pathchar *? [-Werror=format]
> So what I need guidance on, please!, is what the approved way to deal with this is.  I suppose that I could identify each use of %s on a filepath and say
> #ifdef mingw32_HOST_OS
>    debugBelch("Checking whether to unload %S\n", oc->fileName));
> #else
>    debugBelch("Checking whether to unload %s\n", oc->fileName));
> #endif
> But that seems deeply unsatisfactory doesn't it?
> If not that, then what?
> Simon

Similar code is in place to distinguish between 32-bit and 64-bit StgWords:

 > grep -r -e FMT_Word includes/
includes/stg/Types.h:#define FMT_Word32    "u"
includes/stg/Types.h:#define FMT_Word32    "lu"
includes/stg/Types.h:#define FMT_Word64    "lu"
includes/stg/Types.h:#define FMT_Word64    "llu"
includes/stg/Types.h:#define FMT_Word     FMT_Word64
includes/stg/Types.h:#define FMT_Word     FMT_Word32

and format strings like "blabla " FMT_Word " ..blabla" are used inside 
rts/. One could do the same for FMT_Path and introduce it where required.

Maybe this would be acceptable?

/ Jost

More information about the ghc-devs mailing list