From 8318176cc9801949cc7f4365198fb7eb488d3acf Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 14 Apr 2022 20:42:44 +0200 Subject: [PATCH] mxqset: Use initializers with designators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Not all fields of struct argp_option and struct argp are initialized: mxqset.c:192:5: warning: missing initializer for field ‘group’ of ‘const struct argp_option’ [-Wmissing-field-initializers] {"whitelist", 15, "", 0, NULL}, mxqset.c:196:21: warning: missing initializer for field ‘children’ of ‘const struct argp’ [-Wmissing-field-initializers] static const struct argp argp = { options, parser, NULL, NULL } Use structure initializers with designators, which initialize all remaining fields with their zero values. --- mxqset.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mxqset.c b/mxqset.c index c67e4e33..126471f6 100644 --- a/mxqset.c +++ b/mxqset.c @@ -186,14 +186,14 @@ static error_t parser (int key, char *arg, struct argp_state *state) { } static const struct argp_option options[] = { - {"closed", 10, NULL, 0, NULL}, - {"open", 11, NULL, 0, NULL}, - {"blacklist", 13, "", 0, NULL}, - {"whitelist", 15, "", 0, NULL}, + { .name = "closed", .key = 10 }, + { .name = "open", .key = 11 }, + { .name = "blacklist", .key = 13 }, + { .name = "whitelist", .key = 15 }, {0} }; -static const struct argp argp = { options, parser, NULL, NULL }; +static const struct argp argp = { .options = options, .parser = parser }; static __attribute__ ((noreturn)) void exit_usage(void) { fprintf(stderr,