From: Junio C Hamano Date: Thu, 20 Jun 2019 22:11:38 GMT Subject: Re: [PATCH v2 2/8] env--helper: new undocumented builtin wrapping git_env_*() Message-ID: In-Reply-To: <20190620210915.11297-3-avarab@gmail.com> Ævar Arnfjörð Bjarmason writes: > + switch (cmdmode) { > + case ENV_HELPER_BOOL: > + tmp_int = strtol(env_default, (char **)&env_default, 10); > + if (*env_default) { > + error(_("option `--default' expects a numerical value with `--mode-bool`")); > + usage_with_options(env__helper_usage, opts); > + } > + ret_int = git_env_bool(env_variable, tmp_int); > + if (!quiet) > + printf("%d\n", ret_int); > + ret = ret_int; > + break; > + case ENV_HELPER_ULONG: > + tmp_ulong = strtoll(env_default, (char **)&env_default, 10); > + if (*env_default) { > + error(_("option `--default' expects a numerical value with `--mode-ulong`")); > + usage_with_options(env__helper_usage, opts); > + } > + ret_ulong = git_env_ulong(env_variable, tmp_ulong); > + if (!quiet) > + printf("%lu\n", ret_ulong); > + ret = ret_ulong; > + break; Perhaps have something like 'default: BUG("wrong cmdmode");' > + } > + > + if (exit_code) > + return !ret; as I am getting error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized] from here. Giving an otherwise useless initial value to ret would be a workaround.