[PATCH 1/2] msvcp90: Move type_info to a separate file.
Arkadiusz Hiler
ahiler at codeweavers.com
Mon Apr 5 09:00:49 CDT 2021
On Fri, Apr 02, 2021 at 10:39:59PM +0200, Piotr Caban wrote:
> 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
> 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
I was considering something similar at first, but I didn't like the idea
of having RTTI/dtor definitions behind an ifdef in a header file.
I don't have a strong preference though so if this is fine with you then
it's also fine with me.
--
Cheers,
Arek
More information about the wine-devel
mailing list