git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: Jeff King <peff@peff.net>,  git@vger.kernel.org
Subject: Re: [PATCH 2/2] grep: prefer UNUSED to MAYBE_UNUSED for pcre allocators
Date: Fri, 30 Aug 2024 09:30:14 -0700	[thread overview]
Message-ID: <xmqqwmjyrn1l.fsf@gitster.g> (raw)
In-Reply-To: <ZtFpGjBFlMNPnSld@tanuki> (Patrick Steinhardt's message of "Fri, 30 Aug 2024 08:39:22 +0200")

Patrick Steinhardt <ps@pks.im> writes:

> On Thu, Aug 29, 2024 at 04:09:53PM -0400, Jeff King wrote:
>> We prove custom malloc/free callbacks for the pcre library to use. Those
>> take an extra "data" parameter, but we don't use it. Back when these
>> were added in 513f2b0bbd (grep: make PCRE2 aware of custom allocator,
>> 2019-10-16), we only had MAYBE_UNUSED. But these days we have UNUSED,
>> which we should prefer, as it will let the compiler inform us if the
>> code changes to actually use the parameters.
>> 
>> I also moved the annotations to come after the variable name, which is
>> how we typically spell it.
>> 
>> Signed-off-by: Jeff King <peff@peff.net>
>> ---
>> Where "how we typically spell it" is "me", because I wrote 99% of the
>> annotations we have. ;) I'm open to debate, but only if it is
>> accompanied by a patch to change all of them to be consistent.
>
> I don't care about the order, but if we settle on one I think we should
> also document this accordingly in our code style guide.

Very true.  I think Peff's [PATCH 7/6] was sufficient by ending the
new instruction with

	... like "int foo UNUSED".

when it talked about the -Werror=unused-parameter.

Thanks.

  reply	other threads:[~2024-08-30 16:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 20:08 [PATCH 0/2] clean up some MAYBE_UNUSED cases Jeff King
2024-08-29 20:08 ` [PATCH 1/2] gc: drop MAYBE_UNUSED annotation from used parameter Jeff King
2024-08-29 20:09 ` [PATCH 2/2] grep: prefer UNUSED to MAYBE_UNUSED for pcre allocators Jeff King
2024-08-29 20:27   ` Eric Sunshine
2024-08-30  6:39   ` Patrick Steinhardt
2024-08-30 16:30     ` Junio C Hamano [this message]
2024-08-29 20:46 ` [PATCH 0/2] clean up some MAYBE_UNUSED cases Junio C Hamano

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=xmqqwmjyrn1l.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --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).