From 049149c4b7a157a11b315788c2ee0988e1ecb34c Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 23 Sep 2024 11:09:10 -0700 Subject: [PATCH 1/2] glib/gvariant: Fix check for G_ANALYZER_ANALYZING This is _always_ defined in gmacros.h and therefore the #ifdef will always be 1 even if were disabled. Just #if instead. Closes: #3480 --- glib/gvariant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gvariant.c b/glib/gvariant.c index 8ea52d50a..bf4c45e7d 100644 --- a/glib/gvariant.c +++ b/glib/gvariant.c @@ -3504,7 +3504,7 @@ g_variant_builder_init (GVariantBuilder *builder, g_assert_not_reached (); } -#ifdef G_ANALYZER_ANALYZING +#if G_ANALYZER_ANALYZING /* Static analysers can’t couple the code in g_variant_builder_init() to the * code in g_variant_builder_end() by GVariantType, so end up assuming that * @offset and @children mismatch and that uninitialised memory is accessed From 2691c5e24ee82f20f30fffbd85b527587df45f69 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 25 Sep 2024 14:30:48 +0100 Subject: [PATCH 2/2] gdbusdaemon: Fix check for G_ANALYZER_ANALYZING As with the previous commit, this is _always_ defined in `gmacros.h` and therefore the `#ifndef` will always be 0 even if disabled. Just use `#if` instead. Signed-off-by: Philip Withnall --- gio/gdbusdaemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gdbusdaemon.c b/gio/gdbusdaemon.c index 2d04abcbb..ec8427a80 100644 --- a/gio/gdbusdaemon.c +++ b/gio/gdbusdaemon.c @@ -187,7 +187,7 @@ name_unref (Name *name) * So, until the static analysis improves, or we find some way to restructure * the code, squash the false positive use-after-free or double-unref warnings * by making this function a no-op to the static analyser. */ -#ifndef G_ANALYZER_ANALYZING +#if !G_ANALYZER_ANALYZING g_assert (name->refcount > 0); if (--name->refcount == 0) {