git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Junio C HamanoNext: Johannes Schindelin
Message 13 of 15 in “sparse: ignore warning from new glibc headers”
  1. sparse: ignore warning from new glibc headersĐoàn Trần Công Danh, Jul 16, 2024
  2. Junio C HamanoJul 17, 2024
  3. Ramsay JonesJul 17, 2024
  4. Junio C HamanoJul 17, 2024
  5. Ramsay JonesJul 17, 2024
  6. Ramsay JonesJul 17, 2024
  7. Junio C HamanoJul 17, 2024
  8. Ramsay JonesJul 18, 2024
  9. Đoàn Trần Công DanhJul 18, 2024
  10. Junio C HamanoJul 18, 2024
  11. Đoàn Trần Công DanhJul 18, 2024
  12. Junio C HamanoJul 18, 2024
  13. Ramsay JonesJul 19, 2024
  14. Johannes SchindelinApr 8, 2025
  15. Junio C HamanoApr 8, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.