Piotr Caban : msvcrt: Add macro that defines type_info vtable.
Alexandre Julliard
julliard at winehq.org
Wed Aug 18 16:22:10 CDT 2021
Module: wine
Branch: master
Commit: 6c4cddc4f6324cfd6d37e269aaec111a8a665e22
URL: https://source.winehq.org/git/wine.git/?a=commit;h=6c4cddc4f6324cfd6d37e269aaec111a8a665e22
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Aug 18 16:09:05 2021 +0200
msvcrt: Add macro that defines type_info vtable.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/cpp.c | 27 ++-------------------------
dlls/msvcrt/cxx.h | 31 ++++++++++++++++++++++++++++++-
dlls/msvcrt/lock.c | 1 -
dlls/msvcrt/scheduler.c | 2 --
4 files changed, 32 insertions(+), 29 deletions(-)
diff --git a/dlls/msvcrt/cpp.c b/dlls/msvcrt/cpp.c
index ac363c41923..1f36bca5712 100644
--- a/dlls/msvcrt/cpp.c
+++ b/dlls/msvcrt/cpp.c
@@ -27,12 +27,13 @@
#include "wine/exception.h"
#include "wine/debug.h"
#include "msvcrt.h"
-#include "cppexcept.h"
#include "mtdll.h"
#include "cxx.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
+CREATE_TYPE_INFO_VTABLE
+
struct __type_info_node
{
void *memPtr;
@@ -626,27 +627,6 @@ const char * __thiscall type_info_raw_name(type_info * _this)
return _this->mangled;
}
-/* Unexported */
-DEFINE_THISCALL_WRAPPER(type_info_vector_dtor,8)
-void * __thiscall 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--) type_info_dtor(_this + i);
- operator_delete(ptr);
- }
- else
- {
- type_info_dtor(_this);
- if (flags & 1) operator_delete(_this);
- }
- return _this;
-}
-
#if _MSVCR_VER >= 80
typedef exception bad_alloc;
@@ -936,8 +916,6 @@ improper_scheduler_detach * __thiscall improper_scheduler_detach_copy_ctor(
__ASM_BLOCK_BEGIN(vtables)
-__ASM_VTABLE(type_info,
- VTABLE_ADD_FUNC(type_info_vector_dtor));
__ASM_VTABLE(exception,
VTABLE_ADD_FUNC(exception_vector_dtor)
VTABLE_ADD_FUNC(what_exception));
@@ -984,7 +962,6 @@ __ASM_VTABLE(improper_scheduler_detach,
__ASM_BLOCK_END
-DEFINE_RTTI_DATA0( type_info, 0, ".?AVtype_info@@" )
#if _MSVCR_VER >= 80
DEFINE_RTTI_DATA0( exception, 0, ".?AVexception at std@@" )
DEFINE_RTTI_DATA0( exception_old, 0, ".?AVexception@@" )
diff --git a/dlls/msvcrt/cxx.h b/dlls/msvcrt/cxx.h
index 77778730e25..1a5442725ef 100644
--- a/dlls/msvcrt/cxx.h
+++ b/dlls/msvcrt/cxx.h
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "wine/asm.h"
+#include "cppexcept.h"
#ifdef _WIN64
@@ -279,3 +279,32 @@ extern void *vtbl_wrapper_48;
#endif
exception* __thiscall exception_ctor(exception*, const char**);
+
+extern const vtable_ptr type_info_vtable;
+
+#define CREATE_TYPE_INFO_VTABLE \
+DEFINE_THISCALL_WRAPPER(type_info_vector_dtor,8) \
+void * __thiscall 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--) free(_this->name); \
+ free(ptr); \
+ } \
+ else \
+ { \
+ free(_this->name); \
+ 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(type_info_vector_dtor)); \
+__ASM_BLOCK_END
diff --git a/dlls/msvcrt/lock.c b/dlls/msvcrt/lock.c
index 78767689c06..9c96217ca95 100644
--- a/dlls/msvcrt/lock.c
+++ b/dlls/msvcrt/lock.c
@@ -24,7 +24,6 @@
#include "winbase.h"
#include "winternl.h"
#include "msvcrt.h"
-#include "cppexcept.h"
#include "mtdll.h"
#include "cxx.h"
diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c
index ef40a3236cd..b8bff6119bf 100644
--- a/dlls/msvcrt/scheduler.c
+++ b/dlls/msvcrt/scheduler.c
@@ -25,7 +25,6 @@
#include "winternl.h"
#include "wine/debug.h"
#include "msvcrt.h"
-#include "cppexcept.h"
#include "cxx.h"
#if _MSVCR_VER >= 100
@@ -1097,7 +1096,6 @@ DEFINE_VTBL_WRAPPER(48);
#endif
-extern const vtable_ptr type_info_vtable;
DEFINE_RTTI_DATA0(Context, 0, ".?AVContext at Concurrency@@")
DEFINE_RTTI_DATA1(ContextBase, 0, &Context_rtti_base_descriptor, ".?AVContextBase at details@Concurrency@@")
DEFINE_RTTI_DATA2(ExternalContextBase, 0, &ContextBase_rtti_base_descriptor,
More information about the wine-cvs
mailing list