Re: [PATCH v2 0/4] add ref content check for files backend
- From
Jeff King <peff@peff.net>
- Date
- Aug 29, 2024, 04:02 UTC
- Message-ID
- <20240829040215.GA4054823@coredump.intra.peff.net>
- In-Reply-To
- <xmqqbk1cz69c.fsf@gitster.g>
On Wed, Aug 28, 2024 at 02:28:47PM -0700, Junio C Hamano wrote:
> By the way, Peff, do we have MAYBE_UNUSED that can be used in a case > like this one? Platforms without symbolic links supported may well > define NO_SYMLINK_HEAD, which makes the incoming parameters unused.
Yes, it would be fine to use MAYBE_UNUSED in a case like this.
The other option, and what I did for a conditional compilation in imap-send.c, is to just mention the variable like:
/* mark as used to appease -Wunused-parameter with NO_SYMLINK_HEAD */ (void)lock; (void)target;
In retrospect I think MAYBE_UNUSED is probably a little less magical, and I perhaps should have used it there.
In this particular case, though, where there's no actual code in one half of the #ifdef, I think just defining two separate functions is cleaner. I.e., what you did with a macro below, though I'd probably have just used a real function with UNUSED markers.
As an aside, I wonder if we should consider deprecating and eventually dropping support for core.prefersymlinkrefs. I can't think of a reason anybody would want to use it, and of course it makes no sense as we move on to alternate backends like reftables. I sent patches ages ago:
https://lore.kernel.org/git/20151229060055.GA17047@sigill.intra.peff.net/
but I think it may have just gotten lost in the shuffle, and I've somehow been meaning to re-submit them for 9 years. :-/
-Peff