[m-rev.] diff: fix a portability issue with 64-bit Cygwin

Julien Fischer jfischer at opturion.com
Tue Oct 13 15:33:43 AEDT 2015


Fix a portability issue with 64-bit Cygwin.

library/float.m:
     MR_in_least64_t is a long on 64-bit Cygwin systems.

runtime/mercury_conf_param.h:
     Define macros that allow us to distinguish between 32-
     and 64-bit Cygwin.

Julien.

diff --git a/library/float.m b/library/float.m
index 7ff1262..1f89881 100644
--- a/library/float.m
+++ b/library/float.m
@@ -1031,7 +1031,7 @@ float.float_to_doc(X) = str(string.float_to_string(X)).
          char buf[64];

          u.f = (double) Flt;
-        #if defined(MR_MINGW64) || defined(MR_CYGWIN)
+        #if defined(MR_MINGW64) || defined(MR_CYGWIN32)
              sprintf(buf, ""%lld"", u.i);
          #elif defined(MR_WIN32)
              /*
diff --git a/runtime/mercury_conf_param.h b/runtime/mercury_conf_param.h
index 495619e..76092ac 100644
--- a/runtime/mercury_conf_param.h
+++ b/runtime/mercury_conf_param.h
@@ -101,6 +101,11 @@

  #if defined(__CYGWIN__)
    #define MR_CYGWIN
+  #if defined(__LP64__)
+     #define MR_CYGWIN64
+  #else
+     #define MR_CYGWIN32
+  #endif
  #endif

  /*---------------------------------------------------------------------------*/



More information about the reviews mailing list