From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 04/11] refs: mark unused virtual method parameters
Date: Fri, 19 Aug 2022 06:08:37 -0400 [thread overview]
Message-ID: <Yv9hJXCU+M/lATSv@coredump.intra.peff.net> (raw)
In-Reply-To: <Yv9gxqH6nK2KYnNj@coredump.intra.peff.net>
The refs code uses various polymorphic types (e.g., loose vs packed
ref_stores, abstracted iterators). Not every virtual function or
callback needs all of its parameters. Let's mark the unused ones to
quiet -Wunused-parameter.
Signed-off-by: Jeff King <peff@peff.net>
---
refs/files-backend.c | 10 +++++-----
refs/iterator.c | 6 +++---
refs/packed-backend.c | 14 ++++++++------
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 972701ce00..13bfdb7701 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -2202,8 +2202,8 @@ static int files_reflog_iterator_advance(struct ref_iterator *ref_iterator)
return ok;
}
-static int files_reflog_iterator_peel(struct ref_iterator *ref_iterator,
- struct object_id *peeled)
+static int files_reflog_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),
+ struct object_id *UNUSED(peeled))
{
BUG("ref_iterator_peel() called for reflog_iterator");
}
@@ -2257,7 +2257,7 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,
static enum iterator_selection reflog_iterator_select(
struct ref_iterator *iter_worktree,
struct ref_iterator *iter_common,
- void *cb_data)
+ void *UNUSED(cb_data))
{
if (iter_worktree) {
/*
@@ -2985,7 +2985,7 @@ static int files_transaction_finish(struct ref_store *ref_store,
static int files_transaction_abort(struct ref_store *ref_store,
struct ref_transaction *transaction,
- struct strbuf *err)
+ struct strbuf *UNUSED(err))
{
struct files_ref_store *refs =
files_downcast(ref_store, 0, "ref_transaction_abort");
@@ -3261,7 +3261,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
return -1;
}
-static int files_init_db(struct ref_store *ref_store, struct strbuf *err)
+static int files_init_db(struct ref_store *ref_store, struct strbuf *UNUSED(err))
{
struct files_ref_store *refs =
files_downcast(ref_store, REF_STORE_WRITE, "init_db");
diff --git a/refs/iterator.c b/refs/iterator.c
index b2e56bae1c..e34921db72 100644
--- a/refs/iterator.c
+++ b/refs/iterator.c
@@ -51,8 +51,8 @@ static int empty_ref_iterator_advance(struct ref_iterator *ref_iterator)
return ref_iterator_abort(ref_iterator);
}
-static int empty_ref_iterator_peel(struct ref_iterator *ref_iterator,
- struct object_id *peeled)
+static int empty_ref_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),
+ struct object_id *UNUSED(peeled))
{
BUG("peel called for empty iterator");
}
@@ -238,7 +238,7 @@ struct ref_iterator *merge_ref_iterator_begin(
*/
static enum iterator_selection overlay_iterator_select(
struct ref_iterator *front, struct ref_iterator *back,
- void *cb_data)
+ void *UNUSED(cb_data))
{
int cmp;
diff --git a/refs/packed-backend.c b/refs/packed-backend.c
index 97b6837767..a45bb686f0 100644
--- a/refs/packed-backend.c
+++ b/refs/packed-backend.c
@@ -726,7 +726,7 @@ static struct snapshot *get_snapshot(struct packed_ref_store *refs)
}
static int packed_read_raw_ref(struct ref_store *ref_store, const char *refname,
- struct object_id *oid, struct strbuf *referent,
+ struct object_id *oid, struct strbuf *UNUSED(referent),
unsigned int *type, int *failure_errno)
{
struct packed_ref_store *refs =
@@ -1078,7 +1078,8 @@ int packed_refs_is_locked(struct ref_store *ref_store)
static const char PACKED_REFS_HEADER[] =
"# pack-refs with: peeled fully-peeled sorted \n";
-static int packed_init_db(struct ref_store *ref_store, struct strbuf *err)
+static int packed_init_db(struct ref_store *UNUSED(ref_store),
+ struct strbuf *UNUSED(err))
{
/* Nothing to do. */
return 0;
@@ -1473,7 +1474,7 @@ static int packed_transaction_prepare(struct ref_store *ref_store,
static int packed_transaction_abort(struct ref_store *ref_store,
struct ref_transaction *transaction,
- struct strbuf *err)
+ struct strbuf *UNUSED(err))
{
struct packed_ref_store *refs = packed_downcast(
ref_store,
@@ -1512,7 +1513,7 @@ static int packed_transaction_finish(struct ref_store *ref_store,
return ret;
}
-static int packed_initial_transaction_commit(struct ref_store *ref_store,
+static int packed_initial_transaction_commit(struct ref_store *UNUSED(ref_store),
struct ref_transaction *transaction,
struct strbuf *err)
{
@@ -1568,7 +1569,8 @@ static int packed_delete_refs(struct ref_store *ref_store, const char *msg,
return ret;
}
-static int packed_pack_refs(struct ref_store *ref_store, unsigned int flags)
+static int packed_pack_refs(struct ref_store *UNUSED(ref_store),
+ unsigned int UNUSED(flags))
{
/*
* Packed refs are already packed. It might be that loose refs
@@ -1578,7 +1580,7 @@ static int packed_pack_refs(struct ref_store *ref_store, unsigned int flags)
return 0;
}
-static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_store)
+static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *UNUSED(ref_store))
{
return empty_ref_iterator_begin();
}
--
2.37.2.928.g0821088f4a
next prev parent reply other threads:[~2022-08-19 10:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 10:07 [PATCH 0/11] annotating unused function parameters Jeff King
2022-08-19 10:08 ` [PATCH 01/11] git-compat-util: add UNUSED macro Jeff King
2022-08-19 10:08 ` [PATCH 02/11] refs: mark unused each_ref_fn parameters Jeff King
2022-08-19 10:08 ` [PATCH 03/11] refs: mark unused reflog callback parameters Jeff King
2022-08-19 10:08 ` Jeff King [this message]
2022-08-19 10:08 ` [PATCH 05/11] transport: mark bundle transport_options as unused Jeff King
2022-08-19 10:08 ` [PATCH 06/11] streaming: mark unused virtual method parameters Jeff King
2022-08-19 10:08 ` [PATCH 07/11] config: mark unused callback parameters Jeff King
2022-08-19 10:08 ` [PATCH 08/11] hashmap: " Jeff King
2022-08-19 10:08 ` [PATCH 09/11] mark unused read_tree_recursive() " Jeff King
2022-08-19 10:08 ` [PATCH 10/11] run-command: mark unused async " Jeff King
2022-08-19 10:08 ` [PATCH 11/11] is_path_owned_by_current_uid(): mark "report" parameter as unused Jeff King
2022-08-19 13:58 ` [PATCH 0/11] annotating unused function parameters Ævar Arnfjörð Bjarmason
2022-08-19 18:59 ` Derrick Stolee
2022-08-19 20:58 ` Ævar Arnfjörð Bjarmason
2022-08-20 9:46 ` Jeff King
2022-08-20 21:21 ` Junio C Hamano
2022-08-22 14:14 ` Derrick Stolee
2022-08-25 11:00 ` Ævar Arnfjörð Bjarmason
2022-08-26 7:10 ` Jeff King
2022-08-26 13:08 ` Phillip Wood
2022-08-26 16:37 ` 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=Yv9hJXCU+M/lATSv@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 NNTP newsgroup(s).