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

Re: [PATCH 2/2] remove NORETURN from function pointers

From
Erik Faye-Lund <kusmabite@googlemail.com>
Date
Sep 14, 2009, 12:56 UTC
Message-ID
<40aa078e0909140556j401085ccmdf43521b8b839e8e@mail.gmail.com>
In-Reply-To
<20090914124428.GA9394@coredump.intra.peff.net>
On Mon, Sep 14, 2009 at 2:44 PM, Jeff King <peff@peff.net> wrote:
Show 13 quoted lines
> Right. What I'm guessing is that it sees the noreturn on die(), but then
> doesn't actually look inside die to confirm that the noreturn is upheld.
> You could test that with:
>
> #include <stdlib.h>
> void __declspec(noreturn) die(void);
> void die(void) { }
> int main(void) { die(); }
>
> If it doesn't complain, then I am right. If it does, then it is
> something magic with the function pointer (presumably it decides that
> the function pointer could exit, so it stops the analysis and gives your
> code the benefit of the doubt).
It seems that you are right. It doesn't complain here.
Show 10 quoted lines
>> The arguments against each solution I see are these:
>> - abort() gives a run-time error instead of a compile-time warning, so
>> breakage is trickier to detect (on GCC, which seems to be the target
>> compiler for the vast majority of git-developers).
>> - NORETURN_PTR might be bit big of a hammer for a small problem, as it
>> "pollutes" the whole git source-tree instead of just usage.c.
>
> I don't know that NORETURN_PTR pollutes the whole source-tree. At least
> no more than NORETURN does. The only functions that will need it are
> these two function pointers.

Well, it does pollute the global name space, and it's "noise" when reading the source code. But those are really very unimportant points IMO.

And sure, that "pollution/noise" is there for the NORETURN case anyway for a functional/practical reason, so you might argue that it justifies the presence in the NORETURN_PTR case.

I'll wait a day or so and see if anyone else has any insight. If not, I'll go ahead and re-post a version based on the NORETURN_PTR-solution.

-- 
Erik "kusma" Faye-Lund
kusmabite@gmail.com
(+47) 986 59 656
Previous: Jeff KingNext: Johannes Sixt
Message 9 of 17 in “remove NORETURN from function pointers”
  1. 2/2 remove NORETURN from function pointersErik Faye-Lund, Sep 14, 2009
  2. Jeff KingSep 14, 2009
  3. Erik Faye-LundSep 14, 2009
  4. Erik Faye-LundSep 14, 2009
  5. Jeff KingSep 14, 2009
  6. Jeff KingSep 14, 2009
  7. Erik Faye-LundSep 14, 2009
  8. Jeff KingSep 14, 2009
  9. Erik Faye-LundSep 14, 2009
  10. Johannes SixtSep 14, 2009
  11. Erik Faye-LundSep 14, 2009
  12. Johannes SixtSep 14, 2009
  13. Erik Faye-LundSep 14, 2009
  14. Johannes SixtSep 14, 2009
  15. Junio C HamanoSep 22, 2009
  16. Erik Faye-LundSep 25, 2009
  17. Erik Faye-LundSep 30, 2009

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.