Merge branch 'wip/chergert/fix-ganalyzer-use' into 'main'

glib/gvariant: Fix check for G_ANALYZER_ANALYZING

Closes #3480

See merge request GNOME/glib!4291
This commit is contained in:
Philip Withnall 2024-09-25 13:43:02 +00:00
commit 267342420f
2 changed files with 2 additions and 2 deletions

View File

@ -187,7 +187,7 @@ name_unref (Name *name)
* So, until the static analysis improves, or we find some way to restructure * 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 * the code, squash the false positive use-after-free or double-unref warnings
* by making this function a no-op to the static analyser. */ * by making this function a no-op to the static analyser. */
#ifndef G_ANALYZER_ANALYZING #if !G_ANALYZER_ANALYZING
g_assert (name->refcount > 0); g_assert (name->refcount > 0);
if (--name->refcount == 0) if (--name->refcount == 0)
{ {

View File

@ -3504,7 +3504,7 @@ g_variant_builder_init (GVariantBuilder *builder,
g_assert_not_reached (); g_assert_not_reached ();
} }
#ifdef G_ANALYZER_ANALYZING #if G_ANALYZER_ANALYZING
/* Static analysers cant couple the code in g_variant_builder_init() to the /* Static analysers cant couple the code in g_variant_builder_init() to the
* code in g_variant_builder_end() by GVariantType, so end up assuming that * code in g_variant_builder_end() by GVariantType, so end up assuming that
* @offset and @children mismatch and that uninitialised memory is accessed * @offset and @children mismatch and that uninitialised memory is accessed