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)