Merge branch 'matthiasc/css-deprecation-warning' into 'main'

css: Emit deprecation warnings only under debug

See merge request GNOME/gtk!7330
This commit is contained in:
Matthias Clasen 2024-06-02 15:33:32 +00:00
commit 1080822ffa
3 changed files with 30 additions and 16 deletions

View File

@ -26,6 +26,10 @@
#include "gtkcsserror.h"
#include "gtkcsslocationprivate.h"
/* We cannot include gtkdebug.h, so we must keep this in sync */
extern unsigned int gtk_get_debug_flags (void);
#define DEBUG_CHECK_CSS ((gtk_get_debug_flags () & GTK_CSS_PARSER_DEBUG_CSS) != 0)
static void clear_ref (GtkCssVariableValueReference *ref);
#define GDK_ARRAY_NAME gtk_css_parser_references
@ -817,6 +821,8 @@ gtk_css_parser_warn_deprecated (GtkCssParser *self,
const char *format,
...)
{
if (DEBUG_CHECK_CSS)
{
va_list args;
GError *error;
@ -830,6 +836,7 @@ gtk_css_parser_warn_deprecated (GtkCssParser *self,
error);
g_error_free (error);
va_end (args);
}
}
gboolean

View File

@ -172,5 +172,9 @@ void gtk_css_parser_get_expanding_variables (GtkCssParser
char ***names,
gsize *n_variables);
/* We cannot include gtkdebug.h, so we must keep this in sync */
#define GTK_CSS_PARSER_DEBUG_CSS (1 << 20)
G_END_DECLS

View File

@ -52,6 +52,9 @@
#define GDK_ARRAY_PREALLOC 64
#include "gdk/gdkarrayimpl.c"
/* For lack of a better place, assert here that these two definitions match */
G_STATIC_ASSERT (GTK_DEBUG_CSS == GTK_CSS_PARSER_DEBUG_CSS);
/**
* GtkCssProvider:
*