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

Re: [PATCH] Fix some sparse warnings

From
Jeff King <peff@peff.net>
Date
Jul 16, 2013, 06:21 UTC
Message-ID
<20130716062122.GA4964@sigill.intra.peff.net>
In-Reply-To
<51E4E0C0.3060604@viscovery.net>
On Tue, Jul 16, 2013 at 07:57:20AM +0200, Johannes Sixt wrote:
Show 8 quoted lines
> Am 7/15/2013 19:31, schrieb Ramsay Jones:
> > Sparse issues three "Using plain integer as NULL pointer" warnings.
> > Each warning relates to the use of an '{0}' initialiser expression
> > in the declaration of an 'struct object_info'.
> 
> I question the value of this warning. Initialization with '= {0}' is a
> well-established idiom, and sparse should know about it. Also, plain 0
> *is* a null pointer constant.

I agree with you. It's not a bug, and I think sparse is being overly picky here; it is missing the forest for the trees in interpreting the idiom.

Still, it may be worth tweaking in the name of eliminating compiler noise, since it does not cost us very much to do so (and I believe we have done so in the past, too).

We could also ask people with sparse to turn off the "use NULL instead of 0" warning, but I think it _is_ a useful warning elsewhere (even though it is never a bug, it violates our style guidelines and may be an indication of a bug). It would be nice if sparse learned to ignore the warning in this particular idiom, but I am not going to hold my breath for that.

-Peff
Previous: Johannes SixtNext: Philip Oakley
Message 3 of 12 in “Fix some sparse warnings”
  1. Fix some sparse warningsRamsay Jones, Jul 15, 2013
  2. Johannes SixtJul 16, 2013
  3. Jeff KingJul 16, 2013
  4. Philip OakleyJul 16, 2013
  5. Stefan BellerJul 16, 2013
  6. Philip OakleyJul 16, 2013
  7. Johannes SixtJul 17, 2013
  8. Stefan BellerJul 17, 2013
  9. parse_object_buffer: Correct freeing the buffer.Stefan Beller, Jul 17, 2013
  10. Stefan BellerJul 17, 2013
  11. Junio C HamanoJul 17, 2013
  12. Ramsay JonesJul 18, 2013

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.