[PATCH 2/2] include: Fix prototypes of long-double msvcrt functions.

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

These must use 'double' on Winelib, and 'long double' elsewhere. The
latter avoids warnings from Clang about 'strtold(3)' having the wrong

Signed-off-by: Chip Davis <cdavis at codeweavers.com>
 include/msvcrt/corecrt.h | 10 ++++++++++
 include/msvcrt/stdlib.h  |  6 +++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h
index 10e60d564c3..311d2cb8270 100644
--- a/include/msvcrt/corecrt.h
+++ b/include/msvcrt/corecrt.h
@@ -151,6 +151,16 @@ typedef unsigned long __msvcrt_ulong;
+/* we need 64-bit long doubles even on Unix */
+#ifdef __WINESRC__
+typedef double __msvcrt_ldouble;
+typedef long double __msvcrt_ldouble;
 #ifdef  _WIN64
 typedef __int64 intptr_t;
diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h
index 91fcc2a672d..86f7b695de8 100644
--- a/include/msvcrt/stdlib.h
+++ b/include/msvcrt/stdlib.h
@@ -152,7 +152,7 @@ int           __cdecl _atodbl_l(_CRT_DOUBLE*,char*,_locale_t);
 int           __cdecl _atoflt(_CRT_FLOAT*,char*);
 int           __cdecl _atoflt_l(_CRT_FLOAT*,char*,_locale_t);
 __int64       __cdecl _atoi64(const char*);
-long double   __cdecl _atold(const char*);
+__msvcrt_ldouble __cdecl _atold(const char*);
 int           __cdecl _atoldbl(_LDOUBLE*,char*);
 void          __cdecl _beep(unsigned int,unsigned int);
 char*         __cdecl _ecvt(double,int,int*,int*);
@@ -180,7 +180,7 @@ int           __cdecl _set_error_mode(int);
 void          __cdecl _seterrormode(int);
 void          __cdecl _sleep(__msvcrt_ulong);
 void          __cdecl _splitpath(const char*,char*,char*,char*,char*);
-long double   __cdecl _strtold(const char*,char**);
+__msvcrt_ldouble __cdecl _strtold(const char*,char**);
 void          __cdecl _swab(char*,char*,int);
 char*         __cdecl _ui64toa(unsigned __int64,char*,int);
 errno_t       __cdecl _ui64toa_s(unsigned __int64,char*,size_t,int);
@@ -217,7 +217,7 @@ void*         __cdecl realloc(void*,size_t);
 void          __cdecl srand(unsigned int);
 float         __cdecl strtof(const char*,char**);
 double        __cdecl strtod(const char*,char**);
-double        __cdecl strtold(const char*,char**);
+__msvcrt_ldouble __cdecl strtold(const char*,char**);
 __msvcrt_long __cdecl strtol(const char*,char**,int);
 __msvcrt_ulong __cdecl strtoul(const char*,char**,int);
 __int64       __cdecl strtoll_l(const char*,char**,int,_locale_t);

More information about the wine-devel mailing list