Re: [PATCH] sparse: ignore warning from new glibc headers
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- Jul 19, 2024, 02:03 UTC
- Message-ID
- <28fd393a-2d8a-4019-95bc-d1a2e409cf53@ramsayjones.plus.com>
- In-Reply-To
- <xmqqplrb1f2p.fsf@gitster.g>
On 18/07/2024 05:47, Junio C Hamano wrote:
Show 13 quoted lines
> Ramsay Jones <ramsay@ramsayjones.plus.com> 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 </usr/include/regex.h> 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 <regex.h> header has only a single use of the _REGEX_NELTS macro in the declaration of the regexec() function.
The <brotli/port.h> 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 <regex.h> 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