[PATCH 1/2] msvcp90: Move type_info to a separate file.

Piotr Caban piotr at codeweavers.com
Fri Apr 2 15:39:59 CDT 2021


Hi Arek,

I'm attaching alternative solution for type_info_vtable definition. I 
think it makes sense to make the cxx.h file independent from other 
files. What do you think about it?

Thanks,
Piotr
-------------- next part --------------
From ac91f5f1dd440cfdb43c9ae346e7bfd7b78629d9 Mon Sep 17 00:00:00 2001
From: Piotr Caban <piotr at codeweavers.com>
Date: Fri, 2 Apr 2021 22:31:19 +0200
Subject: [PATCH] msvcp90: Define type_info vtable in cxx.h header if
 requested.
To: wine-devel <wine-devel at winehq.org>

---
 dlls/msvcp90/cxx.h       | 33 +++++++++++++++++++++++++++++++++
 dlls/msvcp90/exception.c | 31 +------------------------------
 2 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h
index 7af11de7fe6..43b8df61012 100644
--- a/dlls/msvcp90/cxx.h
+++ b/dlls/msvcp90/cxx.h
@@ -452,3 +452,36 @@ typedef struct
 } cxx_exception_type;
 
 #endif
+
+#ifdef DEFINE_TYPE_INFO
+static void MSVCP_type_info_dtor(type_info * _this)
+{
+    free(_this->name);
+}
+
+DEFINE_THISCALL_WRAPPER(MSVCP_type_info_vector_dtor,8)
+void * __thiscall MSVCP_type_info_vector_dtor(type_info * _this, unsigned int flags)
+{
+    if (flags & 2)
+    {
+        /* we have an array, with the number of elements stored before the first object */
+        INT_PTR i, *ptr = (INT_PTR *)_this - 1;
+
+        for (i = *ptr - 1; i >= 0; i--) MSVCP_type_info_dtor(_this + i);
+        free(ptr);
+    }
+    else
+    {
+        MSVCP_type_info_dtor(_this);
+        if (flags & 1) free(_this);
+    }
+    return _this;
+}
+
+DEFINE_RTTI_DATA0( type_info, 0, ".?AVtype_info@@" )
+
+__ASM_BLOCK_BEGIN(type_info_vtables)
+    __ASM_VTABLE(type_info,
+            VTABLE_ADD_FUNC(MSVCP_type_info_vector_dtor));
+__ASM_BLOCK_END
+#endif
diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c
index 45e2ec93be4..569e7c0fd7c 100644
--- a/dlls/msvcp90/exception.c
+++ b/dlls/msvcp90/exception.c
@@ -18,6 +18,7 @@
 
 #include <stdarg.h>
 
+#define DEFINE_TYPE_INFO
 #include "msvcp90.h"
 #include "windef.h"
 #include "winbase.h"
@@ -65,34 +66,6 @@ extern const vtable_ptr MSVCP_bad_cast_vtable;
 /* ??_7range_error at std@@6B@ */
 extern const vtable_ptr MSVCP_range_error_vtable;
 
-static void MSVCP_type_info_dtor(type_info * _this)
-{
-    free(_this->name);
-}
-
-/* Unexported */
-DEFINE_THISCALL_WRAPPER(MSVCP_type_info_vector_dtor,8)
-void * __thiscall MSVCP_type_info_vector_dtor(type_info * _this, unsigned int flags)
-{
-    TRACE("(%p %x)\n", _this, flags);
-    if (flags & 2)
-    {
-        /* we have an array, with the number of elements stored before the first object */
-        INT_PTR i, *ptr = (INT_PTR *)_this - 1;
-
-        for (i = *ptr - 1; i >= 0; i--) MSVCP_type_info_dtor(_this + i);
-        MSVCRT_operator_delete(ptr);
-    }
-    else
-    {
-        MSVCP_type_info_dtor(_this);
-        if (flags & 1) MSVCRT_operator_delete(_this);
-    }
-    return _this;
-}
-
-DEFINE_RTTI_DATA0( type_info, 0, ".?AVtype_info@@" )
-
 /* ??0exception@@QAE at ABQBD@Z */
 /* ??0exception@@QEAA at AEBQEBD@Z */
 DEFINE_THISCALL_WRAPPER(MSVCP_exception_ctor,8)
@@ -1036,8 +1009,6 @@ void __cdecl __ExceptionPtrDestroy(exception_ptr *ep)
 #endif
 
 __ASM_BLOCK_BEGIN(exception_vtables)
-    __ASM_VTABLE(type_info,
-            VTABLE_ADD_FUNC(MSVCP_type_info_vector_dtor));
     EXCEPTION_VTABLE(exception,
             VTABLE_ADD_FUNC(MSVCP_exception_vector_dtor)
             VTABLE_ADD_FUNC(MSVCP_exception_what));
-- 
2.26.3



More information about the wine-devel mailing list