From c2d5b444b3de01143f29ab2943d414da1b464b2a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 13 Jun 2005 12:10:54 +0000 Subject: [PATCH] Moved the NONAMELESSUNION/STRUCT macros to wine/test.h so that they can be used in all the test. --- dlls/ddraw/tests/d3d.c | 12 ---------- dlls/ddraw/tests/ddrawmodes.c | 10 ++------- dlls/ddraw/tests/dsurface.c | 8 ------- dlls/kernel/tests/file.c | 11 ---------- dlls/ole32/tests/propvariant.c | 6 ----- dlls/ole32/tests/stg_prop.c | 6 ----- dlls/oleaut32/tests/vartest.c | 15 ------------- dlls/oleaut32/tests/vartype.c | 15 ------------- dlls/urlmon/tests/url.c | 6 ----- dlls/winmm/tests/mixer.c | 12 ---------- include/wine/test.h | 40 ++++++++++++++++++++++++++++++++++ 11 files changed, 42 insertions(+), 99 deletions(-) diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 85925754603..d9a313e244b 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -23,18 +23,6 @@ #include "ddraw.h" #include "d3d.h" -#ifdef NONAMELESSUNION -# define U(x) (x).u -# define U1(x) (x).u1 -# define U2(x) (x).u2 -# define U3(x) (x).u3 -#else -# define U(x) (x) -# define U1(x) (x) -# define U2(x) (x) -# define U3(x) (x) -#endif - static LPDIRECTDRAW7 lpDD = NULL; static LPDIRECT3D7 lpD3D = NULL; static LPDIRECTDRAWSURFACE7 lpDDS = NULL; diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c index 165e8b9c528..c625d165cc0 100644 --- a/dlls/ddraw/tests/ddrawmodes.c +++ b/dlls/ddraw/tests/ddrawmodes.c @@ -22,12 +22,6 @@ #include "wine/test.h" #include "ddraw.h" -#ifdef NONAMELESSUNION -#define UNION_MEMBER(x, y) DUMMYUNIONNAME##x.y -#else -#define UNION_MEMBER(x, y) y -#endif - static LPDIRECTDRAW lpDD = NULL; static LPDIRECTDRAWSURFACE lpDDSPrimary = NULL; static LPDIRECTDRAWSURFACE lpDDSBack = NULL; @@ -100,7 +94,7 @@ HRESULT WINAPI enummodescallback(LPDDSURFACEDESC lpddsd, LPVOID lpContext) { trace("Width = %li, Height = %li, Refresh Rate = %li\r\n", lpddsd->dwWidth, lpddsd->dwHeight, - lpddsd->UNION_MEMBER(2, dwRefreshRate)); + U2(*lpddsd).dwRefreshRate); adddisplaymode(lpddsd); return DDENUMRET_OK; @@ -134,7 +128,7 @@ static void setdisplaymode(int i) { rc = IDirectDraw_SetDisplayMode(lpDD, modes[i].dwWidth, modes[i].dwHeight, - modes[i].ddpfPixelFormat.UNION_MEMBER(1, dwRGBBitCount)); + U1(modes[i].ddpfPixelFormat).dwRGBBitCount); ok(DD_OK==rc || DDERR_UNSUPPORTED==rc,"SetDisplayMode returned: %lx\n",rc); if (DD_OK==rc) { rc = IDirectDraw_RestoreDisplayMode(lpDD); diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 86390f8ad58..6cf602536be 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -22,14 +22,6 @@ #include "wine/test.h" #include "ddraw.h" -#ifdef NONAMELESSUNION -# define U(x) (x).u -# define U2(x) (x).u2 -#else -# define U(x) (x) -# define U2(x) (x) -#endif - static LPDIRECTDRAW lpDD = NULL; static void CreateDirectDraw() diff --git a/dlls/kernel/tests/file.c b/dlls/kernel/tests/file.c index 5eb66aad76b..57fb11d4c27 100644 --- a/dlls/kernel/tests/file.c +++ b/dlls/kernel/tests/file.c @@ -28,17 +28,6 @@ #include "winbase.h" #include "winerror.h" -#ifdef NONAMELESSUNION -# define U(x) (x).u -#else -# define U(x) (x) -#endif -#ifdef NONAMELESSSTRUCT -# define S(x) (x).s -#else -# define S(x) (x) -#endif - static int dll_capable(const char *dll, const char *function) { HMODULE module = GetModuleHandleA(dll); diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c index 0f8000f64ea..0c5aa61ba38 100644 --- a/dlls/ole32/tests/propvariant.c +++ b/dlls/ole32/tests/propvariant.c @@ -22,12 +22,6 @@ #include "wine/test.h" -#ifdef NONAMELESSUNION -# define U(x) (x).u -#else -# define U(x) (x) -#endif - /* invalid in all versions */ #define PROP_INV 255 /* valid in v0 and above (NT4+) */ diff --git a/dlls/ole32/tests/stg_prop.c b/dlls/ole32/tests/stg_prop.c index 262151e8e7c..e0165c94d77 100644 --- a/dlls/ole32/tests/stg_prop.c +++ b/dlls/ole32/tests/stg_prop.c @@ -20,12 +20,6 @@ #include "objbase.h" #include "wine/test.h" -#ifdef NONAMELESSUNION -# define U(x) (x).u -#else -# define U(x) (x) -#endif - static HRESULT (WINAPI *pFmtIdToPropStgName)(const FMTID *, LPOLESTR); static HRESULT (WINAPI *pPropStgNameToFmtId)(const LPOLESTR, FMTID *); static HRESULT (WINAPI *pStgCreatePropSetStg)(IStorage *, DWORD, IPropertySetStorage **); diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index b6c4dba80bd..bd4538a553d 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -39,21 +39,6 @@ static HMODULE hOleaut32; -#ifdef NONAMELESSUNION -# define U(x) (x).u -# define U1(x) (x).u1 -#else -# define U(x) (x) -# define U1(x) (x) -#endif -#ifdef NONAMELESSSTRUCT -# define S(x) (x).s -# define S1(x) (x).s1 -#else -# define S(x) (x) -# define S1(x) (x) -#endif - static HRESULT (WINAPI *pVarUdateFromDate)(DATE,ULONG,UDATE*); static HRESULT (WINAPI *pVarDateFromUdate)(UDATE*,ULONG,DATE*); static INT (WINAPI *pSystemTimeToVariantTime)(LPSYSTEMTIME,double*); diff --git a/dlls/oleaut32/tests/vartype.c b/dlls/oleaut32/tests/vartype.c index 66c50d06eb8..82433760402 100644 --- a/dlls/oleaut32/tests/vartype.c +++ b/dlls/oleaut32/tests/vartype.c @@ -44,21 +44,6 @@ static HMODULE hOleaut32; -#ifdef NONAMELESSUNION -# define U(x) (x).u -# define U1(x) (x).u1 -#else -# define U(x) (x) -# define U1(x) (x) -#endif -#ifdef NONAMELESSSTRUCT -# define S(x) (x).s -# define S1(x) (x).s1 -#else -# define S(x) (x) -# define S1(x) (x) -#endif - /* Get a conversion function ptr, return if function not available */ #define CHECKPTR(func) p##func = (void*)GetProcAddress(hOleaut32, #func); \ if (!p##func) { \ diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index f0ea2c00bc0..90787e3acf0 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -29,12 +29,6 @@ #include "wine/test.h" -#ifdef NONAMELESSUNION -# define U(x) (x).u -#else -# define U(x) (x) -#endif - static const WCHAR TEST_URL_1[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g','/','\0'}; static const WCHAR TEST_PART_URL_1[] = {'/','t','e','s','t','/','\0'}; diff --git a/dlls/winmm/tests/mixer.c b/dlls/winmm/tests/mixer.c index ac8656b8533..7a74210eda2 100644 --- a/dlls/winmm/tests/mixer.c +++ b/dlls/winmm/tests/mixer.c @@ -36,18 +36,6 @@ #include "winmm_test.h" -#ifdef NONAMELESSSTRUCT -# define S1(x) (x).s1 -#else -# define S1(x) (x) -#endif - -#ifdef NONAMELESSUNION -# define U(x) (x).u -#else -# define U(x) (x) -#endif - static const char * line_flags(DWORD fdwLine) { static char flags[100]; diff --git a/include/wine/test.h b/include/wine/test.h index 1ef83b1d66c..7ac9851d2eb 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -23,6 +23,7 @@ #include #include +#include /* debug level */ extern int winetest_debug; @@ -72,6 +73,45 @@ extern void winetest_trace( const char *msg, ... ); #define todo_wine todo("wine") +#ifdef NONAMELESSUNION +# define U(x) (x).u +# define U1(x) (x).u1 +# define U2(x) (x).u2 +# define U3(x) (x).u3 +# define U4(x) (x).u4 +# define U5(x) (x).u5 +# define U6(x) (x).u6 +# define U7(x) (x).u7 +# define U8(x) (x).u8 +#else +# define U(x) (x) +# define U1(x) (x) +# define U2(x) (x) +# define U3(x) (x) +# define U4(x) (x) +# define U5(x) (x) +# define U6(x) (x) +# define U7(x) (x) +# define U8(x) (x) +#endif + +#ifdef NONAMELESSSTRUCT +# define S(x) (x).s +# define S1(x) (x).s1 +# define S2(x) (x).s2 +# define S3(x) (x).s3 +# define S4(x) (x).s4 +# define S5(x) (x).s5 +#else +# define S(x) (x) +# define S1(x) (x) +# define S2(x) (x) +# define S3(x) (x) +# define S4(x) (x) +# define S5(x) (x) +#endif + + /************************************************************************/ /* Below is the implementation of the various functions, to be included * directly into the generated testlist.c file.