[1/2] kernel32/tests: Help the tests portably declare printf()-syle functions.

Francois Gouget fgouget at codeweavers.com
Wed Jan 13 05:42:54 CST 2016


To do so they can now use the WINETEST_PRINTF_ATTR() macro.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 dlls/kernel32/tests/debugger.c |  8 +-------
 include/wine/test.h            | 21 ++++++++-------------
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c
index 326a903..73320c6 100644
--- a/dlls/kernel32/tests/debugger.c
+++ b/dlls/kernel32/tests/debugger.c
@@ -30,12 +30,6 @@
 #define STATUS_DEBUGGER_INACTIVE         ((NTSTATUS) 0xC0000354)
 #endif
 
-#ifdef __GNUC__
-#define PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
-#else
-#define PRINTF_ATTR(fmt,args)
-#endif
-
 #define child_ok (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : test_child_ok
 
 static int    myARGC;
@@ -49,7 +43,7 @@ static struct _TEB * (WINAPI *pNtCurrentTeb)(void);
 
 static LONG child_failures;
 
-static void PRINTF_ATTR(2, 3) test_child_ok(int condition, const char *msg, ...)
+static void WINETEST_PRINTF_ATTR(2, 3) test_child_ok(int condition, const char *msg, ...)
 {
     va_list valist;
 
diff --git a/include/wine/test.h b/include/wine/test.h
index 567229a..84bf2ea 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -98,20 +98,15 @@ extern int winetest_vok( int condition, const char *msg, __winetest_va_list ap )
 extern void winetest_vskip( const char *msg, __winetest_va_list ap );
 
 #ifdef __GNUC__
+# define WINETEST_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
+#else
+# define WINETEST_PRINTF_ATTR(fmt,args)
+#endif
 
-extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... ) __attribute__((format (printf,2,3) ));
-extern void __winetest_cdecl winetest_skip( const char *msg, ... ) __attribute__((format (printf,1,2)));
-extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ) __attribute__((format (printf,1,2)));
-extern void __winetest_cdecl winetest_trace( const char *msg, ... ) __attribute__((format (printf,1,2)));
-
-#else /* __GNUC__ */
-
-extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... );
-extern void __winetest_cdecl winetest_skip( const char *msg, ... );
-extern void __winetest_cdecl winetest_win_skip( const char *msg, ... );
-extern void __winetest_cdecl winetest_trace( const char *msg, ... );
-
-#endif /* __GNUC__ */
+extern void __winetest_cdecl winetest_ok( int condition, const char *msg, ... ) WINETEST_PRINTF_ATTR(2,3);
+extern void __winetest_cdecl winetest_skip( const char *msg, ... ) WINETEST_PRINTF_ATTR(1,2);
+extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ) WINETEST_PRINTF_ATTR(1,2);
+extern void __winetest_cdecl winetest_trace( const char *msg, ... ) WINETEST_PRINTF_ATTR(1,2);
 
 #define ok_(file, line)       (winetest_set_location(file, line), 0) ? (void)0 : winetest_ok
 #define skip_(file, line)     (winetest_set_location(file, line), 0) ? (void)0 : winetest_skip
-- 
2.6.4




More information about the wine-patches mailing list