Re: [PATCH v6 10/15] bugreport: add config values from safelist
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Feb 7, 2020, 15:08 UTC
- Message-ID
- <20200207150857.GH2868@szeder.dev>
- In-Reply-To
- <20200207144725.GF2868@szeder.dev>
On Fri, Feb 07, 2020 at 03:47:25PM +0100, SZEDER Gábor wrote:
Show 24 quoted lines
> On Wed, Feb 05, 2020 at 04:41:03PM -0800, Emily Shaffer wrote:
> > +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?macOS 'sed', that's what I was missing :)
So that array is in fact empty on macOS, because the entries of that array are generated with:
# cat all regular files in Documentation/config
find Documentation/config -type f -exec cat {} \; |
# print the command name which matches the annotate-bugreport macro
sed -n 's/^\(.*\) \+annotate:bugreport\[include\].* ::$/ "\1",/p' | sortand the 'sed' included in macOS apparently interprets that '\+' differently than GNU 'sed', and as a result won't match anything.
FWIW, that '\+' doesn't seem to be necessary, though, and after removing it the resulting generated array looked good to me (and to the compiler) both on Linux and macOS.