[PATCH v2] riched20: Avoid using GCC's typeof extension
Alex Henrie
alexhenrie24 at gmail.com
Wed Sep 26 11:53:02 CDT 2018
On Wed, Sep 26, 2018 at 4:21 AM Huw Davies <huw at codeweavers.com> wrote:
>
> On Mon, Sep 24, 2018 at 10:42:03PM -0600, Alex Henrie wrote:
> > Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
> > ---
> > dlls/riched20/txthost.c | 94 ++++++++++++++++++++++-------------------
> > dlls/riched20/txtsrv.c | 15 ++++++-
> > 2 files changed, 64 insertions(+), 45 deletions(-)
> >
> > diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
> > index b479bde81b..ec180200e1 100644
> > --- a/dlls/riched20/txthost.c
> > +++ b/dlls/riched20/txthost.c
> > @@ -501,9 +501,17 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i
> >
> > #ifdef __i386__ /* thiscall functions are i386-specific */
> >
> > -#define THISCALL(func) __thiscall_ ## func
> > +#define DEFINE_ARGS_PLACEHOLDER(args) struct __args_placeholder ## args { char a[args]; };
> > +DEFINE_ARGS_PLACEHOLDER(4);
> > +DEFINE_ARGS_PLACEHOLDER(8);
> > +DEFINE_ARGS_PLACEHOLDER(12);
> > +DEFINE_ARGS_PLACEHOLDER(16);
> > +DEFINE_ARGS_PLACEHOLDER(20);
> > +DEFINE_ARGS_PLACEHOLDER(32);
> > +
> > +#define THISCALL(func) (void *) __thiscall_ ## func
> > #define DEFINE_THISCALL_WRAPPER(func,args) \
> > - extern typeof(func) THISCALL(func); \
> > + extern HRESULT WINAPI __thiscall_ ## func(struct __args_placeholder ## args); \
> > __ASM_STDCALL_FUNC(__thiscall_ ## func, args, \
> > "popl %eax\n\t" \
> > "pushl %ecx\n\t" \
>
> Could this be made to work in the same way as msvcrt handles thiscall?
Yes, it looks like we can use __ASM_GLOBAL_FUNC instead of
__ASM_STDCALL_FUNC and then the size of the parameters in the function
prototype doesn't have to match the function's assembly definition.
That would indeed be a cleaner solution. Good idea!
-Alex
More information about the wine-devel
mailing list