[m-rev.] diff: make hlc runtime compile cleanly with MinGW64

Julien Fischer jfischer at opturion.com
Mon Mar 25 12:15:40 AEDT 2013


Avoid warnings in high-level C runtime with MinGW64.

runtime/mercury_conf_param.h:
    On MinGW64, define the macro __USE_MINGW_ANSI_STDIO.
    This avoids problems with incomplete (i.e. broken) support
    for long long format specifiers in formatted I/O functions
    in Microsoft's C library.

Julien.

diff --git a/runtime/mercury_conf_param.h b/runtime/mercury_conf_param.h
index 19437de..2ee6e85 100644
--- a/runtime/mercury_conf_param.h
+++ b/runtime/mercury_conf_param.h
@@ -71,6 +71,15 @@
    #define MR_MINGW
 #endif

+/*
+** On x86_64-w64-mingw32, we need to define the macro __USE_MINGW_ANSI_STDIO
+** in order to ensure that we get versions of printf, sprintf and friends
+** that work properly with long long format specifiers.
+*/
+#if defined(__MINGW64__) && !defined(__USE_MINGW_ANSI_STDIO)
+   #define __USE_MINGW_ANSI_STDIO 1
+#endif
+
 /*---------------------------------------------------------------------------*/

 /*



More information about the reviews mailing list