Re: [PATCH v2 2/8] env--helper: new undocumented builtin wrapping git_env_*()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> 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.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux