From 2e4524cd3664dc3d0c3b959d1cd1a854a84a4157 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Thu, 13 May 2021 00:51:08 +0200 Subject: [PATCH 01/11] Add the G_OPTION_ENTRY_NULL macro to properly initialize GOptionEntry arrays --- docs/reference/glib/glib-sections.txt | 1 + glib/goption.c | 2 +- glib/goption.h | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index 46a88af0b..d8a8d7d95 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -1649,6 +1649,7 @@ GOptionArg GOptionFlags G_OPTION_REMAINING GOptionEntry +G_OPTION_ENTRY_NULL g_option_context_add_main_entries GOptionGroup g_option_context_add_group diff --git a/glib/goption.c b/glib/goption.c index c974598c8..8cb72376c 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -102,7 +102,7 @@ * { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "Be verbose", NULL }, * { "beep", 'b', 0, G_OPTION_ARG_NONE, &beep, "Beep when done", NULL }, * { "rand", 0, 0, G_OPTION_ARG_NONE, &randomize, "Randomize the data", NULL }, - * { NULL } + * G_OPTION_ENTRY_NULL * }; * * int diff --git a/glib/goption.h b/glib/goption.h index 63552fb0d..44815a77d 100644 --- a/glib/goption.h +++ b/glib/goption.h @@ -286,6 +286,24 @@ struct _GOptionEntry */ #define G_OPTION_REMAINING "" +/** + * G_OPTION_ENTRY_NULL: + * + * A #GOptionEntry array requires a %NULL terminator, this macro can + * be used as terminator instead of an explicit `{ 0 }` but it cannot + * be assigned to a variable. + * + * |[ + * GOptionEntry option[] = { G_OPTION_ENTRY_NULL }; + * ]| + * + * Since: 2.70 + */ +#define G_OPTION_ENTRY_NULL \ + GLIB_AVAILABLE_MACRO_IN_2_70 \ + { NULL, 0, 0, 0, NULL, NULL, NULL } + + GLIB_AVAILABLE_IN_ALL GOptionContext *g_option_context_new (const gchar *parameter_string); GLIB_AVAILABLE_IN_ALL From f2d14a8770538b5482e4d5075dd050ffeb68ddf8 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 22:51:17 +0200 Subject: [PATCH 02/11] Fix missing field initializer warning in glib/tests/option-argv0.c glib/tests/option-argv0.c:38:14: warning: missing field 'short_name' initializer { NULL } }; ^ --- glib/tests/option-argv0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/option-argv0.c b/glib/tests/option-argv0.c index ce3609743..37ac44a9f 100644 --- a/glib/tests/option-argv0.c +++ b/glib/tests/option-argv0.c @@ -35,7 +35,7 @@ test_platform_argv0 (void) gboolean arg; GOptionEntry entries [] = { { "test", 't', 0, G_OPTION_ARG_STRING, &arg, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; const gchar * const expected_prgnames[] = { "option-argv0", From c65ec0bfbf4e07681672acc5780696ffc065c6fb Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 22:59:04 +0200 Subject: [PATCH 03/11] Fix many missing initializers warnings in glib/tests/option-context.c glib/tests/option-context.c:36:10: warning: missing field 'short_name' initializer { NULL } ^ glib/tests/option-context.c:43:10: warning: missing field 'short_name' initializer { NULL } ^ glib/tests/option-context.c:319:14: warning: missing field 'short_name' initializer { NULL } }; ^ ... ^ glib/tests/option-context.c:2538:12: warning: missing field 'short_name' initializer { NULL } ^ glib/tests/option-context.c:2576:14: warning: missing field 'short_name' initializer { NULL } }; ^ --- glib/tests/option-context.c | 118 ++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/glib/tests/option-context.c b/glib/tests/option-context.c index 1c588d742..50770e704 100644 --- a/glib/tests/option-context.c +++ b/glib/tests/option-context.c @@ -33,14 +33,14 @@ static GOptionEntry main_entries[] = { { "main-switch", 0, 0, G_OPTION_ARG_NONE, NULL, "A switch that is in the main group", NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; static GOptionEntry group_entries[] = { { "test-switch", 0, 0, G_OPTION_ARG_NONE, NULL, "A switch that is in the test group", NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; static GOptionContext * @@ -316,7 +316,7 @@ error_test1 (void) GOptionGroup *main_group; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_INT, &error_test1_int, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; error_test1_int = 0x12345678; @@ -384,7 +384,7 @@ error_test2 (void) GOptionGroup *main_group; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_STRING, &error_test2_string, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; error_test2_string = "foo"; @@ -450,7 +450,7 @@ error_test3 (void) GOptionGroup *main_group; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &error_test3_boolean, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; error_test3_boolean = FALSE; @@ -490,7 +490,7 @@ arg_test1 (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_INT, &arg_test1_int, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -525,7 +525,7 @@ arg_test2 (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_STRING, &arg_test2_string, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -559,7 +559,7 @@ arg_test3 (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_FILENAME, &arg_test3_filename, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -593,7 +593,7 @@ arg_test4 (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_DOUBLE, &arg_test4_double, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -627,7 +627,7 @@ arg_test5 (void) const char *locale = "de_DE.UTF-8"; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_DOUBLE, &arg_test5_double, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -674,7 +674,7 @@ arg_test6 (void) GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_INT64, &arg_test6_int64, NULL, NULL }, { "test2", 0, 0, G_OPTION_ARG_INT64, &arg_test6_int64_2, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -715,7 +715,7 @@ callback_test1 (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_CALLBACK, callback_parse1, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -756,7 +756,7 @@ callback_test2 (void) int argc; GOptionEntry entries [] = { { "test", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, callback_parse2, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -800,7 +800,7 @@ callback_test_optional_1 (void) GOptionEntry entries [] = { { "test", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, callback_parse_optional, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -836,7 +836,7 @@ callback_test_optional_2 (void) GOptionEntry entries [] = { { "test", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, callback_parse_optional, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -872,7 +872,7 @@ callback_test_optional_3 (void) GOptionEntry entries [] = { { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, callback_parse_optional, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -909,7 +909,7 @@ callback_test_optional_4 (void) GOptionEntry entries [] = { { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, callback_parse_optional, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -947,7 +947,7 @@ callback_test_optional_5 (void) { { "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 } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -985,7 +985,7 @@ callback_test_optional_6 (void) { { "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 } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -1023,7 +1023,7 @@ callback_test_optional_7 (void) { { "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 } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -1061,7 +1061,7 @@ callback_test_optional_8 (void) { { "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 } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -1105,7 +1105,7 @@ callback_remaining_test1 (void) int argc; GOptionEntry entries [] = { { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_CALLBACK, callback_remaining_test1_callback, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; callback_remaining_args = g_ptr_array_new (); context = g_option_context_new (NULL); @@ -1152,7 +1152,7 @@ callback_returns_false (void) { { "error", 0, 0, G_OPTION_ARG_CALLBACK, callback_error, NULL, NULL }, { "error-no-arg", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, callback_error, NULL, NULL }, { "error-optional-arg", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, callback_error, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -1235,7 +1235,7 @@ ignore_test1 (void) gchar *arg; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_set_ignore_unknown_options (context, TRUE); @@ -1271,7 +1271,7 @@ ignore_test2 (void) gchar *arg; GOptionEntry entries [] = { { "test", 't', 0, G_OPTION_ARG_NONE, &ignore_test2_boolean, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_set_ignore_unknown_options (context, TRUE); @@ -1306,7 +1306,7 @@ ignore_test3 (void) gchar *arg; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_STRING, &ignore_test3_string, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_set_ignore_unknown_options (context, TRUE); @@ -1344,7 +1344,7 @@ array_test1 (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_STRING_ARRAY, &array_test1_array, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -1376,10 +1376,10 @@ add_test1 (void) GOptionEntry entries1 [] = { { "test1", 0, 0, G_OPTION_ARG_STRING_ARRAY, NULL, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; GOptionEntry entries2 [] = { { "test2", 0, 0, G_OPTION_ARG_STRING_ARRAY, NULL, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries1, NULL); @@ -1427,7 +1427,7 @@ rest_test1 (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1465,7 +1465,7 @@ rest_test2 (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1504,7 +1504,7 @@ rest_test2a (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1541,7 +1541,7 @@ rest_test2b (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1579,7 +1579,7 @@ rest_test2c (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1616,7 +1616,7 @@ rest_test2d (void) int argc; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1656,7 +1656,7 @@ rest_test3 (void) GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &array_test1_array, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1697,7 +1697,7 @@ rest_test4 (void) GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &array_test1_array, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1737,7 +1737,7 @@ rest_test5 (void) GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_NONE, &ignore_test1_boolean, NULL, NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &array_test1_array, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1773,7 +1773,7 @@ unknown_short_test (void) gchar **argv; gchar **argv_copy; int argc; - GOptionEntry entries [] = { { NULL } }; + GOptionEntry entries [] = { G_OPTION_ENTRY_NULL }; g_test_bug ("166609"); @@ -1838,11 +1838,11 @@ triple_dash_test (void) gint arg1, arg2; GOptionEntry entries [] = { { "foo", 0, 0, G_OPTION_ARG_INT, &arg1, NULL, NULL}, - { NULL } + G_OPTION_ENTRY_NULL }; GOptionEntry group_entries [] = { { "test", 0, 0, G_OPTION_ARG_INT, &arg2, NULL, NULL}, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); @@ -1879,7 +1879,7 @@ missing_arg_test (void) gchar *arg = NULL; GOptionEntry entries [] = { { "test", 't', 0, G_OPTION_ARG_STRING, &arg, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; g_test_bug ("305576"); @@ -1945,7 +1945,7 @@ dash_arg_test (void) GOptionEntry entries [] = { { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK, cb, NULL, NULL }, { "three", '3', 0, G_OPTION_ARG_NONE, &argb, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; g_test_bug ("577638"); @@ -1990,7 +1990,7 @@ test_basic (void) gchar *arg = NULL; GOptionEntry entries [] = { { "test", 't', 0, G_OPTION_ARG_STRING, &arg, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); @@ -2051,7 +2051,7 @@ test_translate (void) gchar *arg = NULL; GOptionEntry entries [] = { { "test", 't', 0, G_OPTION_ARG_STRING, &arg, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; TranslateData data = { 0, }; gchar *str; @@ -2085,12 +2085,12 @@ test_help (void) { "test2", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, NULL, "Tests also", NULL }, { "frob", 0, 0, G_OPTION_ARG_NONE, NULL, "Main frob", NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &sarr, "Rest goes here", "REST" }, - { NULL } + G_OPTION_ENTRY_NULL }; GOptionEntry group_entries[] = { { "test", 't', 0, G_OPTION_ARG_STRING, &arg, "Group test", "Group test arg" }, { "frob", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, NULL, "Group frob", NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; context = g_option_context_new ("blabla"); @@ -2134,7 +2134,7 @@ test_help_no_options (void) gchar **sarr = NULL; GOptionEntry entries[] = { { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &sarr, "Rest goes here", "REST" }, - { NULL } + G_OPTION_ENTRY_NULL }; gchar *str; @@ -2164,12 +2164,12 @@ test_help_no_help_options (void) { "test2", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, NULL, "Tests also", NULL }, { "frob", 0, 0, G_OPTION_ARG_NONE, NULL, "Main frob", NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &sarr, "Rest goes here", "REST" }, - { NULL } + G_OPTION_ENTRY_NULL }; GOptionEntry group_entries[] = { { "test", 't', 0, G_OPTION_ARG_STRING, &arg, "Group test", "Group test arg" }, { "frob", 0, G_OPTION_FLAG_NOALIAS, G_OPTION_ARG_NONE, NULL, "Group frob", NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; g_test_bug ("697652"); @@ -2260,7 +2260,7 @@ test_error_hook (void) gchar *arg = NULL; GOptionEntry entries [] = { { "test", 't', 0, G_OPTION_ARG_STRING, &arg, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; GOptionGroup *group; gchar **argv; gchar **argv_copy; @@ -2305,13 +2305,13 @@ test_group_parse (void) GOptionEntry entries[] = { { "test", 't', 0, G_OPTION_ARG_STRING, &arg1, NULL, NULL }, { "faz", 'f', 0, G_OPTION_ARG_STRING, &arg2, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; GOptionEntry group_entries[] = { { "test", 0, 0, G_OPTION_ARG_STRING, &arg3, NULL, NULL }, { "frob", 'f', 0, G_OPTION_ARG_STRING, &arg4, NULL, NULL }, { "faz", 'z', 0, G_OPTION_ARG_STRING, &arg5, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; gchar **argv, **orig_argv; gint argc; @@ -2375,7 +2375,7 @@ test_strict_posix (void) GOptionEntry entries[] = { { "foo", 'f', 0, G_OPTION_ARG_NONE, &foo, NULL, NULL }, { "bar", 'b', 0, G_OPTION_ARG_NONE, &bar, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; gint n_parsed; @@ -2420,7 +2420,7 @@ flag_reverse_string (void) gchar *arg = NULL; GOptionEntry entries [] = { { "test", 't', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_STRING, &arg, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; gchar **argv; gint argc; gboolean retval; @@ -2453,7 +2453,7 @@ flag_optional_int (void) gint arg = 0; GOptionEntry entries [] = { { "test", 't', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_INT, &arg, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; gchar **argv; gint argc; gboolean retval; @@ -2494,7 +2494,7 @@ short_remaining (void) { "number", 'n', 0, G_OPTION_ARG_INT, &number, NULL, NULL }, { "text", 't', 0, G_OPTION_ARG_STRING, &text, NULL, NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &files, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; GOptionContext* context; gchar **argv, **argv_copy; @@ -2535,7 +2535,7 @@ double_free (void) GOptionEntry entries[] = { { "known", 0, 0, G_OPTION_ARG_STRING, &text, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; GOptionContext* context; gchar **argv; @@ -2573,7 +2573,7 @@ double_zero (void) double test_val = NAN; GOptionEntry entries [] = { { "test", 0, 0, G_OPTION_ARG_DOUBLE, &test_val, NULL, NULL }, - { NULL } }; + G_OPTION_ENTRY_NULL }; context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, NULL); From f9904fe7aeda8e8e7cebeed014bb5370650e9818 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 23:03:01 +0200 Subject: [PATCH 04/11] Fix missing initializers warnings in glib/tests/utf8-validate.c glib/tests/utf8-validate.c:271:11: warning: missing field 'max_len' initializer { NULL, } ^ --- glib/tests/utf8-validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/utf8-validate.c b/glib/tests/utf8-validate.c index 51543f4b2..5fc37a3a3 100644 --- a/glib/tests/utf8-validate.c +++ b/glib/tests/utf8-validate.c @@ -268,7 +268,7 @@ Test test[] = { { "\x20\xed\xaf\xbf\xed\xb0\x80\x20", -1, 1, FALSE }, { "\x20\xed\xaf\xbf\xed\xbf\xbf\x20", -1, 1, FALSE }, - { NULL, } + { NULL, 0, 0, 0 } }; static void From 66af2566216d972a4c7a36099dce9efed9c4d074 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 23:04:56 +0200 Subject: [PATCH 05/11] Fix missing initializer warning in glib/tests/spawn-path-search-helper.c glib/tests/spawn-path-search-helper.c:82:12: warning: missing field 'short_name' initializer { NULL } ^ --- glib/tests/spawn-path-search-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/tests/spawn-path-search-helper.c b/glib/tests/spawn-path-search-helper.c index 378c203c7..37be43b7f 100644 --- a/glib/tests/spawn-path-search-helper.c +++ b/glib/tests/spawn-path-search-helper.c @@ -79,7 +79,7 @@ main (int argc, { "slow-path", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, &slow_path, "Use a child-setup function to avoid the posix_spawn fast path", NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; GError *error = NULL; int ret = 1; From 689b9b545f2a6a6aa88030793cec63f15e76a56a Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 23:19:30 +0200 Subject: [PATCH 06/11] Fix missing initializer warning in gio/tests/socket-server.c gio/tests/socket-server.c:43:8: warning: missing field 'short_name' initializer {NULL} ^ --- gio/tests/socket-server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/tests/socket-server.c b/gio/tests/socket-server.c index 24cf0182e..8b0d2a925 100644 --- a/gio/tests/socket-server.c +++ b/gio/tests/socket-server.c @@ -40,7 +40,7 @@ static GOptionEntry cmd_entries[] = { "Time out reads after the specified number of seconds", NULL}, {"tls", 'T', 0, G_OPTION_ARG_STRING, &tls_cert_file, "Use TLS (SSL) with indicated server certificate", "CERTFILE"}, - {NULL} + G_OPTION_ENTRY_NULL }; #include "socket-common.c" From 4301110174007c6a02943bf85a24df4c54dc3789 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 23:21:03 +0200 Subject: [PATCH 07/11] Fix missing initializer warning in gio/tests/socket-client.c gio/tests/socket-client.c:37:8: warning: missing field 'short_name' initializer {NULL} ^ --- gio/tests/socket-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/tests/socket-client.c b/gio/tests/socket-client.c index 8df1c28f3..6c25e08c9 100644 --- a/gio/tests/socket-client.c +++ b/gio/tests/socket-client.c @@ -34,7 +34,7 @@ static GOptionEntry cmd_entries[] = { "Time out reads after the specified number of seconds", NULL}, {"tls", 'T', 0, G_OPTION_ARG_NONE, &tls, "Use TLS (SSL)", NULL}, - {NULL} + G_OPTION_ENTRY_NULL }; #include "socket-common.c" From 27454ed55722e3164fbe514d8c3f68ce6a3cc721 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 23:22:26 +0200 Subject: [PATCH 08/11] Fix missing initializer warning in gio/glib-compile-schemas.c gio/glib-compile-schemas.c:2181:12: warning: missing field 'short_name' initializer { NULL } ^ --- gio/glib-compile-schemas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c index cfea042f8..7e1152f6b 100644 --- a/gio/glib-compile-schemas.c +++ b/gio/glib-compile-schemas.c @@ -2178,7 +2178,7 @@ main (int argc, char **argv) /* These options are only for use in the gschema-compile tests */ { "schema-file", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME_ARRAY, &schema_files, NULL, NULL }, { "override-file", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME_ARRAY, &override_files, NULL, NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; #ifdef G_OS_WIN32 From c395e865bf46e9a1a4fe4383a5911cb3b36ed8ae Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 23:24:24 +0200 Subject: [PATCH 09/11] Fix missing initializer warning in gio/gio-tool-cat.c gio/gio-tool-cat.c:42:10: warning: missing field 'short_name' initializer { NULL } ^ --- gio/gio-tool-cat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gio-tool-cat.c b/gio/gio-tool-cat.c index 66841dd3e..bb0c928f5 100644 --- a/gio/gio-tool-cat.c +++ b/gio/gio-tool-cat.c @@ -39,7 +39,7 @@ static const GOptionEntry entries[] = { - { NULL } + G_OPTION_ENTRY_NULL }; /* 256k minus malloc overhead */ From 8a3e184db933b12eba2b2b4bf72c361ff8838e89 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 23:25:17 +0200 Subject: [PATCH 10/11] Fix missing initializer warning in gio/gio-tool-copy.c gio/gio-tool-copy.c:50:10: warning: missing field 'short_name' initializer { NULL } ^ --- gio/gio-tool-copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gio-tool-copy.c b/gio/gio-tool-copy.c index 0083eba08..cbae0dc6c 100644 --- a/gio/gio-tool-copy.c +++ b/gio/gio-tool-copy.c @@ -47,7 +47,7 @@ static const GOptionEntry entries[] = { { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, N_("Backup existing destination files"), NULL }, { "no-dereference", 'P', 0, G_OPTION_ARG_NONE, &no_dereference, N_("Never follow symbolic links"), NULL }, { "default-permissions", 0, 0, G_OPTION_ARG_NONE, &default_permissions, N_("Use default permissions for the destination"), NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; static gint64 start_time; From 82fc86dcd4f172c2df428ad5aeb79e8a54e88f9c Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Wed, 28 Apr 2021 23:26:34 +0200 Subject: [PATCH 11/11] Fix missing initializer warning in gio/gio-tool-info.c gio/gio-tool-info.c:41:10: warning: missing field 'short_name' initializer { NULL } ^ --- gio/gio-tool-info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gio/gio-tool-info.c b/gio/gio-tool-info.c index a06263545..336da64e2 100644 --- a/gio/gio-tool-info.c +++ b/gio/gio-tool-info.c @@ -38,7 +38,7 @@ static const GOptionEntry entries[] = { { "filesystem", 'f', 0, G_OPTION_ARG_NONE, &filesystem, N_("Get file system info"), NULL }, { "attributes", 'a', 0, G_OPTION_ARG_STRING, &attributes, N_("The attributes to get"), N_("ATTRIBUTES") }, { "nofollow-symlinks", 'n', 0, G_OPTION_ARG_NONE, &nofollow_symlinks, N_("Don’t follow symbolic links"), NULL }, - { NULL } + G_OPTION_ENTRY_NULL }; static char *