msvcrt: Allow specifying destructor in DEFINE_CXX_DATA macro.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b24ee3b534
commit
bc05707364
dlls/msvcrt
|
@ -731,14 +731,6 @@ HRESULT __thiscall scheduler_resource_allocation_error_get_error_code(
|
|||
return this->hr;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(scheduler_resource_allocation_error_dtor,4)
|
||||
void __thiscall scheduler_resource_allocation_error_dtor(
|
||||
scheduler_resource_allocation_error * this)
|
||||
{
|
||||
TRACE("(%p)\n", this);
|
||||
exception_dtor(&this->e);
|
||||
}
|
||||
|
||||
typedef exception improper_lock;
|
||||
extern const vtable_ptr improper_lock_vtable;
|
||||
|
||||
|
@ -770,13 +762,6 @@ improper_lock * __thiscall improper_lock_copy_ctor(improper_lock * _this, const
|
|||
return _this;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(improper_lock_dtor,4)
|
||||
void __thiscall improper_lock_dtor(improper_lock * _this)
|
||||
{
|
||||
TRACE("(%p)\n", _this);
|
||||
exception_dtor(_this);
|
||||
}
|
||||
|
||||
typedef exception invalid_scheduler_policy_key;
|
||||
extern const vtable_ptr invalid_scheduler_policy_key_vtable;
|
||||
|
||||
|
@ -811,14 +796,6 @@ invalid_scheduler_policy_key * __thiscall invalid_scheduler_policy_key_copy_ctor
|
|||
return _this;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(invalid_scheduler_policy_key_dtor,4)
|
||||
void __thiscall invalid_scheduler_policy_key_dtor(
|
||||
invalid_scheduler_policy_key * _this)
|
||||
{
|
||||
TRACE("(%p)\n", _this);
|
||||
exception_dtor(_this);
|
||||
}
|
||||
|
||||
typedef exception invalid_scheduler_policy_value;
|
||||
extern const vtable_ptr invalid_scheduler_policy_value_vtable;
|
||||
|
||||
|
@ -853,14 +830,6 @@ invalid_scheduler_policy_value * __thiscall invalid_scheduler_policy_value_copy_
|
|||
return _this;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(invalid_scheduler_policy_value_dtor,4)
|
||||
void __thiscall invalid_scheduler_policy_value_dtor(
|
||||
invalid_scheduler_policy_value * _this)
|
||||
{
|
||||
TRACE("(%p)\n", _this);
|
||||
exception_dtor(_this);
|
||||
}
|
||||
|
||||
typedef exception invalid_scheduler_policy_thread_specification;
|
||||
extern const vtable_ptr invalid_scheduler_policy_thread_specification_vtable;
|
||||
|
||||
|
@ -895,14 +864,6 @@ invalid_scheduler_policy_thread_specification * __thiscall invalid_scheduler_pol
|
|||
return _this;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(invalid_scheduler_policy_thread_specification_dtor,4)
|
||||
void __thiscall invalid_scheduler_policy_thread_specification_dtor(
|
||||
invalid_scheduler_policy_thread_specification * _this)
|
||||
{
|
||||
TRACE("(%p)\n", _this);
|
||||
exception_dtor(_this);
|
||||
}
|
||||
|
||||
typedef exception improper_scheduler_attach;
|
||||
extern const vtable_ptr improper_scheduler_attach_vtable;
|
||||
|
||||
|
@ -937,14 +898,6 @@ improper_scheduler_attach * __thiscall improper_scheduler_attach_copy_ctor(
|
|||
return _this;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(improper_scheduler_attach_dtor,4)
|
||||
void __thiscall improper_scheduler_attach_dtor(
|
||||
improper_scheduler_attach * _this)
|
||||
{
|
||||
TRACE("(%p)\n", _this);
|
||||
exception_dtor(_this);
|
||||
}
|
||||
|
||||
typedef exception improper_scheduler_detach;
|
||||
extern const vtable_ptr improper_scheduler_detach_vtable;
|
||||
|
||||
|
@ -979,14 +932,6 @@ improper_scheduler_detach * __thiscall improper_scheduler_detach_copy_ctor(
|
|||
return _this;
|
||||
}
|
||||
|
||||
DEFINE_THISCALL_WRAPPER(improper_scheduler_detach_dtor,4)
|
||||
void __thiscall improper_scheduler_detach_dtor(
|
||||
improper_scheduler_detach * _this)
|
||||
{
|
||||
TRACE("(%p)\n", _this);
|
||||
exception_dtor(_this);
|
||||
}
|
||||
|
||||
#endif /* _MSVCR_VER >= 100 */
|
||||
|
||||
__ASM_BLOCK_BEGIN(vtables)
|
||||
|
@ -1069,21 +1014,22 @@ DEFINE_RTTI_DATA1(improper_scheduler_detach, 0, &exception_rtti_base_descriptor,
|
|||
".?AVimproper_scheduler_detach@Concurrency@@" )
|
||||
#endif
|
||||
|
||||
DEFINE_EXCEPTION_TYPE_INFO( exception, 0, NULL, NULL )
|
||||
DEFINE_EXCEPTION_TYPE_INFO( bad_typeid, 1, &exception_cxx_type_info, NULL )
|
||||
DEFINE_EXCEPTION_TYPE_INFO( bad_cast, 1, &exception_cxx_type_info, NULL )
|
||||
DEFINE_EXCEPTION_TYPE_INFO( __non_rtti_object, 2, &bad_typeid_cxx_type_info, &exception_cxx_type_info )
|
||||
DEFINE_CXX_DATA0( exception, exception_dtor )
|
||||
DEFINE_CXX_DATA1( bad_typeid, &exception_cxx_type_info, bad_typeid_dtor )
|
||||
DEFINE_CXX_DATA1( bad_cast, &exception_cxx_type_info, bad_cast_dtor )
|
||||
DEFINE_CXX_DATA2( __non_rtti_object, &bad_typeid_cxx_type_info,
|
||||
&exception_cxx_type_info, __non_rtti_object_dtor )
|
||||
#if _MSVCR_VER >= 80
|
||||
DEFINE_EXCEPTION_TYPE_INFO( bad_alloc, 1, &exception_cxx_type_info, NULL )
|
||||
DEFINE_CXX_DATA1( bad_alloc, &exception_cxx_type_info, bad_alloc_dtor )
|
||||
#endif
|
||||
#if _MSVCR_VER >= 100
|
||||
DEFINE_EXCEPTION_TYPE_INFO(scheduler_resource_allocation_error, 1, &exception_cxx_type_info, NULL)
|
||||
DEFINE_EXCEPTION_TYPE_INFO(improper_lock, 1, &exception_cxx_type_info, NULL)
|
||||
DEFINE_EXCEPTION_TYPE_INFO(invalid_scheduler_policy_key, 1, &exception_cxx_type_info, NULL)
|
||||
DEFINE_EXCEPTION_TYPE_INFO(invalid_scheduler_policy_value, 1, &exception_cxx_type_info, NULL)
|
||||
DEFINE_EXCEPTION_TYPE_INFO(invalid_scheduler_policy_thread_specification, 1, &exception_cxx_type_info, NULL)
|
||||
DEFINE_EXCEPTION_TYPE_INFO(improper_scheduler_attach, 1, &exception_cxx_type_info, NULL)
|
||||
DEFINE_EXCEPTION_TYPE_INFO(improper_scheduler_detach, 1, &exception_cxx_type_info, NULL)
|
||||
DEFINE_CXX_DATA1(scheduler_resource_allocation_error, &exception_cxx_type_info, exception_dtor)
|
||||
DEFINE_CXX_DATA1(improper_lock, &exception_cxx_type_info, exception_dtor)
|
||||
DEFINE_CXX_DATA1(invalid_scheduler_policy_key, &exception_cxx_type_info, exception_dtor)
|
||||
DEFINE_CXX_DATA1(invalid_scheduler_policy_value, &exception_cxx_type_info, exception_dtor)
|
||||
DEFINE_CXX_DATA1(invalid_scheduler_policy_thread_specification, &exception_cxx_type_info, exception_dtor)
|
||||
DEFINE_CXX_DATA1(improper_scheduler_attach, &exception_cxx_type_info, exception_dtor)
|
||||
DEFINE_CXX_DATA1(improper_scheduler_detach, &exception_cxx_type_info, exception_dtor)
|
||||
#endif
|
||||
|
||||
void msvcrt_init_exception(void *base)
|
||||
|
|
|
@ -156,36 +156,37 @@ static inline void *get_this_pointer( const this_ptr_offsets *off, void *object
|
|||
}
|
||||
|
||||
#ifndef __x86_64__
|
||||
#define DEFINE_EXCEPTION_TYPE_INFO(type, base_no, cl1, cl2) \
|
||||
\
|
||||
#define DEFINE_CXX_TYPE_INFO(type) \
|
||||
static const cxx_type_info type ## _cxx_type_info = { \
|
||||
0, \
|
||||
& type ##_type_info, \
|
||||
{ 0, -1, 0 }, \
|
||||
sizeof(type), \
|
||||
(cxx_copy_ctor)THISCALL(type ##_copy_ctor) \
|
||||
}; \
|
||||
};
|
||||
|
||||
#define DEFINE_CXX_DATA(type, base_no, cl1, cl2, dtor) \
|
||||
DEFINE_CXX_TYPE_INFO(type) \
|
||||
\
|
||||
static const cxx_type_info_table type ## _type_info_table = { \
|
||||
static const cxx_type_info_table type ## _cxx_type_table = { \
|
||||
base_no+1, \
|
||||
{ \
|
||||
& type ## _cxx_type_info, \
|
||||
cl1, \
|
||||
cl2 \
|
||||
cl2, \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
static const cxx_exception_type type ## _exception_type = { \
|
||||
0, \
|
||||
(cxx_copy_ctor)THISCALL(type ## _dtor), \
|
||||
(cxx_copy_ctor)THISCALL(dtor), \
|
||||
NULL, \
|
||||
& type ## _type_info_table \
|
||||
& type ## _cxx_type_table \
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#define DEFINE_EXCEPTION_TYPE_INFO(type, base_no, cl1, cl2) \
|
||||
\
|
||||
#define DEFINE_CXX_TYPE_INFO(type) \
|
||||
static cxx_type_info type ## _cxx_type_info = { \
|
||||
0, \
|
||||
0xdeadbeef, \
|
||||
|
@ -194,12 +195,22 @@ static cxx_type_info type ## _cxx_type_info = { \
|
|||
0xdeadbeef \
|
||||
}; \
|
||||
\
|
||||
static cxx_type_info_table type ## _type_info_table = { \
|
||||
static void init_ ## type ## _cxx_type_info(char *base) \
|
||||
{ \
|
||||
type ## _cxx_type_info.type_info = (char *)&type ## _type_info - base; \
|
||||
type ## _cxx_type_info.copy_ctor = (char *)type ## _copy_ctor - base; \
|
||||
}
|
||||
|
||||
#define DEFINE_CXX_DATA(type, base_no, cl1, cl2, dtor) \
|
||||
\
|
||||
DEFINE_CXX_TYPE_INFO(type) \
|
||||
\
|
||||
static cxx_type_info_table type ## _cxx_type_table = { \
|
||||
base_no+1, \
|
||||
{ \
|
||||
0xdeadbeef, \
|
||||
0xdeadbeef, \
|
||||
0xdeadbeef \
|
||||
0xdeadbeef, \
|
||||
} \
|
||||
}; \
|
||||
\
|
||||
|
@ -212,14 +223,20 @@ static cxx_exception_type type ##_exception_type = { \
|
|||
\
|
||||
static void init_ ## type ## _cxx(char *base) \
|
||||
{ \
|
||||
type ## _cxx_type_info.type_info = (char *)&type ## _type_info - base; \
|
||||
type ## _cxx_type_info.copy_ctor = (char *)type ## _copy_ctor - base; \
|
||||
type ## _type_info_table.info[0] = (char *)&type ## _cxx_type_info - base; \
|
||||
type ## _type_info_table.info[1] = (char *)cl1 - base; \
|
||||
type ## _type_info_table.info[2] = (char *)cl2 - base; \
|
||||
type ## _exception_type.destructor = (char *)type ## _dtor - base; \
|
||||
type ## _exception_type.type_info_table = (char *)&type ## _type_info_table - base; \
|
||||
init_ ## type ## _cxx_type_info(base); \
|
||||
type ## _cxx_type_table.info[0] = (char *)&type ## _cxx_type_info - base; \
|
||||
type ## _cxx_type_table.info[1] = (char *)cl1 - base; \
|
||||
type ## _cxx_type_table.info[2] = (char *)cl2 - base; \
|
||||
type ## _exception_type.destructor = (char *)dtor - base; \
|
||||
type ## _exception_type.type_info_table = (char *)&type ## _cxx_type_table - base; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DEFINE_CXX_DATA0(name, dtor) \
|
||||
DEFINE_CXX_DATA(name, 0, NULL, NULL, dtor)
|
||||
#define DEFINE_CXX_DATA1(name, cl1, dtor) \
|
||||
DEFINE_CXX_DATA(name, 1, cl1, NULL, dtor)
|
||||
#define DEFINE_CXX_DATA2(name, cl1, cl2, dtor) \
|
||||
DEFINE_CXX_DATA(name, 2, cl1, cl2, dtor)
|
||||
|
||||
#endif /* __MSVCRT_CPPEXCEPT_H */
|
||||
|
|
Loading…
Reference in New Issue