atl: Remove WINAPI on static functions where not needed.

Francois Gouget fgouget at codeweavers.com
Sun Nov 23 17:15:36 CST 2008


---

To quote Ken Thomases who did the research on this issue with Alexandre:

   This is motivated by a gcc bug that we've encountered on the Mac. On 
   the Mac, WINAPI (and other declspecs) include the 
   force_align_arg_pointer attribute. With -O2 optimization (actually 
   -funit-at-a-time, implied by -O2) the compiler may change the calling 
   convention used by non-exported functions to take arguments via 
   registers rather than on the stack.  The prologue generated for 
   force_align_arg_pointer clobbers one of those registers (and hence 
   one of the arguments).

   Alexandre's preferred solution is to find and eliminate such cases. 
   Even if/when the compiler bug is fixed, those functions should still 
   not have the extraneous declspec.

So I used a script to detect these issues in the Wine source. This gave 
me a list of the candidates for cleanup, as well as all the lines where 
they are used. After checking this I made the changes.

Astute readers will notice that this leaves one loophole: nasty macro 
use like in dlls/winmm/message16.c:

#define A(_x,_y) MMDRV_InstallMap(_x, \
MMDRV_##_y##_Map16To32W, MMDRV_##_y##_UnMap16To32W, \
MMDRV_##_y##_Map32WTo16, MMDRV_##_y##_UnMap32WTo16, \
MMDRV_##_y##_Callback)
    A(MMDRV_AUX,        Aux);

A grep would not find that MMDRV_Aux_Callback is referenced by the above 
code. So if you know of other places touched by these patches that 
may be victim of the above tricks, please let me know.

So this is the first round. The rest will follow once the first few 
patches have gone through.


 dlls/atl/atl_ax.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/atl/atl_ax.c b/dlls/atl/atl_ax.c
index e20c342..a5ae342 100644
--- a/dlls/atl/atl_ax.c
+++ b/dlls/atl/atl_ax.c
@@ -117,7 +117,7 @@ BOOL WINAPI AtlAxWinInit(void)
  */
 
 
-static ULONG WINAPI IOCS_AddRef(IOCS *This)
+static ULONG IOCS_AddRef(IOCS *This)
 {
     ULONG ref = InterlockedIncrement(&This->ref);
 
@@ -132,7 +132,7 @@ static ULONG WINAPI IOCS_AddRef(IOCS *This)
 #define THIS2IOLEINPLACEFRAME(This) ((IOleInPlaceFrame*)&This->lpOleInPlaceFrameVtbl)
 #define THIS2IOLECONTROLSITE(This) ((IOleControlSite*)&This->lpOleControlSiteVtbl)
 
-static HRESULT WINAPI IOCS_QueryInterface(IOCS *This, REFIID riid, void **ppv)
+static HRESULT IOCS_QueryInterface(IOCS *This, REFIID riid, void **ppv)
 {
     *ppv = NULL;
 
@@ -166,7 +166,7 @@ static HRESULT WINAPI IOCS_QueryInterface(IOCS *This, REFIID riid, void **ppv)
 }
 
 static HRESULT IOCS_Detach( IOCS *This );
-static ULONG WINAPI IOCS_Release(IOCS *This)
+static ULONG IOCS_Release(IOCS *This)
 {
     ULONG ref = InterlockedDecrement(&This->ref);
 
-- 
1.5.6.5




More information about the wine-patches mailing list