[m-rev.] for review: Fix compilation warning with 32-bit MinGW.

Peter Wang novalazy at gmail.com
Thu Oct 6 15:57:39 AEDT 2022


I got this warning when cross-compiling for Windows/x86 with
i686-w64-mingw32-gcc version 11.1.0:

    format '%d' expects argument of type 'int', but argument 3 has type 'MR_int_least64_t'

library/float.m:
    Use MR_INT_LEAST64_LENGTH_MODIFIER in float64_bits_string
    except when compiling with MSVC.

diff --git a/library/float.m b/library/float.m
index 5b65ed142..3ca6e56fe 100644
--- a/library/float.m
+++ b/library/float.m
@@ -1212,12 +1212,10 @@ float_to_doc(X) = str(string.float_to_string(X)).
         char buf[64];
 
         u.f = (double) Flt;
-        #if defined(MR_MINGW64) || defined(MR_CYGWIN32)
-            sprintf(buf, ""%lld"", u.i);
-        #elif defined(MR_WIN32)
+        #if defined(MR_MSVC)
             // The I64 size prefix is specific to the Microsoft C library
-            // -- we use it here since MSVC and (some) versions of 32-bit
-            // MinGW GCC do not support the standard ll size prefix.
+            // -- we use it here since MSVC does not support the standard
+            // ll size prefix.
             sprintf(buf, ""%I64d"", u.i);
         #else
             sprintf(buf, ""%"" MR_INT_LEAST64_LENGTH_MODIFIER ""d"", u.i);
-- 
2.38.0



More information about the reviews mailing list