]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
options: add workaround for spurious warning with gcc 11–13
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Sun, 1 Mar 2026 14:37:24 +0000 (15:37 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Fri, 20 Mar 2026 16:26:52 +0000 (17:26 +0100)
gcc 14+ doesn't need this.

src/shared/options.c

index c5e7057bf85ae04c7076c9b189dfa6c14251e145..09b677f8133120b3aedcbc685667a60ef9cef8ac 100644 (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",