debug: Turn gdk_debug_message() into a function

1. MSVC can't deal with the nonstandard ##__VA_ARGS__

2. It allows setting a breakpoint on it.
This commit is contained in:
Benjamin Otte 2023-11-05 09:46:22 +01:00
parent 8aa7174bfb
commit d55801c8ba

View File

@ -64,11 +64,24 @@ GdkDebugFlags gdk_display_get_debug_flags (GdkDisplay *display);
void gdk_display_set_debug_flags (GdkDisplay *display,
GdkDebugFlags flags);
static inline void
gdk_debug_message (const char *format, ...) G_GNUC_PRINTF(1, 2);
static inline void
gdk_debug_message (const char *format, ...)
{
va_list args;
char *s;
va_start (args, format);
s = g_strdup_vprintf (format, args);
va_end (args);
#ifdef GLIB_USING_SYSTEM_PRINTF
#define gdk_debug_message(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
fprintf (stderr, "%s\n", s);
#else
#define gdk_debug_message(format, ...) g_fprintf (stderr, format "\n", ##__VA_ARGS__)
g_fprintf (stderr, "%s\n", s);
#endif
g_free (s);
}
#ifdef G_ENABLE_DEBUG