Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 05/12] object-file: mark unused parameters in hash_unknown functions
Date: Mon, 17 Oct 2022 21:05:28 -0400	[thread overview]
Message-ID: <Y0372DFS6hG3jwof@coredump.intra.peff.net> (raw)
In-Reply-To: <Y036whEorZV0rOgB@coredump.intra.peff.net>

The 0'th entry of our hash_algos array fills out the virtual methods
with a series of functions which simply BUG(). This is the right thing
to do, since the point is to catch use of an invalid algo parameter, but
we need to annotate them to appease -Wunused-parameters.

Signed-off-by: Jeff King <peff@peff.net>
---
 object-file.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/object-file.c b/object-file.c
index 5e30960234..957790098f 100644
--- a/object-file.c
+++ b/object-file.c
@@ -140,27 +140,32 @@ static void git_hash_sha256_final_oid(struct object_id *oid, git_hash_ctx *ctx)
 	oid->algo = GIT_HASH_SHA256;
 }
 
-static void git_hash_unknown_init(git_hash_ctx *ctx)
+static void git_hash_unknown_init(git_hash_ctx *ctx UNUSED)
 {
 	BUG("trying to init unknown hash");
 }
 
-static void git_hash_unknown_clone(git_hash_ctx *dst, const git_hash_ctx *src)
+static void git_hash_unknown_clone(git_hash_ctx *dst UNUSED,
+				   const git_hash_ctx *src UNUSED)
 {
 	BUG("trying to clone unknown hash");
 }
 
-static void git_hash_unknown_update(git_hash_ctx *ctx, const void *data, size_t len)
+static void git_hash_unknown_update(git_hash_ctx *ctx UNUSED,
+				    const void *data UNUSED,
+				    size_t len UNUSED)
 {
 	BUG("trying to update unknown hash");
 }
 
-static void git_hash_unknown_final(unsigned char *hash, git_hash_ctx *ctx)
+static void git_hash_unknown_final(unsigned char *hash UNUSED,
+				   git_hash_ctx *ctx UNUSED)
 {
 	BUG("trying to finalize unknown hash");
 }
 
-static void git_hash_unknown_final_oid(struct object_id *oid, git_hash_ctx *ctx)
+static void git_hash_unknown_final_oid(struct object_id *oid UNUSED,
+				       git_hash_ctx *ctx UNUSED)
 {
 	BUG("trying to finalize unknown hash");
 }
-- 
2.38.0.371.g300879f34e


  parent reply	other threads:[~2022-10-18  1:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  1:00 [PATCH 0/12] more unused-parameter fixes / annotations Jeff King
2022-10-18  1:01 ` [PATCH 01/12] diffstat_consume(): assert non-zero length Jeff King
2022-10-18  1:02 ` [PATCH 02/12] submodule--helper: drop unused argc from module_list_compute() Jeff King
2022-10-18  1:04 ` [PATCH 03/12] update-index: drop unused argc from do_reupdate() Jeff King
2022-10-18  1:05 ` [PATCH 04/12] mark unused parameters in trivial compat functions Jeff King
2022-10-18  1:05 ` Jeff King [this message]
2022-10-18  1:05 ` [PATCH 06/12] string-list: mark unused callback parameters Jeff King
2022-10-18  1:05 ` [PATCH 07/12] date: mark unused parameters in handler functions Jeff King
2022-10-18  1:08 ` [PATCH 08/12] apply: mark unused parameters in handlers Jeff King
2022-10-18  1:08 ` [PATCH 09/12] apply: mark unused parameters in noop error/warning routine Jeff King
2022-10-18  1:08 ` [PATCH 10/12] convert: mark unused parameter in null stream filter Jeff King
2022-10-18  1:09 ` [PATCH 11/12] diffcore-pickaxe: mark unused parameters in pickaxe functions Jeff King
2022-10-18  1:10 ` [PATCH 12/12] ll-merge: mark unused parameters in callbacks Jeff King

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=Y0372DFS6hG3jwof@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).