git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: git@vger.kernel.org
Subject: [PATCH 12/21] list-objects: mark unused callback parameters
Date: Fri, 24 Feb 2023 01:39:22 -0500	[thread overview]
Message-ID: <Y/hbmh2jpj4OgWUN@coredump.intra.peff.net> (raw)
In-Reply-To: <Y/habYJxDRJQg/kJ@coredump.intra.peff.net>

Our graph-traversal functions take callbacks for showing commits and
objects, but not all callbacks need each parameter.  Likewise for the
similar traverse_bitmap_commit_list(), which has a different interface
but serves the same purpose. And the include_check mechanism, which
passes along a void pointer which is not always used.

Mark the unused ones to to make -Wunused-parameter happy.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/pack-objects.c | 11 ++++++-----
 builtin/rev-list.c     | 10 +++++-----
 pack-bitmap.c          |  6 ++++--
 reachable.c            | 12 +++++++-----
 4 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 74a167a180..fb92a9686b 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1590,7 +1590,7 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
 
 static int add_object_entry_from_bitmap(const struct object_id *oid,
 					enum object_type type,
-					int flags, uint32_t name_hash,
+					int flags UNUSED, uint32_t name_hash,
 					struct packed_git *pack, off_t offset)
 {
 	display_progress(progress_state, ++nr_seen);
@@ -3464,7 +3464,7 @@ static void add_cruft_object_entry(const struct object_id *oid, enum object_type
 	return;
 }
 
-static void show_cruft_object(struct object *obj, const char *name, void *data)
+static void show_cruft_object(struct object *obj, const char *name, void *data UNUSED)
 {
 	/*
 	 * if we did not record it earlier, it's at least as old as our
@@ -3484,7 +3484,7 @@ static void show_cruft_commit(struct commit *commit, void *data)
 	show_cruft_object((struct object*)commit, NULL, data);
 }
 
-static int cruft_include_check_obj(struct object *obj, void *data)
+static int cruft_include_check_obj(struct object *obj, void *data UNUSED)
 {
 	return !has_object_kept_pack(&obj->oid, IN_CORE_KEEP_PACKS);
 }
@@ -3663,7 +3663,7 @@ static void read_object_list_from_stdin(void)
 	}
 }
 
-static void show_commit(struct commit *commit, void *data)
+static void show_commit(struct commit *commit, void *data UNUSED)
 {
 	add_object_entry(&commit->object.oid, OBJ_COMMIT, NULL, 0);
 
@@ -3674,7 +3674,8 @@ static void show_commit(struct commit *commit, void *data)
 		propagate_island_marks(commit);
 }
 
-static void show_object(struct object *obj, const char *name, void *data)
+static void show_object(struct object *obj, const char *name,
+			void *data UNUSED)
 {
 	add_preferred_base_object(name);
 	add_object_entry(&obj->oid, obj->type, name, 0);
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index d42db0b0cc..cceb5de975 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -362,11 +362,11 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
 
 static int show_object_fast(
 	const struct object_id *oid,
-	enum object_type type,
-	int exclude,
-	uint32_t name_hash,
-	struct packed_git *found_pack,
-	off_t found_offset)
+	enum object_type type UNUSED,
+	int exclude UNUSED,
+	uint32_t name_hash UNUSED,
+	struct packed_git *found_pack UNUSED,
+	off_t found_offset UNUSED)
 {
 	fprintf(stdout, "%s\n", oid_to_hex(oid));
 	return 1;
diff --git a/pack-bitmap.c b/pack-bitmap.c
index d2a42abf28..c8994a0f00 100644
--- a/pack-bitmap.c
+++ b/pack-bitmap.c
@@ -951,7 +951,8 @@ static void show_object(struct object *object, const char *name, void *data_)
 	bitmap_set(data->base, bitmap_pos);
 }
 
-static void show_commit(struct commit *commit, void *data)
+static void show_commit(struct commit *commit UNUSED,
+			void *data UNUSED)
 {
 }
 
@@ -1940,7 +1941,8 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,
 		    type_name(bitmap_type));
 }
 
-static void test_show_object(struct object *object, const char *name,
+static void test_show_object(struct object *object,
+			     const char *name UNUSED,
 			     void *data)
 {
 	struct bitmap_test_data *tdata = data;
diff --git a/reachable.c b/reachable.c
index aba63ebeb3..08f290c2be 100644
--- a/reachable.c
+++ b/reachable.c
@@ -48,7 +48,9 @@ static int add_one_ref(const char *path, const struct object_id *oid,
  * The traversal will have already marked us as SEEN, so we
  * only need to handle any progress reporting here.
  */
-static void mark_object(struct object *obj, const char *name, void *data)
+static void mark_object(struct object *obj UNUSED,
+			const char *name UNUSED,
+			void *data)
 {
 	update_progress(data);
 }
@@ -202,10 +204,10 @@ int add_unseen_recent_objects_to_traversal(struct rev_info *revs,
 
 static int mark_object_seen(const struct object_id *oid,
 			     enum object_type type,
-			     int exclude,
-			     uint32_t name_hash,
-			     struct packed_git *found_pack,
-			     off_t found_offset)
+			     int exclude UNUSED,
+			     uint32_t name_hash UNUSED,
+			     struct packed_git *found_pack UNUSED,
+			     off_t found_offset UNUSED)
 {
 	struct object *obj = lookup_object_by_type(the_repository, oid, type);
 	if (!obj)
-- 
2.39.2.981.g6157336f25


  parent reply	other threads:[~2023-02-24  6:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24  6:34 [PATCH 0/21] more -Wunused-parameter fixes Jeff King
2023-02-24  6:34 ` [PATCH 01/21] ref-filter: drop unused atom parameter from get_worktree_path() Jeff King
2023-02-24 17:53   ` Junio C Hamano
2023-02-24  6:37 ` [PATCH 02/21] ls-refs: drop config caching Jeff King
2023-02-24  6:38 ` [PATCH 03/21] serve: use repository pointer to get config Jeff King
2023-02-24 17:59   ` Junio C Hamano
2023-02-24  6:38 ` [PATCH 04/21] serve: mark unused parameters in virtual functions Jeff King
2023-02-24  6:38 ` [PATCH 05/21] object-name: mark unused parameters in disambiguate callbacks Jeff King
2023-02-24  6:38 ` [PATCH 06/21] http-backend: mark argc/argv unused Jeff King
2023-02-24  6:38 ` [PATCH 07/21] http-backend: mark unused parameters in virtual functions Jeff King
2023-02-24  6:39 ` [PATCH 08/21] ref-filter: mark unused callback parameters Jeff King
2023-02-24  6:39 ` [PATCH 09/21] mark "pointless" data pointers in callbacks Jeff King
2023-02-24  6:39 ` [PATCH 10/21] run-command: mark error routine parameters as unused Jeff King
2023-02-24  6:39 ` [PATCH 11/21] mark unused parameters in signal handlers Jeff King
2023-02-24  6:39 ` Jeff King [this message]
2023-02-24  6:39 ` [PATCH 13/21] for_each_object: mark unused callback parameters Jeff King
2023-02-24  6:39 ` [PATCH 14/21] prio-queue: mark unused parameters in comparison functions Jeff King
2023-02-24  6:39 ` [PATCH 15/21] notes: mark unused callback parameters Jeff King
2023-02-24  6:39 ` [PATCH 16/21] fetch-pack: mark unused parameter in callback function Jeff King
2023-02-24  6:39 ` [PATCH 17/21] rewrite_parents(): mark unused callback parameter Jeff King
2023-02-24  6:39 ` [PATCH 18/21] for_each_commit_graft(): " Jeff King
2023-02-24  6:39 ` [PATCH 19/21] userformat_want_item(): mark unused parameter Jeff King
2023-02-24  6:39 ` [PATCH 20/21] run_processes_parallel: mark unused callback parameters Jeff King
2023-02-24  6:39 ` [PATCH 21/21] help: mark unused parameter in git_unknown_cmd_config() 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y/hbmh2jpj4OgWUN@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).