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

Re: [PATCH] sparse: allow '{ 0 }' to be used without warnings

From
Eric Sunshine <sunshine@sunshineco.com>
Date
May 21, 2020, 21:50 UTC
Message-ID
<CAPig+cQsYSE30ab9qQO7V+CzAdUodpw64sCnZH+1s3oD-P6msg@mail.gmail.com>
In-Reply-To
<20200521214544.8784-1-luc.vanoostenryck@gmail.com>

On Thu, May 21, 2020 at 5:46 PM Luc Van Oostenryck <luc.vanoostenryck@gmail.com> wrote:

Show 7 quoted lines
> In standard C, '{ 0 }' can be used as an universal zero-initializer.
> However, Sparse complains if this is used on a type where the first
> member (possibly nested) is a pointer since Sparse purposely wants
> to warn when '0' is used to initialize a pointer type.
>
> Legitimaly, it's desirable to be able to use '{ 0 }' as an idom
> without these warnings [1,2].
s/idom/idiom/
> An option have now been added to Sparse to turn off such warnings.
> So, add this option to the SPARSE_FLAGS variable.

Do you have a reference to the commit or Sparse release notes which mention this new option? It might be nice to include it here in the commit message. Also, should this minimum Sparse version be mentioned somewhere in documentation so that people invoking the "sparse" makefile target aren't greeted with an error about -Wno-universal-initializer being an unrecognized option (assuming that older Sparse would complain about it)?

> [1] https://lore.kernel.org/r/e6796c60-a870-e761-3b07-b680f934c537@ramsayjones.plus.com
> [2] https://lore.kernel.org/r/xmqqd07xem9l.fsf@gitster.c.googlers.com
>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Previous: Luc Van OostenryckNext: Junio C Hamano
Message 2 of 3 in “sparse: allow '{ 0 }' to be used without warnings”
  1. sparse: allow '{ 0 }' to be used without warningsLuc Van Oostenryck, May 21, 2020
  2. Eric SunshineMay 21, 2020
  3. Junio C HamanoMay 21, 2020

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.