git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Jeff King <peff@peff.net>
Cc: Johannes Sixt <j.sixt@viscovery.net>,
	Junio C Hamano <gitster@pobox.com>,
	GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [PATCH] Fix some sparse warnings
Date: Thu, 18 Jul 2013 18:58:40 +0100	[thread overview]
Message-ID: <51E82CD0.8060302@ramsay1.demon.co.uk> (raw)
In-Reply-To: <20130716062122.GA4964@sigill.intra.peff.net>

Jeff King wrote:
> On Tue, Jul 16, 2013 at 07:57:20AM +0200, Johannes Sixt wrote:
> 
>> 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.

Yes, last time this came up, I looked at writing a patch to sparse to
allow this without complaint. It's still on my sparse TODO list, but
even if I finished it tonight, it would take a while to get into a
released version of sparse. ;-)

> 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).

Indeed, if it wasn't for this, I would be happy to turn this warning off.

ATB,
Ramsay Jones

  parent reply	other threads:[~2013-07-18 20:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 17:31 [PATCH] Fix some sparse warnings Ramsay Jones
2013-07-16  5:57 ` Johannes Sixt
2013-07-16  6:21   ` Jeff King
2013-07-16 20:53     ` Philip Oakley
2013-07-16 21:18       ` Stefan Beller
2013-07-16 22:18         ` Philip Oakley
2013-07-17  5:47         ` Johannes Sixt
2013-07-17 22:08       ` Stefan Beller
2013-07-17 22:09         ` [PATCH] parse_object_buffer: Correct freeing the buffer Stefan Beller
2013-07-17 22:16         ` [PATCH] Fix some sparse warnings Stefan Beller
2013-07-17 23:22         ` Junio C Hamano
2013-07-18 17:58     ` Ramsay Jones [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-07-18 20:25 Ramsay Jones
2013-07-18 20:36 ` Jeff King
2013-07-20 19:26   ` Ramsay Jones
2013-07-21 17:39 ` Jonathan Nieder
2013-07-21 20:58   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51E82CD0.8060302@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1.demon.co.uk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).