Module: wine Branch: oldstable Commit: 04643db34f4cb911d8dbb9a08bdd93a73a3aac19 URL: https://source.winehq.org/git/wine.git/?a=commit;h=04643db34f4cb911d8dbb9a08...
Author: Michael Stefaniuc mstefani@winehq.org Date: Thu May 24 23:46:27 2018 +0200
include: Make ARRAY_SIZE() available in wine/test.h.
Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 7b5668a6e7bccdaefb69e099345fc7c3855a5cec) Conflicts: dlls/ddraw/tests/ddraw1.c dlls/ddraw/tests/ddraw2.c dlls/dmcompos/tests/dmcompos.c dlls/dmloader/tests/loader.c dlls/dmstyle/tests/dmstyle.c dlls/xmllite/tests/reader.c Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/comdlg32/tests/filedlg.c | 2 -- dlls/d2d1/tests/d2d1.c | 4 ---- dlls/d3d10core/tests/device.c | 4 ---- dlls/d3d11/tests/d3d11.c | 4 ---- dlls/d3d8/tests/device.c | 2 -- dlls/d3d9/tests/device.c | 2 -- dlls/d3dx9_36/tests/effect.c | 2 -- dlls/d3dx9_36/tests/math.c | 2 -- dlls/d3dx9_36/tests/mesh.c | 2 -- dlls/ddraw/tests/ddraw1.c | 4 ---- dlls/ddraw/tests/ddraw2.c | 4 ---- dlls/ddraw/tests/ddraw4.c | 4 ---- dlls/ddraw/tests/ddraw7.c | 4 ---- dlls/dmcompos/tests/dmcompos.c | 2 -- dlls/dmime/tests/dmime.c | 2 -- dlls/dmloader/tests/loader.c | 2 -- dlls/dmstyle/tests/dmstyle.c | 2 -- dlls/shell32/tests/shellpath.c | 4 ---- dlls/user32/tests/cursoricon.c | 2 -- include/wine/test.h | 2 ++ 20 files changed, 2 insertions(+), 54 deletions(-)
diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c index ff973a7..5544cf7 100644 --- a/dlls/comdlg32/tests/filedlg.c +++ b/dlls/comdlg32/tests/filedlg.c @@ -1028,8 +1028,6 @@ static UINT_PTR WINAPI test_extension_wndproc(HWND dlg, UINT msg, WPARAM wParam, return FALSE; }
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - static void test_extension_helper(OPENFILENAMEA* ofn, const char *filter, const char *expected_filename) { diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 9bd9e2b..9892bcc 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -26,10 +26,6 @@ #include "dwrite.h" #include "wincodec.h"
-#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct resource_readback { ID3D10Resource *resource; diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index ca0fd8b..824b874 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -23,10 +23,6 @@ #include "wine/test.h" #include <limits.h>
-#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - #define BITS_NNAN 0xffc00000 #define BITS_NAN 0x7fc00000 #define BITS_NINF 0xff800000 diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 74c0488..4d50e79 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -27,10 +27,6 @@ #include "d3d11_1.h" #include "wine/test.h"
-#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - #define BITS_NNAN 0xffc00000 #define BITS_NAN 0x7fc00000 #define BITS_NINF 0xff800000 diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index a9188f0..c9e12f2 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -28,8 +28,6 @@ #include <d3d8.h> #include "wine/test.h"
-#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - struct vec3 { float x, y, z; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index a9fd4e4..325084e 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -27,8 +27,6 @@ #include <d3d9.h> #include "wine/test.h"
-#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - struct vec3 { float x, y, z; diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index 1900f3e..2d6f339 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -41,8 +41,6 @@ static float get_nan(void) #define NAN get_nan() #endif
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*arr)) - /* helper functions */ static BOOL compare_float(FLOAT f, FLOAT g, UINT ulps) { diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c index b687e5d..e433b1f 100644 --- a/dlls/d3dx9_36/tests/math.c +++ b/dlls/d3dx9_36/tests/math.c @@ -23,8 +23,6 @@ #include "d3dx9.h" #include <math.h>
-#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - static BOOL compare_float(float f, float g, unsigned int ulps) { int x = *(int *)&f; diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c index 82ae90e..8b7f9cd 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c @@ -42,8 +42,6 @@ static inline float __port_nan(void)
#define admitted_error 0.0001f
-#define ARRAY_SIZE(array) (sizeof(array)/sizeof(*array)) - #define compare_vertex_sizes(type, exp) \ got=D3DXGetFVFVertexSize(type); \ ok(got==exp, "Expected: %d, Got: %d\n", exp, got); diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 3e7b535..c5bb753 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -29,10 +29,6 @@ static DEVMODEW registry_mode;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
-#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct vec4 { float x, y, z, w; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index faf7cef..c62b913 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -31,10 +31,6 @@ static DEVMODEW registry_mode;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
-#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct vec4 { float x, y, z, w; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1f0b01b..38d364d 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -31,10 +31,6 @@ static DEVMODEW registry_mode;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
-#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct vec2 { float x, y; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 2e41ff3..2a76d8c 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -32,10 +32,6 @@ static DEVMODEW registry_mode;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
-#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct vec2 { float x, y; diff --git a/dlls/dmcompos/tests/dmcompos.c b/dlls/dmcompos/tests/dmcompos.c index 26c6e1f..408c266 100644 --- a/dlls/dmcompos/tests/dmcompos.c +++ b/dlls/dmcompos/tests/dmcompos.c @@ -24,8 +24,6 @@ #include <wine/test.h> #include <dmusici.h>
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - static BOOL missing_dmcompos(void) { IDirectMusicComposer *dmc; diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index 62a977e..0ed3b10 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -25,8 +25,6 @@ #include <audioclient.h> #include <guiddef.h>
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - static BOOL missing_dmime(void) { IDirectMusicSegment8 *dms; diff --git a/dlls/dmloader/tests/loader.c b/dlls/dmloader/tests/loader.c index ff084b6..bad001d 100644 --- a/dlls/dmloader/tests/loader.c +++ b/dlls/dmloader/tests/loader.c @@ -22,8 +22,6 @@ #include "dmusici.h" #include "wine/test.h"
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - static unsigned char mp3file[] = "\xFF\xFB\x92\x04"; /* MP3 header */ static unsigned char rifffile[8+4+8+16+8+256] = "RIFF\x24\x01\x00\x00WAVE" /* header: 4 ("WAVE") + (8 + 16) (format segment) + (8 + 256) (data segment) = 0x124 */ "fmt \x10\x00\x00\x00\x01\x00\x20\x00\xAC\x44\x00\x00\x10\xB1\x02\x00\x04\x00\x10\x00" /* format segment: PCM, 2 chan, 44100 Hz, 16 bits */ diff --git a/dlls/dmstyle/tests/dmstyle.c b/dlls/dmstyle/tests/dmstyle.c index 664b208..b0fc590 100644 --- a/dlls/dmstyle/tests/dmstyle.c +++ b/dlls/dmstyle/tests/dmstyle.c @@ -24,8 +24,6 @@ #include <wine/test.h> #include <dmusici.h>
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - static BOOL missing_dmstyle(void) { IDirectMusicStyle *dms; diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index f667431..613c4eb 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -43,10 +43,6 @@
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
-#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) ( sizeof(x) / sizeof((x)[0]) ) -#endif - /* from pidl.h, not included here: */ #ifndef PT_CPL /* Guess, Win7 uses this for CSIDL_CONTROLS */ #define PT_CPL 0x01 /* no path */ diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c index 5099c08..95a6878 100644 --- a/dlls/user32/tests/cursoricon.c +++ b/dlls/user32/tests/cursoricon.c @@ -1053,8 +1053,6 @@ static const DWORD biSize_tests[] = { 0xffffffff };
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - static void test_LoadImageBitmap(const char * test_desc, HBITMAP hbm) { BITMAP bm; diff --git a/include/wine/test.h b/include/wine/test.h index 4ec66d5..d3ccd09 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -127,6 +127,8 @@ extern void __winetest_cdecl winetest_trace( const char *msg, ... ) WINETEST_PRI #define todo_wine_if(is_todo) todo_if((is_todo) && !strcmp(winetest_platform, "wine"))
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + #ifdef NONAMELESSUNION # define U(x) (x).u # define U1(x) (x).u1