There are many places in the wine source that use a static to print a fixme just once. Here's a simple macro that combines declaring and testing the static.
Thoughts?
diff --git a/include/wine/debug.h b/include/wine/debug.h index ba6fabe..3112401 100644 --- a/include/wine/debug.h +++ b/include/wine/debug.h @@ -250,6 +250,8 @@ static inline const char *wine_dbgstr_longlong( ULONGLONG ll ) #define WINE_DPRINTF wine_dbg_printf #define WINE_MESSAGE wine_dbg_printf
+#define WINE_ONCE(s) { static int once; if (!once++) s; } + #ifdef __WINESRC__ /* Wine uses shorter names that are very likely to conflict with other software */
@@ -276,6 +278,8 @@ static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( #define ERR_(ch) WINE_ERR_(ch) #define ERR_ON(ch) WINE_ERR_ON(ch)
+#define ONCE(s) WINE_ONCE(s) + #define DPRINTF WINE_DPRINTF #define MESSAGE WINE_MESSAGE
And here's an example of its use:
diff --git a/dlls/msvcr90/msvcr90.c b/dlls/msvcr90/msvcr90.c index fd24f11..af75095 100644 --- a/dlls/msvcr90/msvcr90.c +++ b/dlls/msvcr90/msvcr90.c @@ -310,9 +310,7 @@ int CDECL _atoflt( _CRT_FLOAT *value, char *str ) DEFINE_THISCALL_WRAPPER(MSVCRT_type_info_name_internal_method,8) const char * __thiscall MSVCRT_type_info_name_internal_method(type_info * _this, struct __type_info_node *node) { - static int once; - - if (node && !once++) FIXME("type_info_node parameter ignored\n"); + if (node) ONCE(FIXME("type_info_node parameter ignored\n"));
if (!_this->name) {
On 06-08-2011 at 11:12 PM, Dan Kegel dank@kegel.com wrote:
There are many places in the wine source that use a static to print a fixme just once. Here's a simple macro that combines declaring and testing the static.
Thoughts?
Hi Dan,
Alexandre turned it down last time:
http://www.winehq.org/pipermail/wine-devel/2011-January/088123.html
Regards,
Sven
On Sat, Aug 6, 2011 at 2:58 PM, Sven Baars sven.wine@gmail.com wrote:
Alexandre turned it down last time:
http://www.winehq.org/pipermail/wine-devel/2011-January/088123.html
Ah, foo, now I remember. Thanks... - Dan
I introduced exactly the same on my old DIB engine, to avoid tons of FIXMES :-) I find it quite useful.
Max