options: add workaround for spurious warning with gcc 11–13

gcc 14+ doesn't need this.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-03-20 17:26:52 +01:00
parent eafd3e6a7d
commit b6bc0948cd
+3 -1
View File
@@ -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",