msvcp90: Depend on compiler in _Getcvt implementation if possible.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2021-05-20 21:37:16 +02:00 committed by Alexandre Julliard
parent a0428db825
commit 24f7abafd7
12 changed files with 41 additions and 27 deletions

View file

@ -2917,7 +2917,7 @@
@ stub _GetLocaleForCP
@ cdecl -ret64 _Getcoll()
@ cdecl _Getctype(ptr)
@ cdecl -ret64 _Getcvt()
@ cdecl -norelay _Getcvt()
@ cdecl _Getdateorder()
@ cdecl _Getwctype(long ptr)
@ cdecl _Getwctypes(ptr ptr ptr ptr)

View file

@ -3780,7 +3780,7 @@
# extern _FZero
@ cdecl -ret64 _Getcoll()
@ cdecl _Getctype(ptr)
@ cdecl -ret64 _Getcvt()
@ cdecl -norelay _Getcvt()
@ cdecl _Getdateorder()
@ cdecl _Getwctype(long ptr)
@ cdecl _Getwctypes(ptr ptr ptr ptr)

View file

@ -3723,7 +3723,7 @@
# extern _FZero
@ cdecl -ret64 _Getcoll()
@ cdecl _Getctype(ptr)
@ cdecl -ret64 _Getcvt()
@ cdecl -norelay _Getcvt()
@ cdecl _Getdateorder()
@ cdecl _Getwctype(long ptr)
@ cdecl _Getwctypes(ptr ptr ptr ptr)

View file

@ -209,7 +209,7 @@ static int (__cdecl *p__ismbblead)(unsigned int);
static MSVCRT_long (__cdecl *p__Xtime_diff_to_millis2)(const xtime*, const xtime*);
static int (__cdecl *p_xtime_get)(xtime*, int);
static _Cvtvec* (__cdecl *p__Getcvt)(_Cvtvec*);
static _Cvtvec (__cdecl *p__Getcvt)(void);
static void (CDECL *p__Call_once)(int *once, void (CDECL *func)(void));
static void (CDECL *p__Call_onceEx)(int *once, void (CDECL *func)(void*), void *argv);
static void (CDECL *p__Do_call)(void *this);
@ -930,7 +930,7 @@ static void test__Getcvt(void)
_Cvtvec cvtvec;
int i;
p__Getcvt(&cvtvec);
cvtvec = p__Getcvt();
ok(cvtvec.page == 0, "cvtvec.page = %d\n", cvtvec.page);
ok(cvtvec.mb_max == 1, "cvtvec.mb_max = %d\n", cvtvec.mb_max);
todo_wine ok(cvtvec.unk == 1, "cvtvec.unk = %d\n", cvtvec.unk);
@ -941,7 +941,7 @@ static void test__Getcvt(void)
win_skip("_Getcvt tests\n");
return;
}
p__Getcvt(&cvtvec);
cvtvec = p__Getcvt();
ok(cvtvec.page == 936, "cvtvec.page = %d\n", cvtvec.page);
ok(cvtvec.mb_max == 2, "cvtvec.mb_max = %d\n", cvtvec.mb_max);
ok(cvtvec.unk == 0, "cvtvec.unk = %d\n", cvtvec.unk);
@ -955,7 +955,7 @@ static void test__Getcvt(void)
}
p__setmbcp(936);
p__Getcvt(&cvtvec);
cvtvec = p__Getcvt();
ok(cvtvec.page == 936, "cvtvec.page = %d\n", cvtvec.page);
ok(cvtvec.mb_max == 2, "cvtvec.mb_max = %d\n", cvtvec.mb_max);
ok(cvtvec.unk == 0, "cvtvec.unk = %d\n", cvtvec.unk);

View file

@ -3723,7 +3723,7 @@
# extern _FZero
@ cdecl -ret64 _Getcoll() msvcp120._Getcoll
@ cdecl _Getctype(ptr) msvcp120._Getctype
@ cdecl -ret64 _Getcvt() msvcp120._Getcvt
@ cdecl -norelay _Getcvt() msvcp120._Getcvt
@ cdecl _Getdateorder() msvcp120._Getdateorder
@ cdecl _Getwctype(long ptr) msvcp120._Getwctype
@ cdecl _Getwctypes(ptr ptr ptr ptr) msvcp120._Getwctypes

View file

@ -3651,7 +3651,7 @@
@ cdecl _File_size(wstr)
@ cdecl -ret64 _Getcoll()
@ cdecl _Getctype(ptr)
@ cdecl -ret64 _Getcvt()
@ cdecl -norelay _Getcvt()
@ cdecl _Getdateorder()
@ cdecl _Getwctype(long ptr)
@ cdecl _Getwctypes(ptr ptr ptr ptr)

View file

@ -4276,7 +4276,7 @@
# extern _FXbig
@ cdecl -ret64 _Getcoll()
@ cdecl _Getctype(ptr)
@ cdecl -ret64 _Getcvt()
@ cdecl -norelay _Getcvt()
@ extern _Hugeval _Hugeval
@ extern _Inf _Inf
@ stub _LCosh

View file

@ -5063,7 +5063,7 @@
# extern _FZero
@ cdecl -ret64 _Getcoll()
@ cdecl _Getctype(ptr)
@ cdecl -ret64 _Getcvt()
@ cdecl -norelay _Getcvt()
@ extern _Hugeval
@ extern _Inf
@ stub _LCosh

View file

@ -5117,7 +5117,7 @@
# extern _FZero
@ cdecl -ret64 _Getcoll()
@ cdecl _Getctype(ptr)
@ cdecl -ret64 _Getcvt()
@ cdecl -norelay _Getcvt()
@ cdecl _Getwctype(long ptr)
@ cdecl _Getwctypes(ptr ptr ptr ptr)
@ extern _Hugeval

View file

@ -5726,7 +5726,7 @@
# extern _FXbig
@ cdecl -ret64 _Getcoll()
@ cdecl _Getctype(ptr)
@ cdecl -ret64 _Getcvt()
@ cdecl -norelay _Getcvt()
@ cdecl _Getdateorder()
@ cdecl _Getwctype(long ptr)
@ cdecl _Getwctypes(ptr ptr ptr ptr)

View file

@ -735,9 +735,11 @@ _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
}
/* _Getcvt */
#if _MSVCP_VER < 110
#if _MSVCP_VER < 110 && defined(__i386__)
/* Work around a gcc bug */
ULONGLONG __cdecl _Getcvt(void)
{
C_ASSERT(sizeof(_Cvtvec) == sizeof(ULONGLONG));
union {
_Cvtvec cvtvec;
ULONGLONG ull;
@ -749,20 +751,32 @@ ULONGLONG __cdecl _Getcvt(void)
ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
return ret.ull;
}
#else
_Cvtvec* __cdecl _Getcvt(_Cvtvec *ret)
#elif _MSVCP_VER < 110
_Cvtvec __cdecl _Getcvt(void)
{
_Cvtvec ret;
TRACE("\n");
ret.page = ___lc_codepage_func();
ret.handle = ___lc_handle_func()[LC_CTYPE];
return ret;
}
#else
_Cvtvec __cdecl _Getcvt(void)
{
_Cvtvec ret;
int i;
TRACE("\n");
memset(ret, 0, sizeof(*ret));
ret->page = ___lc_codepage_func();
ret->mb_max = ___mb_cur_max_func();
memset(&ret, 0, sizeof(ret));
ret.page = ___lc_codepage_func();
ret.mb_max = ___mb_cur_max_func();
if(ret->mb_max > 1) {
if(ret.mb_max > 1) {
for(i=0; i<256; i++)
if(_ismbblead(i)) ret->isleadbyte[i/8] |= 1 << (i&7);
if(_ismbblead(i)) ret.isleadbyte[i/8] |= 1 << (i&7);
}
return ret;
}
@ -773,14 +787,14 @@ _Cvtvec* __cdecl _Getcvt(_Cvtvec *ret)
DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
_Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
{
#if _MSVCP_VER < 110
ULONGLONG ull = _Getcvt();
memcpy(ret, &ull, sizeof(ull));
#if _MSVCP_VER < 110 && defined(__i386__)
ULONGLONG cvtvec;
#else
_Cvtvec cvtvec;
_Getcvt(&cvtvec);
memcpy(ret, &cvtvec, sizeof(cvtvec));
#endif
cvtvec = _Getcvt();
memcpy(ret, &cvtvec, sizeof(cvtvec));
return ret;
}

View file

@ -6502,7 +6502,7 @@
# extern _FXbig
@ cdecl -ret64 _Getcoll()
@ cdecl _Getctype(ptr)
@ cdecl -ret64 _Getcvt()
@ cdecl -norelay _Getcvt()
@ cdecl _Getdateorder()
@ cdecl _Getwctype(long ptr)
@ cdecl _Getwctypes(ptr ptr ptr ptr)