From 43a30e49838b8cc5fa7c75aa2090ddf8220f416a Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 15 Oct 2020 10:23:36 +0200 Subject: [PATCH 01/14] Fix signedness warning in glib/test/tree.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/tree.c: In function ‘test_tree_traverse’: glib/tests/tree.c:394:17: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 394 | for (i = 0; i < G_N_ELEMENTS (orders); i++) | ^ --- glib/tests/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/tree.c b/glib/tests/tree.c index 5bf7bd368..8811d962d 100644 --- a/glib/tests/tree.c +++ b/glib/tests/tree.c @@ -333,7 +333,7 @@ static void test_tree_traverse (void) { GTree *tree; - gint i; + gsize i; TraverseData orders[] = { { G_IN_ORDER, -1, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" }, { G_IN_ORDER, 1, "0" }, From 0c81ed309e6069639081845d2ba098abb2100ee2 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 19:47:55 +0100 Subject: [PATCH 02/14] Fix missing initializer warnings in glib/tests/gvariant.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/gvariant.c: In function ‘test_lookup_value’: glib/tests/gvariant.c:4353:5: error: missing initializer for field ‘value’ of ‘struct ’ 4353 | { "@a{ss} {'x': 'y'}", "y" }, | ^ glib/tests/gvariant.c:4350:31: note: ‘value’ declared here 4350 | const gchar *dict, *key, *value; | ^~~~~ glib/tests/gvariant.c:4355:5: error: missing initializer for field ‘value’ of ‘struct ’ 4355 | { "@a{os} {'/x': 'y'}", "/y" }, | ^ glib/tests/gvariant.c:4350:31: note: ‘value’ declared here 4350 | const gchar *dict, *key, *value; | ^~~~~ glib/tests/gvariant.c:4358:5: error: missing initializer for field ‘value’ of ‘struct ’ 4358 | { "@a{sv} {'x': <'y'>}", "y" } | ^ glib/tests/gvariant.c:4350:31: note: ‘value’ declared here 4350 | const gchar *dict, *key, *value; | ^~~~~ --- glib/tests/gvariant.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c index 3905e20bc..2308c38a7 100644 --- a/glib/tests/gvariant.c +++ b/glib/tests/gvariant.c @@ -4355,12 +4355,12 @@ test_lookup_value (void) const gchar *dict, *key, *value; } cases[] = { { "@a{ss} {'x': 'y'}", "x", "'y'" }, - { "@a{ss} {'x': 'y'}", "y" }, + { "@a{ss} {'x': 'y'}", "y", NULL }, { "@a{os} {'/x': 'y'}", "/x", "'y'" }, - { "@a{os} {'/x': 'y'}", "/y" }, + { "@a{os} {'/x': 'y'}", "/y", NULL }, { "@a{sv} {'x': <'y'>}", "x", "'y'" }, { "@a{sv} {'x': <5>}", "x", "5" }, - { "@a{sv} {'x': <'y'>}", "y" } + { "@a{sv} {'x': <'y'>}", "y", NULL } }; gsize i; From 22929606901238f1966217fce0eae358e8bf4391 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 19:52:13 +0100 Subject: [PATCH 03/14] Fix signedness warning in glib/tests/spawn-multithreaded.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/spawn-multithreaded.c: In function ‘multithreaded_test_run’: glib/tests/spawn-multithreaded.c:41:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 41 | for (i = 0; i < n_threads; i++) | ^ glib/tests/spawn-multithreaded.c:49:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} 49 | for (i = 0; i < n_threads; i++) | ^ --- glib/tests/spawn-multithreaded.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/glib/tests/spawn-multithreaded.c b/glib/tests/spawn-multithreaded.c index 99f99b434..bf2c8a501 100644 --- a/glib/tests/spawn-multithreaded.c +++ b/glib/tests/spawn-multithreaded.c @@ -31,7 +31,7 @@ static char *echo_prog_path; static void multithreaded_test_run (GThreadFunc function) { - int i; + guint i; GPtrArray *threads = g_ptr_array_new (); guint n_threads; @@ -42,7 +42,7 @@ multithreaded_test_run (GThreadFunc function) { GThread *thread; - thread = g_thread_new ("test", function, GINT_TO_POINTER (i)); + thread = g_thread_new ("test", function, GUINT_TO_POINTER (i)); g_ptr_array_add (threads, thread); } @@ -50,7 +50,7 @@ multithreaded_test_run (GThreadFunc function) { gpointer ret; ret = g_thread_join (g_ptr_array_index (threads, i)); - g_assert_cmpint (GPOINTER_TO_INT (ret), ==, i); + g_assert_cmpint (GPOINTER_TO_UINT (ret), ==, i); } g_ptr_array_free (threads, TRUE); } @@ -58,14 +58,14 @@ multithreaded_test_run (GThreadFunc function) static gpointer test_spawn_sync_multithreaded_instance (gpointer data) { - int tnum = GPOINTER_TO_INT (data); + guint tnum = GPOINTER_TO_UINT (data); GError *error = NULL; GPtrArray *argv; char *arg; char *stdout_str; int estatus; - arg = g_strdup_printf ("thread %d", tnum); + arg = g_strdup_printf ("thread %u", tnum); argv = g_ptr_array_new (); g_ptr_array_add (argv, echo_prog_path); @@ -79,7 +79,7 @@ test_spawn_sync_multithreaded_instance (gpointer data) g_free (stdout_str); g_ptr_array_free (argv, TRUE); - return GINT_TO_POINTER (tnum); + return GUINT_TO_POINTER (tnum); } static void @@ -147,7 +147,7 @@ on_child_stdout (GIOChannel *channel, static gpointer test_spawn_async_multithreaded_instance (gpointer thread_data) { - int tnum = GPOINTER_TO_INT (thread_data); + guint tnum = GPOINTER_TO_UINT (thread_data); GError *error = NULL; GPtrArray *argv; char *arg; @@ -162,7 +162,7 @@ test_spawn_async_multithreaded_instance (gpointer thread_data) context = g_main_context_new (); loop = g_main_loop_new (context, TRUE); - arg = g_strdup_printf ("thread %d", tnum); + arg = g_strdup_printf ("thread %u", tnum); argv = g_ptr_array_new (); g_ptr_array_add (argv, echo_prog_path); @@ -203,7 +203,7 @@ test_spawn_async_multithreaded_instance (gpointer thread_data) g_free (arg); - return GINT_TO_POINTER (tnum); + return GUINT_TO_POINTER (tnum); } static void From 93dd6145627b93f59b3fbea2a5bcea6327c5faa5 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 21:16:49 +0100 Subject: [PATCH 04/14] Fixing missing initializer in glib/test/markup-collect.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/markup-collect.c:79:1: error: missing initializer for field ‘end_element’ of ‘GMarkupParser’ {aka ‘struct _GMarkupParser’} 79 | static GMarkupParser parser = { start }; | ^~~~~~ glib/tests/markup-collect.c:198:1: error: missing initializer for field ‘end_element’ of ‘GMarkupParser’ {aka ‘struct _GMarkupParser’} 198 | }; | ^ --- glib/tests/markup-collect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/tests/markup-collect.c b/glib/tests/markup-collect.c index dd9b1b4bd..82b5aaff3 100644 --- a/glib/tests/markup-collect.c +++ b/glib/tests/markup-collect.c @@ -76,7 +76,7 @@ start (GMarkupParseContext *context, } } -static GMarkupParser parser = { start }; +static GMarkupParser parser = { start, NULL, NULL, NULL, NULL }; struct test { @@ -194,7 +194,7 @@ start_element (GMarkupParseContext *context, } static GMarkupParser cleanup_parser = { - start_element + start_element, NULL, NULL, NULL, NULL }; static void From 6c74ab7fcc8c8b6916d06b73b212ee88176fc76d Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 21:20:57 +0100 Subject: [PATCH 05/14] Fix signedness warning in glib/tests/markup-collect.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/gtestutils.h:134:96: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘GMarkupError’ 134 | if (!err || (err)->domain != dom || (err)->code != c) \ | ^~ glib/tests/markup-collect.c:168:7: note: in expansion of macro ‘g_assert_error’ 168 | g_assert_error (error, G_MARKUP_ERROR, test->error_code); | ^~~~~~~~~~~~~~ --- glib/tests/markup-collect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/markup-collect.c b/glib/tests/markup-collect.c index 82b5aaff3..0c2757a34 100644 --- a/glib/tests/markup-collect.c +++ b/glib/tests/markup-collect.c @@ -165,7 +165,7 @@ test_collect (gconstpointer d) } else { - g_assert_error (error, G_MARKUP_ERROR, test->error_code); + g_assert_error (error, G_MARKUP_ERROR, (gint) test->error_code); } g_markup_parse_context_free (ctx); From 24c60cee6c5de50b38c535e00e9741becf28c76c Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 21:24:07 +0100 Subject: [PATCH 06/14] Fix missing initializer warnings in glib/tests/markup-collect.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/gmarkup.h:154:10: note: ‘end_element’ declared here 154 | void (*end_element) (GMarkupParseContext *context, | ^~~~~~~~~~~ glib/tests/markup-collect.c:94:3: error: missing initializer for field ‘error_code’ of ‘struct test’ 94 | { "", "" }, | ^ glib/tests/markup-collect.c:85:17: note: ‘error_code’ declared here 85 | GMarkupError error_code; | ^~~~~~~~~~ glib/tests/markup-collect.c:95:3: error: missing initializer for field ‘error_code’ of ‘struct test’ 95 | { "", "" }, | ^ glib/tests/markup-collect.c:85:17: note: ‘error_code’ declared here 85 | GMarkupError error_code; | ^~~~~~~~~~ glib/tests/markup-collect.c:96:3: error: missing initializer for field ‘error_code’ of ‘struct test’ 96 | { "", "" }, | ^ glib/tests/markup-collect.c:85:17: note: ‘error_code’ declared here 85 | GMarkupError error_code; | ^~~~~~~~~~ glib/tests/markup-collect.c:97:3: error: missing initializer for field ‘error_code’ of ‘struct test’ 97 | { "", "" }, | ^ glib/tests/markup-collect.c:85:17: note: ‘error_code’ declared here 85 | GMarkupError error_code; | ^~~~~~~~~~ glib/tests/markup-collect.c:99:3: error: missing initializer for field ‘error_code’ of ‘struct test’ 99 | { "", "" }, | ^ glib/tests/markup-collect.c:85:17: note: ‘error_code’ declared here 85 | GMarkupError error_code; | ^~~~~~~~~~ glib/tests/markup-collect.c:100:3: error: missing initializer for field ‘error_code’ of ‘struct test’ 100 | { "some text is in here", "" }, | ^ glib/tests/markup-collect.c:85:17: note: ‘error_code’ declared here 85 | GMarkupError error_code; | ^~~~~~~~~~ glib/tests/markup-collect.c:111:3: error: missing initializer for field ‘error_code’ of ‘struct test’ 111 | { "", "" }, | ^ glib/tests/markup-collect.c:85:17: note: ‘error_code’ declared here 85 | GMarkupError error_code; | ^~~~~~~~~~ --- glib/tests/markup-collect.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/glib/tests/markup-collect.c b/glib/tests/markup-collect.c index 0c2757a34..b796b4238 100644 --- a/glib/tests/markup-collect.c +++ b/glib/tests/markup-collect.c @@ -91,13 +91,14 @@ static struct test tests[] = { "", "", G_MARKUP_ERROR_PARSE, "'bool'" }, - { "", "" }, - { "", "" }, - { "", "" }, - { "", "" }, + { "", "", 0, NULL }, + { "", "", 0, NULL }, + { "", "", 0, NULL }, + { "", "", 0, NULL }, - { "", "" }, - { "some text is in here", "" }, + { "", "", 0, NULL }, + { "some text is in here", + "", 0, NULL }, { "", "", G_MARKUP_ERROR_MISSING_ATTRIBUTE, "'mb'" }, @@ -108,7 +109,7 @@ static struct test tests[] = { "", "", G_MARKUP_ERROR_INVALID_CONTENT, "'tri'" }, - { "", "" }, + { "", "", 0, NULL }, { "", "", G_MARKUP_ERROR_MISSING_ATTRIBUTE, "'cm'" }, From 7ea05283acf5def437a576983c5920d34e9cbeb8 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 21:40:43 +0100 Subject: [PATCH 07/14] Fix signedness warnings in glib/tests/markup-subparser.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/markup-subparser.c: In function ‘main’: glib/tests/markup-subparser.c:362:24: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 362 | __add_tests_i < G_N_ELEMENTS (array); \ | ^ glib/tests/markup-subparser.c:378:3: note: in expansion of macro ‘add_tests’ 378 | add_tests (test, "/glib/markup/subparser/success", test_cases); | ^~~~~~~~~ glib/tests/markup-subparser.c:362:24: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ 362 | __add_tests_i < G_N_ELEMENTS (array); \ | ^ glib/tests/markup-subparser.c:379:3: note: in expansion of macro ‘add_tests’ 379 | add_tests (test, "/glib/markup/subparser/failure", error_cases); | ^~~~~~~~~ --- glib/tests/markup-subparser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/glib/tests/markup-subparser.c b/glib/tests/markup-subparser.c index d1ceffb00..41eb06c14 100644 --- a/glib/tests/markup-subparser.c +++ b/glib/tests/markup-subparser.c @@ -356,7 +356,7 @@ TestCase error_cases[] = /* error cases */ #define add_tests(func, basename, array) \ G_STMT_START { \ - int __add_tests_i; \ + gsize __add_tests_i; \ \ for (__add_tests_i = 0; \ __add_tests_i < G_N_ELEMENTS (array); \ @@ -364,7 +364,8 @@ TestCase error_cases[] = /* error cases */ { \ char *testname; \ \ - testname = g_strdup_printf ("%s/%d", basename, __add_tests_i); \ + testname = g_strdup_printf ("%s/%" G_GSIZE_FORMAT, \ + basename, __add_tests_i); \ g_test_add_data_func (testname, &array[__add_tests_i], func); \ g_free (testname); \ } \ From 2eb66a2091a7ed748b522debf3a6b9db2fe6229e Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 21:42:41 +0100 Subject: [PATCH 08/14] Fix missing initializer warning in glib/tests/markup-subparser.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/markup-subparser.c:269:1: error: missing initializer for field ‘text’ of ‘GMarkupParser’ {aka ‘struct _GMarkupParser’} 269 | }; | ^ --- glib/tests/markup-subparser.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/glib/tests/markup-subparser.c b/glib/tests/markup-subparser.c index 41eb06c14..f8af5fdd3 100644 --- a/glib/tests/markup-subparser.c +++ b/glib/tests/markup-subparser.c @@ -265,7 +265,10 @@ end_element (GMarkupParseContext *context, static GMarkupParser parser = { start_element, - end_element + end_element, + NULL, + NULL, + NULL }; typedef struct From 043cf256313bfe00abbfb5021bda194fb7880ef3 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 21:52:59 +0100 Subject: [PATCH 09/14] Fix missing initializer warnings in glib/tests/markup-subparser.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from glib/glib.h:60, from glib/tests/markup-subparser.c:14: glib/gmarkup.h:161:10: note: ‘text’ declared here 161 | void (*text) (GMarkupParseContext *context, | ^~~~ glib/tests/markup-subparser.c:335:3: error: missing initializer for field ‘error_message’ of ‘TestCase’ 335 | { "", "" }, | ^ glib/tests/markup-subparser.c:275:15: note: ‘error_message’ declared here 275 | const char *error_message; | ^~~~~~~~~~~~~ glib/tests/markup-subparser.c:336:3: error: missing initializer for field ‘error_message’ of ‘TestCase’ 336 | { "", "<<{foo}{/foo}>>" }, | ^ glib/tests/markup-subparser.c:275:15: note: ‘error_message’ declared here 275 | const char *error_message; | ^~~~~~~~~~~~~ glib/tests/markup-subparser.c:337:3: error: missing initializer for field ‘error_message’ of ‘TestCase’ 337 | { "", "<<{foo}{/foo}{bar}{/bar}>>" }, | ^ glib/tests/markup-subparser.c:275:15: note: ‘error_message’ declared here 275 | const char *error_message; | ^~~~~~~~~~~~~ glib/tests/markup-subparser.c:338:3: error: missing initializer for field ‘error_message’ of ‘TestCase’ 338 | { "", "[[{foo}{bar}{/bar}{/foo}]]" }, | ^ glib/tests/markup-subparser.c:275:15: note: ‘error_message’ declared here 275 | const char *error_message; | ^~~~~~~~~~~~~ glib/tests/markup-subparser.c:339:3: error: missing initializer for field ‘error_message’ of ‘TestCase’ 339 | { "", "[[{foo}{x}{/x}{y}{/y}{/foo}]]" }, | ^ glib/tests/markup-subparser.c:275:15: note: ‘error_message’ declared here 275 | const char *error_message; | ^~~~~~~~~~~~~ glib/tests/markup-subparser.c:340:3: error: missing initializer for field ‘error_message’ of ‘TestCase’ 340 | { "", "[[{foo}{/foo}]]" }, | ^ glib/tests/markup-subparser.c:275:15: note: ‘error_message’ declared here 275 | const char *error_message; | ^~~~~~~~~~~~~ glib/tests/markup-subparser.c:342:33: error: missing initializer for field ‘error_message’ of ‘TestCase’ 342 | "[[{bar}{/bar}]]" } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ glib/tests/markup-subparser.c:275:15: note: ‘error_message’ declared here 275 | const char *error_message; | ^~~~~~~~~~~~~ --- glib/tests/markup-subparser.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/glib/tests/markup-subparser.c b/glib/tests/markup-subparser.c index f8af5fdd3..71b9ac6af 100644 --- a/glib/tests/markup-subparser.c +++ b/glib/tests/markup-subparser.c @@ -334,15 +334,15 @@ test (gconstpointer user_data) TestCase test_cases[] = /* successful runs */ { - /* in */ /* out */ - { "", "" }, - { "", "<<{foo}{/foo}>>" }, - { "", "<<{foo}{/foo}{bar}{/bar}>>" }, - { "", "[[{foo}{bar}{/bar}{/foo}]]" }, - { "", "[[{foo}{x}{/x}{y}{/y}{/foo}]]" }, - { "", "[[{foo}{/foo}]]" }, + /* in */ /* out */ /* error */ + { "", "", NULL }, + { "", "<<{foo}{/foo}>>", NULL }, + { "", "<<{foo}{/foo}{bar}{/bar}>>", NULL }, + { "", "[[{foo}{bar}{/bar}{/foo}]]", NULL }, + { "", "[[{foo}{x}{/x}{y}{/y}{/foo}]]", NULL }, + { "", "[[{foo}{/foo}]]", NULL }, { "", "<<{foo}{/foo}>>" - "[[{bar}{/bar}]]" } + "[[{bar}{/bar}]]", NULL } }; TestCase error_cases[] = /* error cases */ From 75ba0e552daeda071a12da94cd96248951832d38 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 22:07:56 +0100 Subject: [PATCH 10/14] Fix signedness warnings in glib/tests/option-context.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/option-context.c: In function ‘test_group_captions’: glib/tests/option-context.c:123:21: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘long unsigned int’ 123 | for (j = 0; j < G_N_ELEMENTS (test_name_base); ++j) | ^ glib/tests/option-context.c: In function ‘option_context_parse_command_line’: glib/tests/option-context.c:2364:46: error: operand of ‘?:’ changes signedness from ‘int’ to ‘guint’ {aka ‘unsigned int’} due to unsignedness of other operand 2364 | return success ? argv_len - argv_new_len : -1; | ^~ --- glib/tests/option-context.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/glib/tests/option-context.c b/glib/tests/option-context.c index 149d22353..4ae050214 100644 --- a/glib/tests/option-context.c +++ b/glib/tests/option-context.c @@ -111,7 +111,8 @@ test_group_captions (void) { const gchar *test_name_base[] = { "help", "help-all", "help-test" }; gchar *test_name; - gint i, j; + guint i; + gsize j; g_test_bug ("504142"); @@ -132,7 +133,7 @@ test_group_captions (void) if (g_test_verbose ()) trap_flags |= G_TEST_SUBPROCESS_INHERIT_STDOUT | G_TEST_SUBPROCESS_INHERIT_STDERR; - test_name = g_strdup_printf ("/option/group/captions/subprocess/%s-%d", + test_name = g_strdup_printf ("/option/group/captions/subprocess/%s-%u", test_name_base[j], i); g_test_trap_subprocess (test_name, 0, trap_flags); g_free (test_name); @@ -2361,7 +2362,7 @@ option_context_parse_command_line (GOptionContext *context, argv_new_len = g_strv_length (argv); g_strfreev (argv); - return success ? argv_len - argv_new_len : -1; + return success ? (gint) (argv_len - argv_new_len) : -1; } static void From 913d222c882f22a69ee90ac6c274ae8e4563bcc4 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 22:09:21 +0100 Subject: [PATCH 11/14] =?UTF-8?q?Fix=20=E2=80=98static=E2=80=99=20is=20not?= =?UTF-8?q?=20at=20beginning=20of=20declaration=20in=20glib/tests/option-c?= =?UTF-8?q?ontext.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/option-context.c:1335:1: error: ‘static’ is not at beginning of declaration 1335 | static array_test1 (void) | ^~~~~~ --- glib/tests/option-context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glib/tests/option-context.c b/glib/tests/option-context.c index 4ae050214..68e990db0 100644 --- a/glib/tests/option-context.c +++ b/glib/tests/option-context.c @@ -1332,8 +1332,8 @@ ignore_test3 (void) g_option_context_free (context); } -void -static array_test1 (void) +static void +array_test1 (void) { GOptionContext *context; gboolean retval; From 8045b77c323370b15e7c6e9812daff2e85b4182b Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 22:28:37 +0100 Subject: [PATCH 12/14] Fixing missing initializer warnings in glib/tests/option-context.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/option-context.c: In function ‘callback_test_optional_5’: glib/tests/option-context.c:945:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’} 945 | { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL }, | ^ In file included from glib/glib.h:64, from glib/tests/option-context.c:23: glib/goption.h:268:16: note: ‘arg_description’ declared here 268 | const gchar *arg_description; | ^~~~~~~~~~~~~~~ glib/tests/option-context.c: In function ‘callback_test_optional_6’: glib/tests/option-context.c:983:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’} 983 | { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL }, | ^ In file included from glib/glib.h:64, from glib/tests/option-context.c:23: glib/goption.h:268:16: note: ‘arg_description’ declared here 268 | const gchar *arg_description; | ^~~~~~~~~~~~~~~ glib/tests/option-context.c: In function ‘callback_test_optional_7’: glib/tests/option-context.c:1021:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’} 1021 | { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL }, | ^ In file included from glib/glib.h:64, from glib/tests/option-context.c:23: glib/goption.h:268:16: note: ‘arg_description’ declared here 268 | const gchar *arg_description; | ^~~~~~~~~~~~~~~ glib/tests/option-context.c: In function ‘callback_test_optional_8’: glib/tests/option-context.c:1059:5: error: missing initializer for field ‘arg_description’ of ‘GOptionEntry’ {aka ‘struct _GOptionEntry’} 1059 | { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL }, | ^ In file included from glib/glib.h:64, from glib/tests/option-context.c:23: glib/goption.h:268:16: note: ‘arg_description’ declared here 268 | const gchar *arg_description; | ^~~~~~~~~~~~~~~ --- glib/tests/option-context.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glib/tests/option-context.c b/glib/tests/option-context.c index 68e990db0..ec66e6f94 100644 --- a/glib/tests/option-context.c +++ b/glib/tests/option-context.c @@ -943,7 +943,7 @@ callback_test_optional_5 (void) gchar **argv_copy; int argc; GOptionEntry entries [] = - { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL }, + { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL, NULL }, { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, callback_parse_optional, NULL, NULL }, { NULL } }; @@ -981,7 +981,7 @@ callback_test_optional_6 (void) gchar **argv_copy; int argc; GOptionEntry entries [] = - { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL }, + { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL, NULL }, { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, callback_parse_optional, NULL, NULL }, { NULL } }; @@ -1019,7 +1019,7 @@ callback_test_optional_7 (void) gchar **argv_copy; int argc; GOptionEntry entries [] = - { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL }, + { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL, NULL }, { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, callback_parse_optional, NULL, NULL }, { NULL } }; @@ -1057,7 +1057,7 @@ callback_test_optional_8 (void) gchar **argv_copy; int argc; GOptionEntry entries [] = - { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL }, + { { "dummy", 'd', 0, G_OPTION_ARG_NONE, &dummy, NULL, NULL }, { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, callback_parse_optional, NULL, NULL }, { NULL } }; From 5444b7e74d3574a0ef800318a50148532bffea48 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 22:37:53 +0100 Subject: [PATCH 13/14] Fixing signedness warning in glib/tests/mainloop.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/mainloop.c: In function ‘write_bytes’: glib/gmacros.h:809:26: error: comparison of integer expressions of different signedness: ‘gssize’ {aka ‘long int’} and ‘long unsigned int’ 809 | #define MIN(a, b) (((a) < (b)) ? (a) : (b)) | ^ glib/tests/mainloop.c:1146:11: note: in expansion of macro ‘MIN’ 1146 | limit = MIN (*to_write, sizeof zeros); | ^~~ --- glib/tests/mainloop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c index efc896ccf..5cdb2a467 100644 --- a/glib/tests/mainloop.c +++ b/glib/tests/mainloop.c @@ -1143,7 +1143,7 @@ write_bytes (gint fd, /* Detect if we run before we should */ g_assert_cmpint (*to_write, >=, 0); - limit = MIN (*to_write, sizeof zeros); + limit = MIN ((gsize) *to_write, sizeof zeros); *to_write -= write (fd, zeros, limit); return TRUE; From e7c1b2a4840f4c2eea55967e2cd8a223f4a14376 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Sun, 8 Nov 2020 22:50:50 +0100 Subject: [PATCH 14/14] Fixing missing initializer warnings in glib/tests/mainloop.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glib/tests/mainloop.c:55:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} 55 | }; | ^ In file included from glib/giochannel.h:33, from glib/glib.h:54, from glib/tests/mainloop.c:23: glib/gmain.h:276:19: note: ‘closure_callback’ declared here 276 | GSourceFunc closure_callback; | ^~~~~~~~~~~~~~~~ glib/tests/mainloop.c:422:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} 422 | }; | ^ In file included from glib/giochannel.h:33, from glib/glib.h:54, from glib/tests/mainloop.c:23: glib/gmain.h:276:19: note: ‘closure_callback’ declared here 276 | GSourceFunc closure_callback; | ^~~~~~~~~~~~~~~~ glib/tests/mainloop.c: In function ‘test_ready_time’: glib/tests/mainloop.c:946:3: error: missing initializer for field ‘finalize’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} 946 | }; | ^ In file included from glib/giochannel.h:33, from glib/glib.h:54, from glib/tests/mainloop.c:23: glib/gmain.h:272:14: note: ‘finalize’ declared here 272 | void (*finalize) (GSource *source); /* Can be NULL */ | ^~~~~~~~ glib/tests/mainloop.c: In function ‘test_unref_while_pending’: glib/tests/mainloop.c:1088:3: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} 1088 | static GSourceFuncs funcs = { trivial_prepare, NULL, NULL, trivial_finalize }; | ^~~~~~ In file included from glib/giochannel.h:33, from glib/glib.h:54, from glib/tests/mainloop.c:23: glib/gmain.h:276:19: note: ‘closure_callback’ declared here 276 | GSourceFunc closure_callback; | ^~~~~~~~~~~~~~~~ In file included from glib/glibconfig.h:9, from glib/gtypes.h:32, from glib/galloca.h:32, from glib/glib.h:30, from glib/tests/mainloop.c:23: glib/tests/mainloop.c: In function ‘test_source_unix_fd_api’: glib/tests/mainloop.c:1403:3: error: missing initializer for field ‘finalize’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} 1403 | }; | ^ In file included from glib/giochannel.h:33, from glib/glib.h:54, from glib/tests/mainloop.c:23: glib/gmain.h:272:14: note: ‘finalize’ declared here 272 | void (*finalize) (GSource *source); /* Can be NULL */ | ^~~~~~~~ glib/tests/mainloop.c: At top level: glib/tests/mainloop.c:1843:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} 1843 | }; | ^ In file included from glib/giochannel.h:33, from glib/glib.h:54, from glib/tests/mainloop.c:23: glib/gmain.h:276:19: note: ‘closure_callback’ declared here 276 | GSourceFunc closure_callback; | ^~~~~~~~~~~~~~~~ glib/tests/mainloop.c:1919:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} 1919 | }; | ^ In file included from glib/giochannel.h:33, from glib/glib.h:54, from glib/tests/mainloop.c:23: glib/gmain.h:276:19: note: ‘closure_callback’ declared here 276 | GSourceFunc closure_callback; | ^~~~~~~~~~~~~~~~ glib/tests/mainloop.c:2002:1: error: missing initializer for field ‘closure_callback’ of ‘GSourceFuncs’ {aka ‘struct _GSourceFuncs’} 2002 | }; | ^ In file included from glib/giochannel.h:33, from glib/glib.h:54, from glib/tests/mainloop.c:23: glib/gmain.h:276:19: note: ‘closure_callback’ declared here 276 | GSourceFunc closure_callback; | ^~~~~~~~~~~~~~~~ --- glib/tests/mainloop.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/glib/tests/mainloop.c b/glib/tests/mainloop.c index 5cdb2a467..16763a0ea 100644 --- a/glib/tests/mainloop.c +++ b/glib/tests/mainloop.c @@ -51,6 +51,8 @@ static GSourceFuncs funcs = { prepare, check, dispatch, + NULL, + NULL, NULL }; @@ -419,6 +421,8 @@ static GSourceFuncs counter_source_funcs = { NULL, counter_source_dispatch, NULL, + NULL, + NULL }; static GSource * @@ -942,7 +946,7 @@ test_ready_time (void) GThread *thread; GSource *source; GSourceFuncs source_funcs = { - NULL, NULL, ready_time_dispatch + NULL, NULL, ready_time_dispatch, NULL, NULL, NULL }; GMainLoop *loop; @@ -1085,7 +1089,9 @@ trivial_finalize (GSource *source) static void test_unref_while_pending (void) { - static GSourceFuncs funcs = { trivial_prepare, NULL, NULL, trivial_finalize }; + static GSourceFuncs funcs = { + trivial_prepare, NULL, NULL, trivial_finalize, NULL, NULL + }; GMainContext *context; GSource *source; @@ -1399,7 +1405,7 @@ static void test_source_unix_fd_api (void) { GSourceFuncs no_funcs = { - NULL, NULL, return_true + NULL, NULL, return_true, NULL, NULL, NULL }; GSource *source_a; GSource *source_b; @@ -1839,7 +1845,9 @@ static GSourceFuncs source_funcs = { prepare, check, dispatch, - finalize + finalize, + NULL, + NULL }; static void @@ -1915,7 +1923,9 @@ static GSourceFuncs source_with_source_funcs = { NULL, NULL, NULL, - finalize_source_with_source + finalize_source_with_source, + NULL, + NULL }; static void @@ -1998,7 +2008,9 @@ static GSourceFuncs source_with_source_funcs_dispatch = { NULL, NULL, dispatch_source_with_source, - finalize_source_with_source + finalize_source_with_source, + NULL, + NULL }; static void