Commit 0a79eb36 authored by Alexandre Julliard's avatar Alexandre Julliard

include: Use the __thiscall attribute directly for the Mingw build.

parent 10584d20
......@@ -4464,7 +4464,7 @@ void __cdecl ios_sync_with_stdio(void)
}
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
#define DEFINE_VTBL_WRAPPER(off) \
__ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
......
......@@ -28,7 +28,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
#define DEFINE_VTBL_WRAPPER(off) \
__ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
......
......@@ -263,7 +263,7 @@ static void init_ ## type ## _cxx(char *base) \
#define DEFINE_CXX_DATA4(name, cl1, cl2, cl3, cl4, dtor) \
DEFINE_CXX_DATA(name, 4, cl1, cl2, cl3, cl4, dtor)
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (WINAPI*)type)&vtbl_wrapper_##off)args
......@@ -285,7 +285,7 @@ extern void *vtbl_wrapper_56;
#else
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__cdecl***)type)this)[0][off/4]args
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__thiscall***)type)this)[0][off/4]args
#endif
......
......@@ -970,7 +970,7 @@ void __cdecl __ExceptionPtrCreate(exception_ptr *ep)
ep->ref = NULL;
}
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
extern void call_dtor(const cxx_exception_type *type, void *func, void *object);
__ASM_GLOBAL_FUNC( call_dtor,
......@@ -985,7 +985,7 @@ static inline void call_dtor(const cxx_exception_type *type, unsigned int dtor,
func(object);
}
#else
#define call_dtor(type, func, object) ((void (__cdecl*)(void*))(func))(object)
#define call_dtor(type, func, object) ((void (__thiscall*)(void*))(func))(object)
#endif
/*********************************************************************
......
......@@ -663,7 +663,7 @@ unsigned int __cdecl _Random_device(void)
#endif
#if _MSVCP_VER >= 110
#if defined(__i386__)
#if defined(__i386__) && !defined(__MINGW32__)
extern void *call_thiscall_func;
__ASM_GLOBAL_FUNC(call_thiscall_func,
......
......@@ -28,7 +28,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
#define DEFINE_VTBL_WRAPPER(off) \
__ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
......
......@@ -1717,7 +1717,7 @@ void __cdecl __ExceptionPtrCreate(exception_ptr *ep)
ep->ref = NULL;
}
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
extern void call_dtor(const cxx_exception_type *type, void *func, void *object);
__ASM_GLOBAL_FUNC( call_dtor,
......@@ -1732,7 +1732,7 @@ static inline void call_dtor(const cxx_exception_type *type, unsigned int dtor,
func(object);
}
#else
#define call_dtor(type, func, object) ((void (__cdecl*)(void*))(func))(object)
#define call_dtor(type, func, object) ((void (__thiscall*)(void*))(func))(object)
#endif
/*********************************************************************
......
......@@ -240,7 +240,7 @@ typedef struct
#endif
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (WINAPI*)type)&vtbl_wrapper_##off)args
......@@ -260,7 +260,7 @@ extern void *vtbl_wrapper_48;
#else
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__cdecl***)type)this)[0][off/4]args
#define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__thiscall***)type)this)[0][off/4]args
#endif
......
......@@ -36,7 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
static int context_id = -1;
static int scheduler_id = -1;
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
#define DEFINE_VTBL_WRAPPER(off) \
__ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
......
......@@ -277,7 +277,7 @@ void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_
/* txthost.c */
ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10) DECLSPEC_HIDDEN;
#ifdef __i386__ /* Use wrappers to perform thiscall on i386 */
#if defined(__i386__) && !defined(__MINGW32__) /* Use wrappers to perform thiscall on i386 */
#define TXTHOST_VTABLE(This) (&itextHostStdcallVtbl)
#else /* __i386__ */
#define TXTHOST_VTABLE(This) (This)->lpVtbl
......
......@@ -51,7 +51,7 @@
#include "wine/heap.h"
#include "wine/list.h"
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
extern const struct ITextHostVtbl itextHostStdcallVtbl DECLSPEC_HIDDEN;
#endif /* __i386__ */
......
......@@ -525,7 +525,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetSelectionBarWidth(ITextHos
}
#ifdef __i386__ /* thiscall functions are i386-specific */
#if defined(__i386__) && !defined(__MINGW32__) /* thiscall functions are i386-specific */
#define STDCALL(func) (void *) __stdcall_ ## func
#ifdef _MSC_VER
......
......@@ -98,6 +98,8 @@ DECLARE_INTERFACE_(IMILBitmapScaler,IMILBitmapSource)
};
#undef INTERFACE
#define THISCALLMETHOD_(type,method) type (__thiscall *method)
#define INTERFACE IMILUnknown1
DECLARE_INTERFACE_(IMILUnknown1,IUnknown)
{
......@@ -105,19 +107,14 @@ DECLARE_INTERFACE_(IMILUnknown1,IUnknown)
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** thiscall method ***/
STDMETHOD_(void,unknown1)(THIS_ void*) PURE;
/*** stdcall ***/
THISCALLMETHOD_(void,unknown1)(THIS_ void*) PURE;
STDMETHOD_(HRESULT,unknown2)(THIS_ void*, void*) PURE;
/*** thiscall method ***/
STDMETHOD_(HRESULT,unknown3)(THIS_ void*) PURE;
/*** stdcall ***/
THISCALLMETHOD_(HRESULT,unknown3)(THIS_ void*) PURE;
STDMETHOD_(HRESULT,unknown4)(THIS_ void*) PURE;
STDMETHOD_(HRESULT,unknown5)(THIS_ void*) PURE;
STDMETHOD_(HRESULT,unknown6)(THIS_ DWORD64) PURE;
STDMETHOD_(HRESULT,unknown7)(THIS_ void*) PURE;
/*** thiscall method ***/
STDMETHOD_(HRESULT,unknown8)(THIS) PURE;
THISCALLMETHOD_(HRESULT,unknown8)(THIS) PURE;
};
#undef INTERFACE
......
......@@ -23,6 +23,12 @@
extern "C" {
#endif
#ifdef __cplusplus
#define THISCALLMETHOD_(type,method) virtual type __thiscall method
#else
#define THISCALLMETHOD_(type,method) type (__thiscall *method)
#endif
EXTERN_C const IID IID_ITextServices;
EXTERN_C const IID IID_ITextHost;
......@@ -43,10 +49,10 @@ DECLARE_INTERFACE_(ITextServices,IUnknown)
/*** ITextServices methods ***/
STDMETHOD(TxSendMessage)( THIS_
THISCALLMETHOD_(HRESULT,TxSendMessage)( THIS_
UINT msg, WPARAM wparam, LPARAM lparam, LRESULT* plresult) PURE;
STDMETHOD(TxDraw)( THIS_
THISCALLMETHOD_(HRESULT,TxDraw)( THIS_
DWORD dwDrawAspect,
LONG lindex,
void* pvAspect,
......@@ -60,21 +66,21 @@ DECLARE_INTERFACE_(ITextServices,IUnknown)
DWORD dwContinue,
LONG lViewId) PURE;
STDMETHOD(TxGetHScroll)( THIS_
THISCALLMETHOD_(HRESULT,TxGetHScroll)( THIS_
LONG* plMin,
LONG* plMax,
LONG* plPos,
LONG* plPage,
BOOL* pfEnabled) PURE;
STDMETHOD(TxGetVScroll)( THIS_
THISCALLMETHOD_(HRESULT,TxGetVScroll)( THIS_
LONG* plMin,
LONG* plMax,
LONG* plPos,
LONG* plPage,
BOOL* pfEnabled) PURE;
STDMETHOD(OnTxSetCursor)( THIS_
THISCALLMETHOD_(HRESULT,OnTxSetCursor)( THIS_
DWORD dwDrawAspect,
LONG lindex,
void* pvAspect,
......@@ -85,7 +91,7 @@ DECLARE_INTERFACE_(ITextServices,IUnknown)
INT x,
INT y) PURE;
STDMETHOD(TxQueryHitPoint)( THIS_
THISCALLMETHOD_(HRESULT,TxQueryHitPoint)( THIS_
DWORD dwDrawAspect,
LONG lindex,
void* pvAspect,
......@@ -97,28 +103,28 @@ DECLARE_INTERFACE_(ITextServices,IUnknown)
INT y,
DWORD* pHitResult) PURE;
STDMETHOD(OnTxInplaceActivate)( THIS_
THISCALLMETHOD_(HRESULT,OnTxInplaceActivate)( THIS_
LPCRECT prcClient) PURE;
STDMETHOD(OnTxInplaceDeactivate)( THIS ) PURE;
THISCALLMETHOD_(HRESULT,OnTxInplaceDeactivate)( THIS ) PURE;
STDMETHOD(OnTxUIActivate)( THIS ) PURE;
THISCALLMETHOD_(HRESULT,OnTxUIActivate)( THIS ) PURE;
STDMETHOD(OnTxUIDeactivate)( THIS ) PURE;
THISCALLMETHOD_(HRESULT,OnTxUIDeactivate)( THIS ) PURE;
STDMETHOD(TxGetText)( THIS_
THISCALLMETHOD_(HRESULT,TxGetText)( THIS_
BSTR* pbstrText) PURE;
STDMETHOD(TxSetText)( THIS_
THISCALLMETHOD_(HRESULT,TxSetText)( THIS_
LPCWSTR pszText) PURE;
STDMETHOD(TxGetCurTargetX)( THIS_
THISCALLMETHOD_(HRESULT,TxGetCurTargetX)( THIS_
LONG* x) PURE;
STDMETHOD(TxGetBaseLinePos)( THIS_
THISCALLMETHOD_(HRESULT,TxGetBaseLinePos)( THIS_
LONG* x) PURE;
STDMETHOD(TxGetNaturalSize)( THIS_
THISCALLMETHOD_(HRESULT,TxGetNaturalSize)( THIS_
DWORD dwAspect,
HDC hdcDraw,
HDC hicTargetDev,
......@@ -128,14 +134,14 @@ DECLARE_INTERFACE_(ITextServices,IUnknown)
LONG* pwidth,
LONG* pheight) PURE;
STDMETHOD(TxGetDropTarget)( THIS_
THISCALLMETHOD_(HRESULT,TxGetDropTarget)( THIS_
IDropTarget** ppDropTarget) PURE;
STDMETHOD(OnTxPropertyBitsChange)( THIS_
THISCALLMETHOD_(HRESULT,OnTxPropertyBitsChange)( THIS_
DWORD dwMask,
DWORD dwBits) PURE;
STDMETHOD(TxGetCachedSize)( THIS_
THISCALLMETHOD_(HRESULT,TxGetCachedSize)( THIS_
DWORD* pdwWidth,
DWORD* pdwHeight) PURE;
......@@ -210,58 +216,58 @@ DECLARE_INTERFACE_(ITextHost,IUnknown)
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** ITextHost methods ***/
STDMETHOD_(HDC,TxGetDC)( THIS
THISCALLMETHOD_(HDC,TxGetDC)( THIS
) PURE;
STDMETHOD_(INT,TxReleaseDC)( THIS_
THISCALLMETHOD_(INT,TxReleaseDC)( THIS_
HDC hdc) PURE;
STDMETHOD_(BOOL,TxShowScrollBar)( THIS_
THISCALLMETHOD_(BOOL,TxShowScrollBar)( THIS_
INT fnBar,
BOOL fShow) PURE;
STDMETHOD_(BOOL,TxEnableScrollBar)( THIS_
THISCALLMETHOD_(BOOL,TxEnableScrollBar)( THIS_
INT fuSBFlags,
INT fuArrowflags) PURE;
STDMETHOD_(BOOL,TxSetScrollRange)( THIS_
THISCALLMETHOD_(BOOL,TxSetScrollRange)( THIS_
INT fnBar,
LONG nMinPos,
INT nMaxPos,
BOOL fRedraw) PURE;
STDMETHOD_(BOOL,TxSetScrollPos)( THIS_
THISCALLMETHOD_(BOOL,TxSetScrollPos)( THIS_
INT fnBar,
INT nPos,
BOOL fRedraw) PURE;
STDMETHOD_(void,TxInvalidateRect)( THIS_
THISCALLMETHOD_(void,TxInvalidateRect)( THIS_
LPCRECT prc,
BOOL fMode) PURE;
STDMETHOD_(void,TxViewChange)( THIS_
THISCALLMETHOD_(void,TxViewChange)( THIS_
BOOL fUpdate) PURE;
STDMETHOD_(BOOL,TxCreateCaret)( THIS_
THISCALLMETHOD_(BOOL,TxCreateCaret)( THIS_
HBITMAP hbmp,
INT xWidth,
INT yHeight) PURE;
STDMETHOD_(BOOL,TxShowCaret)( THIS_
THISCALLMETHOD_(BOOL,TxShowCaret)( THIS_
BOOL fShow) PURE;
STDMETHOD_(BOOL,TxSetCaretPos)( THIS_
THISCALLMETHOD_(BOOL,TxSetCaretPos)( THIS_
INT x,
INT y) PURE;
STDMETHOD_(BOOL,TxSetTimer)( THIS_
THISCALLMETHOD_(BOOL,TxSetTimer)( THIS_
UINT idTimer,
UINT uTimeout) PURE;
STDMETHOD_(void,TxKillTimer)( THIS_
THISCALLMETHOD_(void,TxKillTimer)( THIS_
UINT idTimer) PURE;
STDMETHOD_(void,TxScrollWindowEx)( THIS_
THISCALLMETHOD_(void,TxScrollWindowEx)( THIS_
INT dx,
INT dy,
LPCRECT lprcScroll,
......@@ -270,82 +276,82 @@ DECLARE_INTERFACE_(ITextHost,IUnknown)
LPRECT lprcUpdate,
UINT fuScroll) PURE;
STDMETHOD_(void,TxSetCapture)( THIS_
THISCALLMETHOD_(void,TxSetCapture)( THIS_
BOOL fCapture) PURE;
STDMETHOD_(void,TxSetFocus)( THIS
THISCALLMETHOD_(void,TxSetFocus)( THIS
) PURE;
STDMETHOD_(void,TxSetCursor)( THIS_
THISCALLMETHOD_(void,TxSetCursor)( THIS_
HCURSOR hcur,
BOOL fText) PURE;
STDMETHOD_(BOOL,TxScreenToClient)( THIS_
THISCALLMETHOD_(BOOL,TxScreenToClient)( THIS_
LPPOINT lppt) PURE;
STDMETHOD_(BOOL,TxClientToScreen)( THIS_
THISCALLMETHOD_(BOOL,TxClientToScreen)( THIS_
LPPOINT lppt) PURE;
STDMETHOD(TxActivate)( THIS_
THISCALLMETHOD_(HRESULT,TxActivate)( THIS_
LONG* plOldState) PURE;
STDMETHOD(TxDeactivate)( THIS_
THISCALLMETHOD_(HRESULT,TxDeactivate)( THIS_
LONG lNewState) PURE;
STDMETHOD(TxGetClientRect)( THIS_
THISCALLMETHOD_(HRESULT,TxGetClientRect)( THIS_
LPRECT prc) PURE;
STDMETHOD(TxGetViewInset)( THIS_
THISCALLMETHOD_(HRESULT,TxGetViewInset)( THIS_
LPRECT prc) PURE;
STDMETHOD(TxGetCharFormat)( THIS_
THISCALLMETHOD_(HRESULT,TxGetCharFormat)( THIS_
const CHARFORMATW** ppCF) PURE;
STDMETHOD(TxGetParaFormat)( THIS_
THISCALLMETHOD_(HRESULT,TxGetParaFormat)( THIS_
const PARAFORMAT** ppPF) PURE;
STDMETHOD_(COLORREF,TxGetSysColor)( THIS_
THISCALLMETHOD_(COLORREF,TxGetSysColor)( THIS_
int nIndex) PURE;
STDMETHOD(TxGetBackStyle)( THIS_
THISCALLMETHOD_(HRESULT,TxGetBackStyle)( THIS_
TXTBACKSTYLE* pStyle) PURE;
STDMETHOD(TxGetMaxLength)( THIS_
THISCALLMETHOD_(HRESULT,TxGetMaxLength)( THIS_
DWORD* plength) PURE;
STDMETHOD(TxGetScrollBars)( THIS_
THISCALLMETHOD_(HRESULT,TxGetScrollBars)( THIS_
DWORD* pdwScrollBar) PURE;
STDMETHOD(TxGetPasswordChar)( THIS_
THISCALLMETHOD_(HRESULT,TxGetPasswordChar)( THIS_
WCHAR* pch) PURE;
STDMETHOD(TxGetAcceleratorPos)( THIS_
THISCALLMETHOD_(HRESULT,TxGetAcceleratorPos)( THIS_
LONG* pch) PURE;
STDMETHOD(TxGetExtent)( THIS_
THISCALLMETHOD_(HRESULT,TxGetExtent)( THIS_
LPSIZEL lpExtent) PURE;
STDMETHOD(OnTxCharFormatChange)( THIS_
THISCALLMETHOD_(HRESULT,OnTxCharFormatChange)( THIS_
const CHARFORMATW* pcf) PURE;
STDMETHOD(OnTxParaFormatChange)( THIS_
THISCALLMETHOD_(HRESULT,OnTxParaFormatChange)( THIS_
const PARAFORMAT* ppf) PURE;
STDMETHOD(TxGetPropertyBits)( THIS_
THISCALLMETHOD_(HRESULT,TxGetPropertyBits)( THIS_
DWORD dwMask,
DWORD* pdwBits) PURE;
STDMETHOD(TxNotify)( THIS_
THISCALLMETHOD_(HRESULT,TxNotify)( THIS_
DWORD iNotify,
void* pv) PURE;
STDMETHOD_(HIMC,TxImmGetContext)( THIS
THISCALLMETHOD_(HIMC,TxImmGetContext)( THIS
) PURE;
STDMETHOD_(void,TxImmReleaseContext)( THIS_
THISCALLMETHOD_(void,TxImmReleaseContext)( THIS_
HIMC himc) PURE;
STDMETHOD(TxGetSelectionBarWidth)( THIS_
THISCALLMETHOD_(HRESULT,TxGetSelectionBarWidth)( THIS_
LONG* lSelBarWidth) PURE;
};
......
......@@ -106,6 +106,10 @@ extern "C" {
# endif
#endif
#ifndef __thiscall
# define __thiscall __stdcall
#endif
#ifndef __ms_va_list
# if (defined(__x86_64__) || defined(__aarch64__)) && defined (__GNUC__)
# define __ms_va_list __builtin_ms_va_list
......
......@@ -90,14 +90,11 @@
/* thiscall support */
#undef __thiscall
#define __thiscall __stdcall
#ifdef __i386__
#if defined(__i386__) && !defined(__MINGW32__)
# ifdef _MSC_VER
# define DEFINE_THISCALL_WRAPPER(func,args) \
__declspec(naked) HRESULT __thiscall_##func(void) \
__declspec(naked) void __thiscall_##func(void) \
{ __asm { \
pop eax \
push ecx \
......@@ -107,7 +104,7 @@
# else /* _MSC_VER */
# define DEFINE_THISCALL_WRAPPER(func,args) \
extern void __thiscall_ ## func(void); \
__ASM_GLOBAL_FUNC( __thiscall_ ## func, \
__ASM_STDCALL_FUNC( __thiscall_ ## func, args, \
"popl %eax\n\t" \
"pushl %ecx\n\t" \
"pushl %eax\n\t" \
......
......@@ -900,8 +900,8 @@ const char *get_link_name( const ORDDEF *odp )
if (target_platform == PLATFORM_WINDOWS)
{
if (odp->flags & FLAG_THISCALL) ret = strmake( "__thiscall_%s", odp->link_name );
else if (odp->flags & FLAG_FASTCALL) ret = strmake( "@%s@%u", odp->link_name, get_args_size( odp ));
if (odp->flags & FLAG_THISCALL) return odp->link_name;
if (odp->flags & FLAG_FASTCALL) ret = strmake( "@%s@%u", odp->link_name, get_args_size( odp ));
else if (!kill_at) ret = strmake( "%s@%u", odp->link_name, get_args_size( odp ));
else return odp->link_name;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment