From f6dc7c88bac10b4f44cc195bc60407b03c861a02 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Wed, 13 Jan 2016 12:42:54 +0100 Subject: [PATCH] kernel32/tests: Help the tests portably declare printf()-syle functions. To do so they can now use the WINETEST_PRINTF_ATTR() macro. Signed-off-by: Francois Gouget Signed-off-by: Alexandre Julliard --- 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 326a903f1b5..73320c6859d 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 a5b67a02282..bed44f90231 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