From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] refs: forbid clang to complain about unreachable code
Date: Fri, 10 Oct 2025 08:48:56 -0700 [thread overview]
Message-ID: <xmqqwm52ahav.fsf@gitster.g> (raw)
In-Reply-To: <aOia55_sjFQjw1UQ@pks.im> (Patrick Steinhardt's message of "Fri, 10 Oct 2025 07:34:31 +0200")
Patrick Steinhardt <ps@pks.im> writes:
> An alternative could be to fix this at the source, e.g. like the below
> (untested) patch. But I don't mind this too much, especially given that
> this here is the only callsite of that function anyway. So please feel
> free to disregard.
>
> Thanks!
Indeed that is much nicer as it targets only NO_SYMLINK_HEAD case
without affecting the other side of #ifdef/#else/#endif but as you
say, I think this falls into "once the code is written one way, it
is not worth revisiting to change it with more iterations" category.
Thanks for very sharp eyes, nevertheless.
> 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)
> {
prev parent reply other threads:[~2025-10-10 15:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 7:46 [PATCH] refs: forbid clang to complain about unreachable code Johannes Schindelin via GitGitGadget
2025-10-09 20:30 ` Junio C Hamano
2025-10-10 5:36 ` Patrick Steinhardt
2025-10-10 5:34 ` Patrick Steinhardt
2025-10-10 13:49 ` Johannes Schindelin
2025-10-11 10:49 ` Patrick Steinhardt
2025-10-10 15:48 ` Junio C Hamano [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=xmqqwm52ahav.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johannes.schindelin@gmx.de \
--cc=ps@pks.im \
/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).