From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Ramsay Jones <ramsay@ramsayjones.plus.com>,
Junio C Hamano <gitster@pobox.com>,
GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [PATCH] usage: fix a sparse 'redeclared with different type' error
Date: Tue, 23 May 2017 03:02:56 +0200 [thread overview]
Message-ID: <CAExDi1QdoxZFLtU5ja_2QpdCKkaOd69uHg6QMapk05MzGdrybw@mail.gmail.com> (raw)
In-Reply-To: <20170516030200.fivl7p5iukfxk2jb@sigill.intra.peff.net>
On Tue, May 16, 2017 at 5:02 AM, Jeff King <peff@peff.net> wrote:
> On Tue, May 16, 2017 at 02:11:40AM +0100, Ramsay Jones wrote:
>
>>
>> If you need to re-roll your 'jk/bug-to-abort' branch, could you please
>> squash this into the relevant patch (commit d8193743e0 "usage.c: add
>> BUG() function", 12-05-2017).
>>
>> [Just FYI, sparse complains thus:
>> usage.c:212:6: error: symbol 'BUG_fl' redeclared with different type
>> (originally declared at git-compat-util.h:1076) - different modifiers
>> ]
>
> Hmm. Our model here is the die() function, which gets noreturn and
> format attributes in the declaration, but only noreturn at the
> definition.
It's because a deficiency of sparse: the format attribute is simply ignored
while the NORETURN is treated as a 'modifiers' not much different than
'const' or 'extern'.
But the real problem here with sparse is that while it indeed compare
the declaration with the definition, this is done not by checking compatibility
but by strict equality. In other words, the NORETURN, but also a 'static',
in the declaration should be somehow inherited in a subsequent definition
but sparse doesn't do that yet.
-- Luc Van Oostenryck
prev parent reply other threads:[~2017-05-23 1:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 1:11 [PATCH] usage: fix a sparse 'redeclared with different type' error Ramsay Jones
2017-05-16 3:02 ` Jeff King
2017-05-16 12:27 ` Ramsay Jones
2017-05-23 1:02 ` Luc Van Oostenryck [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAExDi1QdoxZFLtU5ja_2QpdCKkaOd69uHg6QMapk05MzGdrybw@mail.gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=ramsay@ramsayjones.plus.com \
/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.
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 NNTP newsgroup(s).