From: Zbigniew Jędrzejewski-Szmek Date: Sun, 1 Mar 2026 14:37:24 +0000 (+0100) Subject: options: add workaround for spurious warning with gcc 11–13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b6bc0948cd2f5962b77008d4337d88630a9eabd3;p=thirdparty%2Fsystemd.git options: add workaround for spurious warning with gcc 11–13 gcc 14+ doesn't need this. --- diff --git a/src/shared/options.c b/src/shared/options.c index c5e7057bf85..09b677f8133 100644 --- a/src/shared/options.c +++ b/src/shared/options.c @@ -95,7 +95,7 @@ int option_parse( /* Look for the next option */ - const Option *option; + const Option *option = NULL; /* initialization to appease gcc 13 */ const char *optname = NULL, *optval = NULL; _cleanup_free_ char *_optname = NULL; /* allocated option name */ bool separate_optval = false; @@ -206,6 +206,8 @@ int option_parse( } } + assert(option); + if (optval && !option_takes_arg(option)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "%s: option '%s' doesn't allow an argument",