1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
From: Tobias Stoeckmann <tobias@stoeckmann.org>
Date: Fri, 5 Sep 2025 22:34:44 +0200
Subject: tests: Fix clang compilation warnings
With these adjustments, building with clang leads to no warnings:
- The "{ NULL }" statement could be replaced with "{ 0 }" to satisfy
clang, but this way it's explicitly filling all fields
- Even though "i" is not read with these g_array_binary_search calls,
it rightfully should be set
Origin: upstream, 2.86.1, commit:c546ac20d8ec9fe7c52a2a8ebb256c9052710f57
---
gio/tests/actions.c | 2 +-
glib/tests/array-test.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/gio/tests/actions.c b/gio/tests/actions.c
index 2b7a100..fcd776f 100644
--- a/gio/tests/actions.c
+++ b/gio/tests/actions.c
@@ -411,7 +411,7 @@ test_entries (void)
const GActionEntry entries2[] = {
{ "foo", activate_foo, NULL, NULL, NULL, { 0 } },
{ "bar", activate_bar, "s", NULL, NULL, { 0 } },
- { NULL },
+ { NULL, NULL, NULL, NULL, NULL, { 0 } },
};
GSimpleActionGroup *actions;
GVariant *state;
diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c
index e0e9a8f..eba5b80 100644
--- a/glib/tests/array-test.c
+++ b/glib/tests/array-test.c
@@ -978,11 +978,13 @@ test_array_binary_search (void)
garray = g_array_sized_new (FALSE, FALSE, sizeof (guint), 0);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*assertion*!= NULL*");
+ i = 1;
g_assert_false (g_array_binary_search (NULL, &i, cmpint, NULL));
g_test_assert_expected_messages ();
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*assertion*!= NULL*");
+ i = 1;
g_assert_false (g_array_binary_search (garray, &i, NULL, NULL));
g_test_assert_expected_messages ();
g_array_free (garray, TRUE);
|