It is not very clear to me what the desicion was regarding these two patches so they have been resent.
The following patches introduce the FIXME_ONCE macro which suppresses repeated FIXMEs into WARNings. The current FIXME macro tends to be insufficient in cases where a developer wishes to suppresses fixmes other than the first. The first patch is the implementation while the second demonstrates how this could be useful.
It is based on the vkd3d version.
v2: Fix programming mistakes, fixed a test and some formating
v3: Fixed a programming error(s), dropped all patches except two
v4: Fixed more programming errors(s)
David Kahurani (2): include/wine: suppress subsequent FIXMEs into WARNINGs dlls/ntdll: Use FIXME_ONCE
dlls/ntdll/unix/system.c | 8 +++----- include/wine/debug.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-)
In situations where it is preferable to only print a FIXME once, suppress any subsequent calls to the FIXME into WARNINGs.
Signed-off-by: David Kahurani k.kahurani@gmail.com --- include/wine/debug.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/include/wine/debug.h b/include/wine/debug.h index 6aac7fe8..888cdd00 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -85,6 +85,15 @@ struct __wine_debug_channel const enum __wine_debug_class __dbcl = __WINE_DBCL##dbcl; \ __WINE_DBG_LOG
+#define __WINE_DPRINTF_ONCE(dbcl1,dbcl2,dbch) \ + do { if(__WINE_GET_DEBUGGING(dbcl1,(dbch))) { \ + static BOOL __wine_next_time_level;\ + struct __wine_debug_channel * const __dbch = (dbch); \ + const enum __wine_debug_class __dbcl = \ + __wine_next_time_level ? __WINE_DBCL##dbcl2 : __WINE_DBCL##dbcl1; \ + __wine_next_time_level = TRUE;\ + __WINE_DBG_LOG + #define __WINE_DBG_LOG(args...) \ wine_dbg_log( __dbcl, __dbch, __FUNCTION__, args); } } while(0)
@@ -115,6 +124,15 @@ struct __wine_debug_channel const enum __WINE_DEBUG_CLASS __dbcl = __WINE_DBCL##dbcl; \ __WINE_DBG_LOG
+#define __WINE_DPRINTF_ONCE(dbcl1,dbcl2,dbch) \ + do { if(__WINE_GET_DEBUGGING(dbcl1,(dbch))) { \ + static BOOL __wine_next_time_level;\ + struct __wine_debug_channel * const __dbch = (dbch); \ + const enum __wine_debug_class __dbcl = \ + next_time_level ? __WINE_DBCL##dbcl2 : __WINE_DBCL##dbcl1; \ + __wine_next_time_level = TRUE;\ + __WINE_DBG_LOG + #define __WINE_DBG_LOG(...) \ wine_dbg_log( __dbcl, __dbch, __func__, __VA_ARGS__); } } while(0)
@@ -134,6 +152,16 @@ struct __wine_debug_channel
#else /* !__GNUC__ && !__SUNPRO_C */
+#define __WINE_DPRINTF_ONCE(dbcl1,dbcl2,dbch) \ + do { \ + static BOOL __wine_next_time_level;\ + const enum __wine_debug_class __dbcl = \ + __wine_next_time_level ? __WINE_DBCL##dbcl2 : __WINE_DBCL##dbcl1;\ + (!__WINE_GET_DEBUGGING(dbcl1,(dbch)) || \ + (wine_dbg_log(__dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \ + (void)0 : (void)wine_dbg_printf \ + __wine_next_time_level = TRUE; } while (0) + #define __WINE_DPRINTF(dbcl,dbch) \ (!__WINE_GET_DEBUGGING(dbcl,(dbch)) || \ (wine_dbg_log(__WINE_DBCL##dbcl,(dbch),__FILE__,"%d: ",__LINE__) == -1)) ? \ @@ -487,6 +515,7 @@ static inline const char *wine_dbgstr_variant( const VARIANT *v )
#ifndef WINE_FIXME #define WINE_FIXME __WINE_DPRINTF(_FIXME,__wine_dbch___default) +#define WINE_FIXME_ONCE __WINE_DPRINTF_ONCE(_FIXME,_WARN,__wine_dbch___default) #define WINE_FIXME_(ch) __WINE_DPRINTF(_FIXME,&__wine_dbch_##ch) #endif #define WINE_FIXME_ON(ch) __WINE_IS_DEBUG_ON(_FIXME,&__wine_dbch_##ch) @@ -526,6 +555,7 @@ static inline const char *debugstr_variant( const VARIANT *v ) { return wine_dbg #define WARN_ON(ch) WINE_WARN_ON(ch)
#define FIXME WINE_FIXME +#define FIXME_ONCE WINE_FIXME_ONCE #define FIXME_(ch) WINE_FIXME_(ch) #define FIXME_ON(ch) WINE_FIXME_ON(ch)
Introduce FIXME_ONCE
Signed-off-by: David Kahurani k.kahurani@gmail.com --- dlls/ntdll/unix/system.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 91184b12..69a4ae99 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2545,7 +2545,6 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, case SystemPerformanceInformation: /* 2 */ { SYSTEM_PERFORMANCE_INFORMATION spi; - static BOOL fixme_written = FALSE;
get_performance_info( &spi ); len = sizeof(spi); @@ -2555,10 +2554,9 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, else memcpy( info, &spi, len); } else ret = STATUS_INFO_LENGTH_MISMATCH; - if(!fixme_written) { - FIXME("info_class SYSTEM_PERFORMANCE_INFORMATION\n"); - fixme_written = TRUE; - } + + FIXME_ONCE("info_class SYSTEM_PERFORMANCE_INFORMATION\n"); + break; }