From 1a38fd0a543e57e3141362a474bfee3bfc1698ea Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 6 Apr 2021 17:05:09 +0300 Subject: [PATCH] msvcp90: Add macro that define type_info vtable. Signed-off-by: Arkadiusz Hiler Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard (cherry picked from commit 6568a8cb628e3c28839a7859c1ed7eb38fc9af92) Signed-off-by: Michael Stefaniuc --- dlls/msvcp90/cxx.h | 32 ++++++++++++++++++++++++++++++++ dlls/msvcp90/exception.c | 32 ++------------------------------ 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h index 02735a3c168..5052f433875 100644 --- a/dlls/msvcp90/cxx.h +++ b/dlls/msvcp90/cxx.h @@ -449,3 +449,35 @@ typedef struct } cxx_exception_type; #endif + +#define CREATE_TYPE_INFO_VTABLE\ + 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 diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c index 8ea4e132a0f..496dd915608 100644 --- a/dlls/msvcp90/exception.c +++ b/dlls/msvcp90/exception.c @@ -26,6 +26,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcp); +CREATE_TYPE_INFO_VTABLE + #define CLASS_IS_SIMPLE_TYPE 1 #define CLASS_HAS_VIRTUAL_BASE_CLASS 4 @@ -65,34 +67,6 @@ extern const vtable_ptr MSVCP_bad_cast_vtable; /* ??_7range_error@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@ABQBD@Z */ /* ??0exception@@QEAA@AEBQEBD@Z */ DEFINE_THISCALL_WRAPPER(MSVCP_exception_ctor,8) @@ -1022,8 +996,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));