From: Ramsay Jones Date: Fri, 19 Jul 2024 02:03:19 GMT Subject: Re: [PATCH] sparse: ignore warning from new glibc headers Message-ID: <28fd393a-2d8a-4019-95bc-d1a2e409cf53@ramsayjones.plus.com> In-Reply-To: On 18/07/2024 05:47, Junio C Hamano wrote: > Ramsay Jones writes: > >> On 17/07/2024 23:53, Junio C Hamano wrote: >> [snip] >>> That's OK. So in short, with a separate SP_EXTRA_FLAGS with "-Wno-vla", >>> Luc's patch is a sufficient fix without any downsides, no? >>> >> >> Yes, assuming you're only concerned with 'make sparse' usage. > > Is there anything else in the context of this project I should be > concerned with, wrt sparse and recent that > uses vla in prototype parameters? No, I don't think so. At the time I remember looking around for more uses of VLA's in the glibc header files and finding nothing of concern: $ find /usr/include -iname '*.h' | > xargs grep -n __STDC_NO_VLA__ /usr/include/regex.h:527: && !defined __STDC_NO_VLA__) /usr/include/brotli/port.h:251: !defined(__STDC_NO_VLA__) && !defined(__cplusplus) && \ $ The header has only a single use of the _REGEX_NELTS macro in the declaration of the regexec() function. The header defines an BROTLI_ARRAY_PARAM macro, but does not use it in the header file. It is available for use in your own source file, but ... I suppose it is possible that other headers use VLA's in their declarations and are not protected by __STDC_NO_VLA__, but that seems unlikely. The headers that we actually use (for the symbols we use), can't include any VLA's or gcc would complain (via -Wvla). Also, it seems is the only header that suppresses -Wvla: $ find /usr/include -iname '*.h' | > xargs grep -n '\-Wvla' /usr/include/regex.h:536:# pragma GCC diagnostic ignored "-Wvla" $ ATB, Ramsay Jones