[PATCH v2 0/5] MR10129: include: Add more msvcrt declarations.
-- v2: include: Add fwide and mbsinit declarations. https://gitlab.winehq.org/wine/wine/-/merge_requests/10129
From: Jacek Caban <jacek@codeweavers.com> --- include/msvcrt/math.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h index 39d285eeb64..977f2a9a1e0 100644 --- a/include/msvcrt/math.h +++ b/include/msvcrt/math.h @@ -89,6 +89,7 @@ _ACRTIMP double __cdecl _y1(double); _ACRTIMP double __cdecl _yn(int, double); _ACRTIMP double __cdecl cbrt(double); +_ACRTIMP double __cdecl erfc(double); _ACRTIMP double __cdecl exp2(double); _ACRTIMP double __cdecl expm1(double); _ACRTIMP double __cdecl log1p(double); @@ -99,6 +100,7 @@ _ACRTIMP double __cdecl round(double); _ACRTIMP double __cdecl trunc(double); _ACRTIMP float __cdecl cbrtf(float); +_ACRTIMP float __cdecl erfcf(float); _ACRTIMP float __cdecl exp2f(float); _ACRTIMP float __cdecl expm1f(float); _ACRTIMP float __cdecl log1pf(float); @@ -291,6 +293,9 @@ _ACRTIMP int __cdecl _dsign(double); _ACRTIMP int __cdecl _ldsign(long double); _ACRTIMP int __cdecl _fdsign(float); +_ACRTIMP double __cdecl nan(const char *); +_ACRTIMP float __cdecl nanf(const char *); + #ifdef __cplusplus extern "C++" { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10129
From: Jacek Caban <jacek@codeweavers.com> MSVC uses long double for float_t when x87 math is used on i386. --- include/msvcrt/math.h | 3 +++ libs/musl/src/internal/libm.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h index 977f2a9a1e0..3a1081bf39d 100644 --- a/include/msvcrt/math.h +++ b/include/msvcrt/math.h @@ -45,6 +45,9 @@ struct _complex }; #endif /* _COMPLEX_DEFINED */ +typedef float float_t; +typedef double double_t; + _ACRTIMP double __cdecl sin(double); _ACRTIMP double __cdecl cos(double); _ACRTIMP double __cdecl tan(double); diff --git a/libs/musl/src/internal/libm.h b/libs/musl/src/internal/libm.h index e24e10edaa6..d49cc478bd3 100644 --- a/libs/musl/src/internal/libm.h +++ b/libs/musl/src/internal/libm.h @@ -7,9 +7,6 @@ #include <errno.h> #include <features.h> -typedef float float_t; -typedef double double_t; - typedef double matherr_t(int, const char *, double, double, double); hidden double math_error(int type, const char *name, double arg1, double arg2, double retval); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10129
From: Jacek Caban <jacek@codeweavers.com> --- include/msvcrt/stdlib.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h index 670a25c78e1..a74e88dd65e 100644 --- a/include/msvcrt/stdlib.h +++ b/include/msvcrt/stdlib.h @@ -207,6 +207,7 @@ _ACRTIMP DECLSPEC_NORETURN void __cdecl _Exit(int); _ACRTIMP DECLSPEC_NORETURN void __cdecl _exit(int); _ACRTIMP DECLSPEC_NORETURN void __cdecl abort(void); _ACRTIMP int __cdecl abs(int); +extern int __cdecl at_quick_exit(void (__cdecl*)(void)); extern int __cdecl atexit(void (__cdecl *)(void)); _ACRTIMP double __cdecl atof(const char*); _ACRTIMP int __cdecl atoi(const char*); @@ -225,6 +226,7 @@ _ACRTIMP __msvcrt_long __cdecl labs(__msvcrt_long); _ACRTIMP __int64 __cdecl llabs(__int64); _ACRTIMP int __cdecl mblen(const char*,size_t); _ACRTIMP void __cdecl perror(const char*); +_ACRTIMP DECLSPEC_NORETURN void __cdecl quick_exit(int); _ACRTIMP int __cdecl rand(void); _ACRTIMP errno_t __cdecl rand_s(unsigned int*); _ACRTIMP void __cdecl srand(unsigned int); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10129
From: Jacek Caban <jacek@codeweavers.com> --- dlls/msvcrt/math.c | 8 ++------ include/msvcrt/stdlib.h | 9 ++++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 20f3b08bb54..8ea434c2176 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -1992,7 +1992,7 @@ int CDECL _gcvt_s(char *buff, size_t size, double number, int digits) * VERSION * [i386] Windows binary compatible - returns the struct in eax/edx. */ -#ifdef __i386__ +#if defined(__i386__) && !defined(__WINE_PE_BUILD) unsigned __int64 CDECL div(int num, int denom) { union { @@ -2007,8 +2007,6 @@ unsigned __int64 CDECL div(int num, int denom) #else /********************************************************************* * div (MSVCRT.@) - * VERSION - * [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility */ div_t CDECL div(int num, int denom) { @@ -2026,7 +2024,7 @@ div_t CDECL div(int num, int denom) * VERSION * [i386] Windows binary compatible - returns the struct in eax/edx. */ -#ifdef __i386__ +#if defined(__i386__) && !defined(__WINE_PE_BUILD) unsigned __int64 CDECL ldiv(__msvcrt_long num, __msvcrt_long denom) { union { @@ -2041,8 +2039,6 @@ unsigned __int64 CDECL ldiv(__msvcrt_long num, __msvcrt_long denom) #else /********************************************************************* * ldiv (MSVCRT.@) - * VERSION - * [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility */ ldiv_t CDECL ldiv(__msvcrt_long num, __msvcrt_long denom) { diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h index a74e88dd65e..5e69a270ebd 100644 --- a/include/msvcrt/stdlib.h +++ b/include/msvcrt/stdlib.h @@ -214,10 +214,6 @@ _ACRTIMP int __cdecl atoi(const char*); _ACRTIMP int __cdecl _atoi_l(const char*,_locale_t); _ACRTIMP __msvcrt_long __cdecl atol(const char*); _ACRTIMP __int64 __cdecl atoll(const char*); -#ifndef __i386__ -_ACRTIMP div_t __cdecl div(int,int); -_ACRTIMP ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long); -#endif _ACRTIMP lldiv_t __cdecl lldiv(__int64,__int64); _ACRTIMP DECLSPEC_NORETURN void __cdecl exit(int); _ACRTIMP char* __cdecl getenv(const char*); @@ -300,7 +296,10 @@ static inline unsigned __int64 __cdecl strtoull(const char *ptr, char **endptr, static inline void swab(char* src, char* dst, int len) { _swab(src, dst, len); } static inline char* ultoa(__msvcrt_ulong value, char* str, int radix) { return _ultoa(value, str, radix); } -#ifdef __i386__ +#if !defined(__i386__) || defined(_MSC_VER) || defined(__MINGW32__) +_ACRTIMP div_t __cdecl div(int,int); +_ACRTIMP ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long); +#else static inline div_t __wine_msvcrt_div(int num, int denom) { extern unsigned __int64 div(int,int); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10129
From: Jacek Caban <jacek@codeweavers.com> --- include/msvcrt/wchar.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h index ac0dad36a4b..9a421dc341b 100644 --- a/include/msvcrt/wchar.h +++ b/include/msvcrt/wchar.h @@ -91,6 +91,16 @@ static inline wchar_t* __cdecl wmemset(wchar_t *s, wchar_t c, size_t n) return s; } +static inline int __cdecl fwide(FILE *file, int mode) +{ + return mode; +} + +static inline int __cdecl mbsinit(const mbstate_t *state) +{ + return !state || !*state; +} + #ifdef __cplusplus } #endif -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10129
This merge request was approved by Piotr Caban. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10129
participants (3)
-
Jacek Caban -
Jacek Caban (@jacek) -
Piotr Caban (@piotr)