Piotr Caban : msvcp90: Depend on compiler in _Getcoll implementation if possible.

Alexandre Julliard julliard at winehq.org
Thu May 20 16:09:06 CDT 2021


Module: wine
Branch: master
Commit: 83cc0110f2662b5d8c3530e05de666d65d535bb8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=83cc0110f2662b5d8c3530e05de666d65d535bb8

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu May 20 21:37:23 2021 +0200

msvcp90: Depend on compiler in _Getcoll implementation if possible.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcp100/msvcp100.spec         |  2 +-
 dlls/msvcp110/msvcp110.spec         |  2 +-
 dlls/msvcp120/msvcp120.spec         |  2 +-
 dlls/msvcp120_app/msvcp120_app.spec |  2 +-
 dlls/msvcp140/msvcp140.spec         |  2 +-
 dlls/msvcp60/msvcp60.spec           |  2 +-
 dlls/msvcp70/msvcp70.spec           |  2 +-
 dlls/msvcp71/msvcp71.spec           |  2 +-
 dlls/msvcp80/msvcp80.spec           |  2 +-
 dlls/msvcp90/locale.c               | 13 ++++++++-----
 dlls/msvcp90/msvcp90.spec           |  2 +-
 dlls/msvcp90/tests/misc.c           | 29 +++++++++++++----------------
 12 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/dlls/msvcp100/msvcp100.spec b/dlls/msvcp100/msvcp100.spec
index d964954dc1f..1fc93b05438 100644
--- a/dlls/msvcp100/msvcp100.spec
+++ b/dlls/msvcp100/msvcp100.spec
@@ -2915,7 +2915,7 @@
 @ extern _FSnan
 # extern _FXbig
 @ stub _GetLocaleForCP
-@ cdecl -ret64 _Getcoll()
+@ cdecl -norelay _Getcoll()
 @ cdecl _Getctype(ptr)
 @ cdecl -norelay _Getcvt()
 @ cdecl _Getdateorder()
diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec
index cd2236fe389..aeab529d69a 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -3778,7 +3778,7 @@
 @ stub _FXp_sqrtx
 @ stub _FXp_subx
 # extern _FZero
-@ cdecl -ret64 _Getcoll()
+@ cdecl -norelay _Getcoll()
 @ cdecl _Getctype(ptr)
 @ cdecl -norelay _Getcvt()
 @ cdecl _Getdateorder()
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index 2c5e457b2fc..0b1cb92f8ce 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -3721,7 +3721,7 @@
 @ stub _FXp_sqrtx
 @ stub _FXp_subx
 # extern _FZero
-@ cdecl -ret64 _Getcoll()
+@ cdecl -norelay _Getcoll()
 @ cdecl _Getctype(ptr)
 @ cdecl -norelay _Getcvt()
 @ cdecl _Getdateorder()
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index 93e172a944f..eefb9762708 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -3721,7 +3721,7 @@
 @ stub _FXp_sqrtx
 @ stub _FXp_subx
 # extern _FZero
-@ cdecl -ret64 _Getcoll() msvcp120._Getcoll
+@ cdecl -norelay _Getcoll() msvcp120._Getcoll
 @ cdecl _Getctype(ptr) msvcp120._Getctype
 @ cdecl -norelay _Getcvt() msvcp120._Getcvt
 @ cdecl _Getdateorder() msvcp120._Getdateorder
diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec
index 7e7ea012236..d2cb4dbed8c 100644
--- a/dlls/msvcp140/msvcp140.spec
+++ b/dlls/msvcp140/msvcp140.spec
@@ -3649,7 +3649,7 @@
 @ stub _FSinh
 @ extern _FSnan
 @ cdecl _File_size(wstr)
-@ cdecl -ret64 _Getcoll()
+@ cdecl -norelay _Getcoll()
 @ cdecl _Getctype(ptr)
 @ cdecl -norelay _Getcvt()
 @ cdecl _Getdateorder()
diff --git a/dlls/msvcp60/msvcp60.spec b/dlls/msvcp60/msvcp60.spec
index 628e5f7f59e..de7aafa73b7 100644
--- a/dlls/msvcp60/msvcp60.spec
+++ b/dlls/msvcp60/msvcp60.spec
@@ -4274,7 +4274,7 @@
 @ stub _FSinh
 @ extern _FSnan _FSnan
 # extern _FXbig
-@ cdecl -ret64 _Getcoll()
+@ cdecl -norelay _Getcoll()
 @ cdecl _Getctype(ptr)
 @ cdecl -norelay _Getcvt()
 @ extern _Hugeval _Hugeval
diff --git a/dlls/msvcp70/msvcp70.spec b/dlls/msvcp70/msvcp70.spec
index c48945d9509..d1a152ff0e3 100644
--- a/dlls/msvcp70/msvcp70.spec
+++ b/dlls/msvcp70/msvcp70.spec
@@ -5061,7 +5061,7 @@
 @ extern _FSnan
 # extern _FXbig
 # extern _FZero
-@ cdecl -ret64 _Getcoll()
+@ cdecl -norelay _Getcoll()
 @ cdecl _Getctype(ptr)
 @ cdecl -norelay _Getcvt()
 @ extern _Hugeval
diff --git a/dlls/msvcp71/msvcp71.spec b/dlls/msvcp71/msvcp71.spec
index f9fc613b7d0..6176c9be2df 100644
--- a/dlls/msvcp71/msvcp71.spec
+++ b/dlls/msvcp71/msvcp71.spec
@@ -5115,7 +5115,7 @@
 @ extern _FSnan
 # extern _FXbig
 # extern _FZero
-@ cdecl -ret64 _Getcoll()
+@ cdecl -norelay _Getcoll()
 @ cdecl _Getctype(ptr)
 @ cdecl -norelay _Getcvt()
 @ cdecl _Getwctype(long ptr)
diff --git a/dlls/msvcp80/msvcp80.spec b/dlls/msvcp80/msvcp80.spec
index 74c0cac3669..f450286505a 100644
--- a/dlls/msvcp80/msvcp80.spec
+++ b/dlls/msvcp80/msvcp80.spec
@@ -5724,7 +5724,7 @@
 @ stub _FSinh
 @ extern _FSnan
 # extern _FXbig
-@ cdecl -ret64 _Getcoll()
+@ cdecl -norelay _Getcoll()
 @ cdecl _Getctype(ptr)
 @ cdecl -norelay _Getcvt()
 @ cdecl _Getdateorder()
diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c
index bd045333dfc..2f6c103b2a2 100644
--- a/dlls/msvcp90/locale.c
+++ b/dlls/msvcp90/locale.c
@@ -669,20 +669,23 @@ static _Collvec* getcoll(_Collvec *ret)
 }
 
 /* _Getcoll */
-#if defined(__i386__) || _MSVCP_VER<110
+#if defined(__i386__)
+/* Work around a gcc bug */
 ULONGLONG __cdecl _Getcoll(void)
 {
+    C_ASSERT(sizeof(_Collvec) == sizeof(ULONGLONG));
     ULONGLONG ret;
 
-    C_ASSERT(sizeof(_Collvec) <= sizeof(ULONGLONG));
-
     getcoll((_Collvec*)&ret);
     return ret;
 }
 #else
-_Collvec* __cdecl _Getcoll(_Collvec *ret)
+_Collvec __cdecl _Getcoll(void)
 {
-    return getcoll(ret);
+    _Collvec ret;
+
+    getcoll(&ret);
+    return ret;
 }
 #endif
 
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index ff6fe952053..15b16ed7f12 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -6500,7 +6500,7 @@
 @ stub _FSinh
 @ extern _FSnan
 # extern _FXbig
-@ cdecl -ret64 _Getcoll()
+@ cdecl -norelay _Getcoll()
 @ cdecl _Getctype(ptr)
 @ cdecl -norelay _Getcvt()
 @ cdecl _Getdateorder()
diff --git a/dlls/msvcp90/tests/misc.c b/dlls/msvcp90/tests/misc.c
index 9d6fe2b9bcc..546f10f6858 100644
--- a/dlls/msvcp90/tests/misc.c
+++ b/dlls/msvcp90/tests/misc.c
@@ -101,7 +101,7 @@ static char* (__cdecl *p_Copy_s)(char*, size_t, const char*, size_t);
 
 static unsigned short (__cdecl *p_wctype)(const char*);
 static MSVCP__Ctypevec* (__cdecl *p__Getctype)(MSVCP__Ctypevec*);
-static /*MSVCP__Collvec*/ULONGLONG (__cdecl *p__Getcoll)(void);
+static MSVCP__Collvec (__cdecl *p__Getcoll)(void);
 static wctrans_t (__cdecl *p_wctrans)(const char*);
 static wint_t (__cdecl *p_towctrans)(wint_t, wctrans_t);
 static void (__cdecl *p_locale__Locimp__Locimp_Addfac)(locale__Locimp*,locale_facet*,size_t);
@@ -604,26 +604,23 @@ static void test__Getctype(void)
 
 static void test__Getcoll(void)
 {
-    ULONGLONG (__cdecl *p__Getcoll_arg)(MSVCP__Collvec*);
+#ifdef __i386__
+    /* Workaround a gcc bug */
+    ULONGLONG tmp;
+#define call__Getcoll(ret) tmp = ((ULONGLONG (__cdecl*)(void))p__Getcoll)(); \
+    memcpy(&ret, &tmp, sizeof(tmp))
+#else
+#define call__Getcoll(ret) ret = p__Getcoll()
+#endif
     _locale_t locale;
-
-    union {
-        MSVCP__Collvec collvec;
-        ULONGLONG ull;
-    }ret;
+    MSVCP__Collvec ret;
 
     locale = p__get_current_locale();
     locale->locinfo->lc_handle[LC_COLLATE] = 0x7654321;
     p__free_locale(locale);
-    ret.ull = 0;
-    p__Getcoll_arg = (void*)p__Getcoll;
-    p__Getcoll_arg(&ret.collvec);
-    ok(ret.collvec.handle == 0, "ret.handle = %x\n", ret.collvec.handle);
-    ok(ret.collvec.page == 0, "ret.page = %x\n", ret.collvec.page);
-
-    ret.ull = p__Getcoll();
-    ok(ret.collvec.handle == 0x7654321, "ret.collvec.handle = %x\n", ret.collvec.handle);
-    ok(ret.collvec.page == 0, "ret.page = %x\n", ret.collvec.page);
+    call__Getcoll(ret);
+    ok(ret.handle == 0x7654321, "ret.handle = %x\n", ret.handle);
+    ok(ret.page == 0, "ret.page = %x\n", ret.page);
 }
 
 static void test_towctrans(void)




More information about the wine-cvs mailing list