[PATCH 1/2] include: Only define __msvcrt_long to int for LP64.

Chip Davis cdavis at codeweavers.com
Sun Nov 24 20:26:54 CST 2019

This is the only place that's needed. Everywhere else can use 'long'.
This avoids a bunch of warnings from Clang about common standard library
functions having the wrong prototypes.

Signed-off-by: Chip Davis <cdavis at codeweavers.com>
 include/msvcrt/corecrt.h | 5 +++++
 include/msvcrt/math.h    | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h
index c88d3e0570d..10e60d564c3 100644
--- a/include/msvcrt/corecrt.h
+++ b/include/msvcrt/corecrt.h
@@ -142,8 +142,13 @@
 /* we need 32-bit longs even on 64-bit */
+#ifdef __LP64__
 typedef int __msvcrt_long;
 typedef unsigned int __msvcrt_ulong;
+typedef long __msvcrt_long;
+typedef unsigned long __msvcrt_ulong;
diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h
index 76601de853a..68b6922458f 100644
--- a/include/msvcrt/math.h
+++ b/include/msvcrt/math.h
@@ -96,10 +96,10 @@ float __cdecl rintf(float);
 float __cdecl roundf(float);
 float __cdecl truncf(float);
-long __cdecl lrint(double);
-long __cdecl lrintf(float);
-long __cdecl lround(double);
-long __cdecl lroundf(float);
+__msvcrt_long __cdecl lrint(double);
+__msvcrt_long __cdecl lrintf(float);
+__msvcrt_long __cdecl lround(double);
+__msvcrt_long __cdecl lroundf(float);
 double __cdecl _copysign (double, double);
 double __cdecl _chgsign (double);

More information about the wine-devel mailing list