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

Re: [PATCH] refs: forbid clang to complain about unreachable code

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 11, 2025, 10:49 UTC
Message-ID
<aOo2Os8Q0X3WaLM0@pks.im>
In-Reply-To
<2346bcc7-b60e-0ad6-14fe-c0b49e427921@gmx.de>
On Fri, Oct 10, 2025 at 03:49:37PM +0200, Johannes Schindelin wrote:
Show 22 quoted lines
> Hi Patrick,
> 
> On Fri, 10 Oct 2025, Patrick Steinhardt wrote:
> 
> > diff --git a/refs/files-backend.c b/refs/files-backend.c
> > index bb2bec3807..cb402a2a54 100644
> > --- a/refs/files-backend.c
> > +++ b/refs/files-backend.c
> > @@ -2115,7 +2115,7 @@ static int commit_ref_update(struct files_ref_store *refs,
> >  }
> >  
> >  #ifdef NO_SYMLINK_HEAD
> > -#define create_ref_symlink(a, b) (-1)
> > +#define create_ref_symlink(a, b) NOT_CONSTANT(-1)
> >  #else
> >  static int create_ref_symlink(struct ref_lock *lock, const char *target)
> >  {
> 
> While this is correct, and "closer to the root", in my experience it is
> better to have work-arounds closer to where the symptom appears. In this
> case, it would be directly in the condition of the `if ()` construct.
> Therefore, I would prefer to keep the proposed patch as-is.

As said, I don't feel strongly about it, so this is totally fine with me. Thanks!

Patrick
Previous: Johannes SchindelinNext: Junio C Hamano
Message 6 of 7 in “refs: forbid clang to complain about unreachable code”
  1. refs: forbid clang to complain about unreachable codeJohannes Schindelin via GitGitGadget, Oct 9, 2025
  2. Junio C HamanoOct 9, 2025
  3. Patrick SteinhardtOct 10, 2025
  4. Patrick SteinhardtOct 10, 2025
  5. Johannes SchindelinOct 10, 2025
  6. Patrick SteinhardtOct 11, 2025
  7. Junio C HamanoOct 10, 2025

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.