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

Re: [PATCH] usage: fix a sparse 'redeclared with different type' error

From
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Date
May 23, 2017, 01:02 UTC
Message-ID
<CAExDi1QdoxZFLtU5ja_2QpdCKkaOd69uHg6QMapk05MzGdrybw@mail.gmail.com>
In-Reply-To
<20170516030200.fivl7p5iukfxk2jb@sigill.intra.peff.net>
On Tue, May 16, 2017 at 5:02 AM, Jeff King <peff@peff.net> wrote:
Show 15 quoted lines
> 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
Previous: Ramsay Jones
Message 4 of 4 in “usage: fix a sparse 'redeclared with different type' error”
  1. usage: fix a sparse 'redeclared with different type' errorRamsay Jones, May 16, 2017
  2. Jeff KingMay 16, 2017
  3. Ramsay JonesMay 16, 2017
  4. Luc Van OostenryckMay 23, 2017

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.