Re: [PATCH v6 10/15] bugreport: add config values from safelist
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Feb 7, 2020, 14:47 UTC
- Message-ID
- <20200207144725.GF2868@szeder.dev>
- In-Reply-To
- <20200206004108.261317-11-emilyshaffer@google.com>
On Wed, Feb 05, 2020 at 04:41:03PM -0800, Emily Shaffer wrote:
Show 7 quoted lines
> +static void get_safelisted_config(struct strbuf *config_info)
> +{
> + size_t idx;
> + struct string_list_item *it = NULL;
> + struct key_value_info *kv_info = NULL;
> +
> + for (idx = 0; idx < ARRAY_SIZE(bugreport_config_safelist); idx++) {GCC 9 complains about this loop condition:
CC bugreport.o
bugreport.c: In function 'get_safelisted_config':
bugreport.c:66:20: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
66 | for (idx = 0; idx < ARRAY_SIZE(bugreport_config_safelist); idx++) {
| ^I don't understand this error, that autogenerated 'bugreport_config_safelist' array clearly has a a non-zero size. What am I missing?
Show 16 quoted lines
> + const struct string_list *list =
> + git_config_get_value_multi(bugreport_config_safelist[idx]);
> +
> + if (!list)
> + continue;
> +
> + strbuf_addf(config_info, "%s:\n", bugreport_config_safelist[idx]);
> + for_each_string_list_item(it, list) {
> + kv_info = it->util;
> + strbuf_addf(config_info, " %s (%s)\n", it->string,
> + kv_info ? config_scope_name(kv_info->scope)
> + : "source unknown");
> + }
> + }
> +}
> +