msvcrt: Add macro that defines type_info vtable.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2021-08-18 16:09:05 +02:00 committed by Alexandre Julliard
parent a2d8a0ce4e
commit 6c4cddc4f6
4 changed files with 32 additions and 29 deletions

View file

@ -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@std@@" )
DEFINE_RTTI_DATA0( exception_old, 0, ".?AVexception@@" )

View file

@ -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

View file

@ -24,7 +24,6 @@
#include "winbase.h"
#include "winternl.h"
#include "msvcrt.h"
#include "cppexcept.h"
#include "mtdll.h"
#include "cxx.h"

View file

@ -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@Concurrency@@")
DEFINE_RTTI_DATA1(ContextBase, 0, &Context_rtti_base_descriptor, ".?AVContextBase@details@Concurrency@@")
DEFINE_RTTI_DATA2(ExternalContextBase, 0, &ContextBase_rtti_base_descriptor,