mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-15 14:43:34 +02:00
tests: Fix a couple of static analysis warnings in autoptr tests
The static analyser can’t yet work out how `g_autofree` works, so disable those tests. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1767
This commit is contained in:
@ -10,6 +10,9 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(HasNonVoidCleanup, non_void_cleanup)
|
|||||||
static void
|
static void
|
||||||
test_autofree (void)
|
test_autofree (void)
|
||||||
{
|
{
|
||||||
|
#ifdef __clang_analyzer__
|
||||||
|
g_test_skip ("autofree tests aren’t understood by the clang analyser");
|
||||||
|
#else
|
||||||
g_autofree gchar *p = NULL;
|
g_autofree gchar *p = NULL;
|
||||||
g_autofree gchar *p2 = NULL;
|
g_autofree gchar *p2 = NULL;
|
||||||
g_autofree gchar *alwaysnull = NULL;
|
g_autofree gchar *alwaysnull = NULL;
|
||||||
@ -35,6 +38,7 @@ test_autofree (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_assert_null (alwaysnull);
|
g_assert_null (alwaysnull);
|
||||||
|
#endif /* __clang_analyzer__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -592,6 +596,9 @@ test_autolist (void)
|
|||||||
|
|
||||||
l = g_list_prepend (l, b1);
|
l = g_list_prepend (l, b1);
|
||||||
l = g_list_prepend (l, b3);
|
l = g_list_prepend (l, b3);
|
||||||
|
|
||||||
|
/* Squash warnings about dead stores */
|
||||||
|
(void) l;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only assert if autoptr works */
|
/* Only assert if autoptr works */
|
||||||
|
@ -113,6 +113,9 @@ test_autolist (void)
|
|||||||
|
|
||||||
l = g_list_prepend (l, tac1);
|
l = g_list_prepend (l, tac1);
|
||||||
l = g_list_prepend (l, tac2);
|
l = g_list_prepend (l, tac2);
|
||||||
|
|
||||||
|
/* Squash warnings about dead stores */
|
||||||
|
(void) l;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only assert if autoptr works */
|
/* Only assert if autoptr works */
|
||||||
|
Reference in New Issue
Block a user