diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h index fd697564afd..e14b7deaba5 100644 --- a/dlls/msvcp90/cxx.h +++ b/dlls/msvcp90/cxx.h @@ -18,29 +18,6 @@ #include "wine/asm.h" -/* Copied from dlls/msvcrt/cxx.h */ -#undef __thiscall -#ifdef __i386__ /* thiscall functions are i386-specific */ - -#define THISCALL(func) __thiscall_ ## func -#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) -#define __thiscall __stdcall -#define DEFINE_THISCALL_WRAPPER(func,args) \ - extern void THISCALL(func)(void); \ - __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ - "popl %eax\n\t" \ - "pushl %ecx\n\t" \ - "pushl %eax\n\t" \ - "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) -#else /* __i386__ */ - -#define THISCALL(func) func -#define THISCALL_NAME(func) __ASM_NAME(#func) -#define __thiscall __cdecl -#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ - -#endif /* __i386__ */ - #ifdef _WIN64 #define VTABLE_ADD_FUNC(name) "\t.quad " THISCALL_NAME(name) "\n" diff --git a/dlls/msvcrt/cxx.h b/dlls/msvcrt/cxx.h index 75677e28736..68783f5acd1 100644 --- a/dlls/msvcrt/cxx.h +++ b/dlls/msvcrt/cxx.h @@ -18,28 +18,6 @@ #include "wine/asm.h" -#undef __thiscall -#ifdef __i386__ /* thiscall functions are i386-specific */ - -#define THISCALL(func) __thiscall_ ## func -#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) -#define __thiscall __stdcall -#define DEFINE_THISCALL_WRAPPER(func,args) \ - extern void THISCALL(func)(void); \ - __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ - "popl %eax\n\t" \ - "pushl %ecx\n\t" \ - "pushl %eax\n\t" \ - "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) -#else /* __i386__ */ - -#define THISCALL(func) func -#define THISCALL_NAME(func) __ASM_NAME(#func) -#define __thiscall __cdecl -#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ - -#endif /* __i386__ */ - #ifdef _WIN64 #define VTABLE_ADD_FUNC(name) "\t.quad " THISCALL_NAME(name) "\n" diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c index ab9450383d4..e4c4e0c180f 100644 --- a/dlls/riched20/txthost.c +++ b/dlls/riched20/txthost.c @@ -500,35 +500,6 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i } -#ifdef __i386__ /* thiscall functions are i386-specific */ - -#define THISCALL(func) (void *) __thiscall_ ## func -#ifdef _MSC_VER -#define DEFINE_THISCALL_WRAPPER(func,args) \ - __declspec(naked) HRESULT __thiscall_##func(void) \ - { \ - __asm pop eax \ - __asm push ecx \ - __asm push eax \ - __asm jmp func \ - } -#else /* _MSC_VER */ -#define DEFINE_THISCALL_WRAPPER(func,args) \ - extern HRESULT __thiscall_ ## func(void); \ - __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ - "popl %eax\n\t" \ - "pushl %ecx\n\t" \ - "pushl %eax\n\t" \ - "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) -#endif /* _MSC_VER */ - -#else /* __i386__ */ - -#define THISCALL(func) func -#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ - -#endif /* __i386__ */ - DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetDC,4) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxReleaseDC,8) DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowScrollBar,12) diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c index a9ceef4dd1f..6777f97de4c 100644 --- a/dlls/riched20/txtsrv.c +++ b/dlls/riched20/txtsrv.c @@ -34,35 +34,6 @@ #include "wine/debug.h" #include "editstr.h" -#ifdef __i386__ /* thiscall functions are i386-specific */ - -#define THISCALL(func) (void *) __thiscall_ ## func -#ifdef _MSC_VER -#define DEFINE_THISCALL_WRAPPER(func,args) \ - __declspec(naked) HRESULT __thiscall_##func(void) \ - { \ - __asm pop eax \ - __asm push ecx \ - __asm push eax \ - __asm jmp func \ - } -#else /* _MSC_VER */ -#define DEFINE_THISCALL_WRAPPER(func,args) \ - extern HRESULT __thiscall_ ## func(void); \ - __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ - "popl %eax\n\t" \ - "pushl %ecx\n\t" \ - "pushl %eax\n\t" \ - "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) -#endif /* _MSC_VER */ - -#else /* __i386__ */ - -#define THISCALL(func) func -#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ - -#endif /* __i386__ */ - WINE_DEFAULT_DEBUG_CHANNEL(richedit); typedef struct ITextServicesImpl { diff --git a/dlls/vssapi/main.c b/dlls/vssapi/main.c index 2ebd2041f89..526772add19 100644 --- a/dlls/vssapi/main.c +++ b/dlls/vssapi/main.c @@ -28,28 +28,6 @@ WINE_DEFAULT_DEBUG_CHANNEL( vssapi ); -#undef __thiscall -#ifdef __i386__ /* thiscall functions are i386-specific */ - -#define THISCALL(func) __thiscall_ ## func -#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) -#define __thiscall __stdcall -#define DEFINE_THISCALL_WRAPPER(func,args) \ - extern void THISCALL(func)(void); \ - __ASM_GLOBAL_FUNC(__thiscall_ ## func, \ - "popl %eax\n\t" \ - "pushl %ecx\n\t" \ - "pushl %eax\n\t" \ - "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) -#else /* __i386__ */ - -#define THISCALL(func) func -#define THISCALL_NAME(func) __ASM_NAME(#func) -#define __thiscall __cdecl -#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ - -#endif /* __i386__ */ - struct CVssWriter { void **vtable; diff --git a/include/wine/asm.h b/include/wine/asm.h index f1c50fd6ad6..a581b120da3 100644 --- a/include/wine/asm.h +++ b/include/wine/asm.h @@ -88,4 +88,41 @@ #endif /* __i386__ */ +/* thiscall support */ + +#undef __thiscall +#define __thiscall __stdcall + +#ifdef __i386__ + +# ifdef _MSC_VER +# define DEFINE_THISCALL_WRAPPER(func,args) \ + __declspec(naked) HRESULT __thiscall_##func(void) \ + { __asm { \ + pop eax \ + push ecx \ + push eax \ + jmp func \ + } } +# else /* _MSC_VER */ +# define DEFINE_THISCALL_WRAPPER(func,args) \ + extern void __thiscall_ ## func(void); \ + __ASM_GLOBAL_FUNC( __thiscall_ ## func, \ + "popl %eax\n\t" \ + "pushl %ecx\n\t" \ + "pushl %eax\n\t" \ + "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) +# endif /* _MSC_VER */ + +# define THISCALL(func) (void *)__thiscall_ ## func +# define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func) + +#else /* __i386__ */ + +# define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */ +# define THISCALL(func) func +# define THISCALL_NAME(func) __ASM_NAME(#func) + +#endif /* __i386__ */ + #endif /* __WINE_WINE_ASM_H */