[PATCH] include: Use __cdecl calling convention for wine_dbg_log().

Matteo Bruni mbruni at codeweavers.com
Thu Sep 10 14:38:11 CDT 2020


The practical consequence is that registers are saved / restored
inside wine_dbg_log() instead of in the caller, which means not
incurring in the overhead when debug channels are disabled.

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
This came up from hacking around yesterday with Paul and Rémi. I
haven't tested the patch extensively but it seems to do the
trick. wine_dbg_log() in practice is never inlined for me and that's
the reason why this is enough. It's not possible to remove the inline
keyword from the definition because that makes it trigger the "unused
static function" warning all over Wine.

Worth mentioning that this patch makes sure that wine_dbg_log() has
the same calling convention as __wine_dbg_header() and the other
debug functions in ntdll.
---
 include/wine/debug.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/wine/debug.h b/include/wine/debug.h
index 912d61a90af0..462a43e22e20 100644
--- a/include/wine/debug.h
+++ b/include/wine/debug.h
@@ -193,12 +193,12 @@ static inline int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... )
     return __wine_dbg_output( buffer );
 }
 
-static int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls,
-                                          struct __wine_debug_channel *channel, const char *func,
-                                          const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
-static inline int __wine_dbg_cdecl wine_dbg_log( enum __wine_debug_class cls,
-                                                 struct __wine_debug_channel *channel,
-                                                 const char *function, const char *format, ... )
+static int __cdecl wine_dbg_log( enum __wine_debug_class cls,
+                                 struct __wine_debug_channel *channel, const char *func,
+                                 const char *format, ... ) __WINE_PRINTF_ATTR(4,5);
+static inline int __cdecl wine_dbg_log( enum __wine_debug_class cls,
+                                        struct __wine_debug_channel *channel,
+                                        const char *function, const char *format, ... )
 {
     char buffer[1024];
     __wine_dbg_va_list args;
-- 
2.26.2




More information about the wine-devel mailing list