Ævar Arnfjörð Bjarmason  <ava...@gmail.com> 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.

Reply via email to