{"thread":{"id":"59946","subject":"[PATCH 0/14] more -Wunused-parameter annotations","startedAt":"2023-07-03T06:43:51Z","lastAt":"2023-07-03T06:44:51Z","messageCount":15,"participants":["Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":14},"messages":[{"id":"479121","messageId":"20230703064347.GA3524892@coredump.intra.peff.net","threadId":"59946","inReplyTo":null,"subject":"[PATCH 0/14] more -Wunused-parameter annotations","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:43:47Z","receivedAt":"2023-07-03T06:43:51Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Here's another set of patches to silence -Wunused-parameter warnings.\nWith the exception of the first patch, these are all just adding\nannotations (though I tried to document in each one any digging I did on\n\"this isn't a bug that we're not using it, right?\").\n\nSo I don't think these should be controversial. But I wanted to mention\nthat I'll be offline for a month starting July 5th. So if there is any\nsubstantive review after that, I'll be rather slow to respond. :)\n\n  [01/14]: test-ref-store: drop unimplemented reflog-expire command\n  [02/14]: do_for_each_ref_helper(): mark unused repository parameter\n  [03/14]: http: mark unused parameters in curl callbacks\n  [04/14]: http-push: mark unused parameter in xml callback\n  [05/14]: am: mark unused keep_cr parameters\n  [06/14]: count-objects: mark unused parameter in alternates callback\n  [07/14]: revisions: drop unused \"opt\" parameter in \"tweak\" callbacks\n  [08/14]: fsck: mark unused parameters in various fsck callbacks\n  [09/14]: merge-tree: mark unused parameter in traverse callback\n  [10/14]: replace: mark unused parameter in ref callback\n  [11/14]: replace: mark unused parameter in each_mergetag_fn callback\n  [12/14]: rev-parse: mark unused parameter in for_each_abbrev callback\n  [13/14]: tag: mark unused parameters in each_tag_name_fn callbacks\n  [14/14]: t/helper: mark unused callback void data parameters\n\n builtin/am.c                     |  4 ++--\n builtin/count-objects.c          |  2 +-\n builtin/diff-tree.c              |  2 +-\n builtin/fsck.c                   | 10 +++++-----\n builtin/index-pack.c             |  3 ++-\n builtin/log.c                    |  6 ++----\n builtin/merge-tree.c             |  4 +++-\n builtin/mktag.c                  |  8 ++++----\n builtin/replace.c                |  4 ++--\n builtin/rev-parse.c              |  2 +-\n builtin/tag.c                    |  4 ++--\n builtin/unpack-objects.c         |  3 ++-\n fsck.c                           |  4 ++--\n http-push.c                      |  2 +-\n http.c                           |  9 ++++++---\n object-file.c                    | 10 +++++-----\n refs.c                           |  2 +-\n revision.c                       |  2 +-\n revision.h                       |  2 +-\n t/helper/test-dump-split-index.c |  2 +-\n t/helper/test-oid-array.c        |  2 +-\n t/helper/test-ref-store.c        |  6 ------\n 22 files changed, 46 insertions(+), 47 deletions(-)\n\n-Peff\n"},{"id":"479122","messageId":"20230703064358.GA3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 01/14] test-ref-store: drop unimplemented reflog-expire command","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:43:58Z","receivedAt":"2023-07-03T06:44:02Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The reflog-expire command has been unimplemented since it was added in\n80f2a6097c (t/helper: add test-ref-store to test ref-store functions,\n2017-03-26). This causes -Wunused-parameter to complain, since the\nfunction just calls die() without looking at its arguments.\n\nWe could mark these as UNUSED to silence the warning. But let's just\ndrop the function. It has no callers in the test suite and is not doing\nanything useful, beyond perhaps reminding us that it's something we\n_could_ be testing.\n\nBut since the bulk of the work in adding such tests would be the shell\nbits that actually examine the reflog state before and after expiration,\nthis is not even a useful step in that direction. Somebody who wants to\ndo that work later can easily add this function back.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/helper/test-ref-store.c | 6 ------\n 1 file changed, 6 deletions(-)\n\ndiff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c\nindex fb18831ec2..aa900cbfab 100644\n--- a/t/helper/test-ref-store.c\n+++ b/t/helper/test-ref-store.c\n@@ -268,11 +268,6 @@ static int cmd_delete_reflog(struct ref_store *refs, const char **argv)\n \treturn refs_delete_reflog(refs, refname);\n }\n \n-static int cmd_reflog_expire(struct ref_store *refs, const char **argv)\n-{\n-\tdie(\"not supported yet\");\n-}\n-\n static int cmd_delete_ref(struct ref_store *refs, const char **argv)\n {\n \tconst char *msg = notnull(*argv++, \"msg\");\n@@ -326,7 +321,6 @@ static struct command commands[] = {\n \t{ \"reflog-exists\", cmd_reflog_exists },\n \t{ \"create-reflog\", cmd_create_reflog },\n \t{ \"delete-reflog\", cmd_delete_reflog },\n-\t{ \"reflog-expire\", cmd_reflog_expire },\n \t/*\n \t * backend transaction functions can't be tested separately\n \t */\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479123","messageId":"20230703064402.GB3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 02/14] do_for_each_ref_helper(): mark unused repository parameter","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:02Z","receivedAt":"2023-07-03T06:44:07Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This function gets a repository parameter because it's a callback for\ndo_for_each_repo_ref_iterator(). But it's just a wrapper that passes\nalong each call to a regular each_ref_fn callback, and the latter\ndoesn't accept a repository argument.\n\nProbably in the long run all of the each_ref_fn callbacks should get a\nrepository parameter, too. But changing that now would require updates\nall over the code base. Until that happens, let's annotate this wrapper\ncallback to quiet the compiler's -Wunused-parameter warning.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n refs.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/refs.c b/refs.c\nindex c029f64982..edeae90ebb 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -1588,7 +1588,7 @@ struct do_for_each_ref_help {\n \tvoid *cb_data;\n };\n \n-static int do_for_each_ref_helper(struct repository *r,\n+static int do_for_each_ref_helper(struct repository *r UNUSED,\n \t\t\t\t  const char *refname,\n \t\t\t\t  const struct object_id *oid,\n \t\t\t\t  int flags,\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479124","messageId":"20230703064405.GC3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 03/14] http: mark unused parameters in curl callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:05Z","receivedAt":"2023-07-03T06:44:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"These functions are all used as callbacks for curl, so they have to\nconform to a particular interface. But they don't need all of their\nparameters:\n\n  - fwrite_null() throws away the input, so it doesn't look at most\n    parameters\n\n  - fwrite_wwwauth() in theory could take the auth struct in its void\n    pointer, but instead we just access it as the global http_auth\n    (matching the rest of the code in this file)\n\n  - curl_trace() always writes via the trace mechanism, so it doesn't\n    need its void pointer to know where to send things. Likewise, it\n    ignores the CURL parameter, since nothing we trace requires querying\n    the handle.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n http.c | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/http.c b/http.c\nindex 5772c8ced3..5b8e9c8c48 100644\n--- a/http.c\n+++ b/http.c\n@@ -196,7 +196,7 @@ static inline int is_hdr_continuation(const char *ptr, const size_t size)\n \treturn size && (*ptr == ' ' || *ptr == '\\t');\n }\n \n-static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p)\n+static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p UNUSED)\n {\n \tsize_t size = eltsize * nmemb;\n \tstruct strvec *values = &http_auth.wwwauth_headers;\n@@ -295,7 +295,8 @@ static size_t fwrite_wwwauth(char *ptr, size_t eltsize, size_t nmemb, void *p)\n \treturn size;\n }\n \n-size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf)\n+size_t fwrite_null(char *ptr UNUSED, size_t eltsize UNUSED, size_t nmemb,\n+\t\t   void *data UNUSED)\n {\n \treturn nmemb;\n }\n@@ -820,7 +821,9 @@ static void curl_dump_info(char *data, size_t size)\n \tstrbuf_release(&buf);\n }\n \n-static int curl_trace(CURL *handle, curl_infotype type, char *data, size_t size, void *userp)\n+static int curl_trace(CURL *handle UNUSED, curl_infotype type,\n+\t\t      char *data, size_t size,\n+\t\t      void *userp UNUSED)\n {\n \tconst char *text;\n \tenum { NO_FILTER = 0, DO_FILTER = 1 };\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479125","messageId":"20230703064408.GD3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 04/14] http-push: mark unused parameter in xml callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:08Z","receivedAt":"2023-07-03T06:44:13Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The xml_start_tag() function is passed the expat library's\nXML_SetElementHandler() function, so it has to conform to the\nexpected interface. But we don't actually care about the attributes\nlist. Mark it so that -Wunused-parameter does not complain.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n http-push.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex 9ab2383d2b..a704f490fd 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -783,7 +783,7 @@ static void handle_new_lock_ctx(struct xml_ctx *ctx, int tag_closed)\n static void one_remote_ref(const char *refname);\n \n static void\n-xml_start_tag(void *userData, const char *name, const char **atts)\n+xml_start_tag(void *userData, const char *name, const char **atts UNUSED)\n {\n \tstruct xml_ctx *ctx = (struct xml_ctx *)userData;\n \tconst char *c = strchr(name, ':');\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479126","messageId":"20230703064411.GE3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 05/14] am: mark unused keep_cr parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:11Z","receivedAt":"2023-07-03T06:44:19Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"When parsing the input, we have a \"keep_cr\" parameter to tell us how to\nhandle line endings. But this doesn't apply to stgit or hg patches\n(which are not mailbox formats where we have to worry about that), so we\nignore the parameter entirely in those functions.\n\nLet's mark these as unused so that -Wunused-parameter does not complain\nabout them.\n\nNote that we could just drop these parameters entirely. They are\nnecessary to conform to the mail_conv_fn interface used by\nsplit_mail_conv(), but these two callbacks are the only ones used with\nthat function. The other formats (which _do_ care about keep_cr) use\nsplit_mail_mbox(). But it's conceivable that we'd eventually add another\nformat that does care about this option, so let's leave it as part of\nthe generic interface.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/am.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/am.c b/builtin/am.c\nindex a78daa6971..8451f5e423 100644\n--- a/builtin/am.c\n+++ b/builtin/am.c\n@@ -787,7 +787,7 @@ static int split_mail_conv(mail_conv_fn fn, struct am_state *state,\n  * A split_mail_conv() callback that converts an StGit patch to an RFC2822\n  * message suitable for parsing with git-mailinfo.\n  */\n-static int stgit_patch_to_mail(FILE *out, FILE *in, int keep_cr)\n+static int stgit_patch_to_mail(FILE *out, FILE *in, int keep_cr UNUSED)\n {\n \tstruct strbuf sb = STRBUF_INIT;\n \tint subject_printed = 0;\n@@ -870,7 +870,7 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths,\n  * A split_patches_conv() callback that converts a mercurial patch to a RFC2822\n  * message suitable for parsing with git-mailinfo.\n  */\n-static int hg_patch_to_mail(FILE *out, FILE *in, int keep_cr)\n+static int hg_patch_to_mail(FILE *out, FILE *in, int keep_cr UNUSED)\n {\n \tstruct strbuf sb = STRBUF_INIT;\n \tint rc = 0;\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479127","messageId":"20230703064413.GF3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 06/14] count-objects: mark unused parameter in alternates callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:13Z","receivedAt":"2023-07-03T06:44:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Callbacks to for_each_altodb() get a void data pointer, but we don't\nneed it here. Mark it as unused to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/count-objects.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex 97cdfb0ac5..2d4bb5e8d0 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -82,7 +82,7 @@ static int count_cruft(const char *basename UNUSED, const char *path,\n \treturn 0;\n }\n \n-static int print_alternate(struct object_directory *odb, void *data)\n+static int print_alternate(struct object_directory *odb, void *data UNUSED)\n {\n \tprintf(\"alternate: \");\n \tquote_c_style(odb->path, NULL, stdout, 0);\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479128","messageId":"20230703064416.GG3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 07/14] revisions: drop unused \"opt\" parameter in \"tweak\" callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:16Z","receivedAt":"2023-07-03T06:44:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The setup_revision_opt struct has a \"tweak\" function pointer, which can\nbe used to adjust parameters after setup_revisions() parses arguments,\nbut before it finalizes setup. In addition to the rev_info struct, the\ncallback receives a pointer to the setup_revision_opt, as well.\n\nBut none of the existing callbacks looks at the extra \"opt\" parameter,\nleading to -Wunused-parameter warnings.\n\nWe could mark it as UNUSED, but instead let's remove it entirely. It's\nconceivable that it could be useful for a callback to have access to the\n\"opt\" struct. But in the 13 years that this mechanism has existed,\nnobody has used it. So let's just drop it in the name of simplifying.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/diff-tree.c | 2 +-\n builtin/log.c       | 6 ++----\n revision.c          | 2 +-\n revision.h          | 2 +-\n 4 files changed, 5 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/diff-tree.c b/builtin/diff-tree.c\nindex d62caa6c8b..c9ba35f143 100644\n--- a/builtin/diff-tree.c\n+++ b/builtin/diff-tree.c\n@@ -99,7 +99,7 @@ static const char diff_tree_usage[] =\n \"  --root        include the initial commit as diff against /dev/null\\n\"\n COMMON_DIFF_OPTIONS_HELP;\n \n-static void diff_tree_tweak_rev(struct rev_info *rev, struct setup_revision_opt *opt)\n+static void diff_tree_tweak_rev(struct rev_info *rev)\n {\n \tif (!rev->diffopt.output_format) {\n \t\tif (rev->dense_combined_merges)\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 89442dceda..91bc7d967e 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -718,8 +718,7 @@ static int show_tree_object(const struct object_id *oid UNUSED,\n \treturn 0;\n }\n \n-static void show_setup_revisions_tweak(struct rev_info *rev,\n-\t\t\t\t       struct setup_revision_opt *opt)\n+static void show_setup_revisions_tweak(struct rev_info *rev)\n {\n \tif (rev->first_parent_only)\n \t\tdiff_merges_default_to_first_parent(rev);\n@@ -862,8 +861,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)\n \treturn cmd_log_deinit(cmd_log_walk(&rev), &rev);\n }\n \n-static void log_setup_revisions_tweak(struct rev_info *rev,\n-\t\t\t\t      struct setup_revision_opt *opt)\n+static void log_setup_revisions_tweak(struct rev_info *rev)\n {\n \tif (rev->diffopt.flags.default_follow_renames &&\n \t    diff_check_follow_pathspec(&rev->prune_data, 0))\ndiff --git a/revision.c b/revision.c\nindex 84768565ce..73f8c7e2e0 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -2955,7 +2955,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s\n \tif (!revs->def)\n \t\trevs->def = opt ? opt->def : NULL;\n \tif (opt && opt->tweak)\n-\t\topt->tweak(revs, opt);\n+\t\topt->tweak(revs);\n \tif (revs->show_merge)\n \t\tprepare_show_merge(revs);\n \tif (revs->def && !revs->pending.nr && !revs->rev_input_given) {\ndiff --git a/revision.h b/revision.h\nindex 25776af381..18f49565c2 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -428,7 +428,7 @@ void repo_init_revisions(struct repository *r,\n  */\n struct setup_revision_opt {\n \tconst char *def;\n-\tvoid (*tweak)(struct rev_info *, struct setup_revision_opt *);\n+\tvoid (*tweak)(struct rev_info *);\n \tunsigned int\tassume_dashdash:1,\n \t\t\tallow_exclude_promisor_objects:1,\n \t\t\tfree_removed_argv_elements:1;\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479129","messageId":"20230703064418.GH3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 08/14] fsck: mark unused parameters in various fsck callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:18Z","receivedAt":"2023-07-03T06:44:30Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"There are a few callback functions which are used with the fsck code,\nbut it's natural that not all callbacks need all parameters. For\nreporting, even something as obvious as \"the oid of the object which had\na problem\" is not always used, as some callers are only checking a\nsingle object in the first place. And for both reporting and walking,\nthings like void data pointers and the fsck_options aren't always\nnecessary.\n\nBut since each such parameter is used by _some_ callback, we have to\nkeep them in the interface. Mark the unused ones in specific callbacks\nto avoid triggering -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/fsck.c           | 10 +++++-----\n builtin/index-pack.c     |  3 ++-\n builtin/mktag.c          |  8 ++++----\n builtin/unpack-objects.c |  3 ++-\n fsck.c                   |  4 ++--\n object-file.c            | 10 +++++-----\n 6 files changed, 20 insertions(+), 18 deletions(-)\n\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex fa26462337..9af71a4e03 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -92,11 +92,11 @@ static int objerror(struct object *obj, const char *err)\n \treturn -1;\n }\n \n-static int fsck_error_func(struct fsck_options *o,\n+static int fsck_error_func(struct fsck_options *o UNUSED,\n \t\t\t   const struct object_id *oid,\n \t\t\t   enum object_type object_type,\n \t\t\t   enum fsck_msg_type msg_type,\n-\t\t\t   enum fsck_msg_id msg_id,\n+\t\t\t   enum fsck_msg_id msg_id UNUSED,\n \t\t\t   const char *message)\n {\n \tswitch (msg_type) {\n@@ -121,7 +121,7 @@ static int fsck_error_func(struct fsck_options *o,\n static struct object_array pending;\n \n static int mark_object(struct object *obj, enum object_type type,\n-\t\t       void *data, struct fsck_options *options)\n+\t\t       void *data, struct fsck_options *options UNUSED)\n {\n \tstruct object *parent = data;\n \n@@ -206,8 +206,8 @@ static int traverse_reachable(void)\n \treturn !!result;\n }\n \n-static int mark_used(struct object *obj, enum object_type object_type,\n-\t\t     void *data, struct fsck_options *options)\n+static int mark_used(struct object *obj, int type UNUSED,\n+\t\t     void *data UNUSED, struct fsck_options *options UNUSED)\n {\n \tif (!obj)\n \t\treturn 1;\ndiff --git a/builtin/index-pack.c b/builtin/index-pack.c\nindex c1250b070f..f6c2f0909d 100644\n--- a/builtin/index-pack.c\n+++ b/builtin/index-pack.c\n@@ -223,7 +223,8 @@ static void cleanup_thread(void)\n }\n \n static int mark_link(struct object *obj, enum object_type type,\n-\t\t     void *data, struct fsck_options *options)\n+\t\t     void *data UNUSED,\n+\t\t     struct fsck_options *options UNUSED)\n {\n \tif (!obj)\n \t\treturn -1;\ndiff --git a/builtin/mktag.c b/builtin/mktag.c\nindex 43e2766db4..d8e0b5afc0 100644\n--- a/builtin/mktag.c\n+++ b/builtin/mktag.c\n@@ -18,11 +18,11 @@ static int option_strict = 1;\n \n static struct fsck_options fsck_options = FSCK_OPTIONS_STRICT;\n \n-static int mktag_fsck_error_func(struct fsck_options *o,\n-\t\t\t\t const struct object_id *oid,\n-\t\t\t\t enum object_type object_type,\n+static int mktag_fsck_error_func(struct fsck_options *o UNUSED,\n+\t\t\t\t const struct object_id *oid UNUSED,\n+\t\t\t\t enum object_type object_type UNUSED,\n \t\t\t\t enum fsck_msg_type msg_type,\n-\t\t\t\t enum fsck_msg_id msg_id,\n+\t\t\t\t enum fsck_msg_id msg_id UNUSED,\n \t\t\t\t const char *message)\n {\n \tswitch (msg_type) {\ndiff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c\nindex 1979532a9d..558b8485ba 100644\n--- a/builtin/unpack-objects.c\n+++ b/builtin/unpack-objects.c\n@@ -214,7 +214,8 @@ static void write_cached_object(struct object *obj, struct obj_buffer *obj_buf)\n  * Verify its reachability and validity recursively and write it out.\n  */\n static int check_object(struct object *obj, enum object_type type,\n-\t\t\tvoid *data, struct fsck_options *options)\n+\t\t\tvoid *data UNUSED,\n+\t\t\tstruct fsck_options *options UNUSED)\n {\n \tstruct obj_buffer *obj_buf;\n \ndiff --git a/fsck.c b/fsck.c\nindex a219d6f2c0..feba5239a4 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -1307,9 +1307,9 @@ int fsck_buffer(const struct object_id *oid, enum object_type type,\n \n int fsck_error_function(struct fsck_options *o,\n \t\t\tconst struct object_id *oid,\n-\t\t\tenum object_type object_type,\n+\t\t\tenum object_type object_type UNUSED,\n \t\t\tenum fsck_msg_type msg_type,\n-\t\t\tenum fsck_msg_id msg_id,\n+\t\t\tenum fsck_msg_id msg_id UNUSED,\n \t\t\tconst char *message)\n {\n \tif (msg_type == FSCK_WARN) {\ndiff --git a/object-file.c b/object-file.c\nindex 8d87720dd5..68a2397e33 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -2308,11 +2308,11 @@ int repo_has_object_file(struct repository *r,\n  * report the minimal fsck error here, and rely on the caller to\n  * give more context.\n  */\n-static int hash_format_check_report(struct fsck_options *opts,\n-\t\t\t\t     const struct object_id *oid,\n-\t\t\t\t     enum object_type object_type,\n-\t\t\t\t     enum fsck_msg_type msg_type,\n-\t\t\t\t     enum fsck_msg_id msg_id,\n+static int hash_format_check_report(struct fsck_options *opts UNUSED,\n+\t\t\t\t     const struct object_id *oid UNUSED,\n+\t\t\t\t     enum object_type object_type UNUSED,\n+\t\t\t\t     enum fsck_msg_type msg_type UNUSED,\n+\t\t\t\t     enum fsck_msg_id msg_id UNUSED,\n \t\t\t\t     const char *message)\n {\n \terror(_(\"object fails fsck: %s\"), message);\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479130","messageId":"20230703064421.GI3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 09/14] merge-tree: mark unused parameter in traverse callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:21Z","receivedAt":"2023-07-03T06:44:34Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Our threeway_callback() does not bother to look at its \"n\" parameter. It\nis static in this file and used only by trivial_merge_trees(), which\nalways passes 3 trees (hence the name \"threeway\"). It also does not look\nat \"dirmask\". This is OK, as it handles directories specifically by\nlooking at the mode bits.\n\nOther traverse_info callbacks need these, so we can't get drop them from\nthe interface. But let's annotate these ones to avoid complaints from\n-Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/merge-tree.c | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/merge-tree.c b/builtin/merge-tree.c\nindex 6f7db436d2..0de42aecf4 100644\n--- a/builtin/merge-tree.c\n+++ b/builtin/merge-tree.c\n@@ -324,7 +324,9 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])\n  * The successful merge rules are the same as for the three-way merge\n  * in git-read-tree.\n  */\n-static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *info)\n+static int threeway_callback(int n UNUSED, unsigned long mask,\n+\t\t\t     unsigned long dirmask UNUSED,\n+\t\t\t     struct name_entry *entry, struct traverse_info *info)\n {\n \t/* Same in both? */\n \tif (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) {\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479131","messageId":"20230703064425.GJ3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 10/14] replace: mark unused parameter in ref callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:25Z","receivedAt":"2023-07-03T06:44:42Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We don't look at the \"flags\" parameter, which is natural for something\nthat is just printing the contents of the replace refs. But let's mark\nit to appease -Wunused-parameter.\n\nThis probably should have been part of 63e14ee2d6 (refs: mark unused\neach_ref_fn parameters, 2022-08-19), but I missed it as this one is a\nrepo_each_ref_fn, which takes an extra repository argument.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/replace.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 9ceaa25233..17b75229d2 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -49,7 +49,7 @@ struct show_data {\n \n static int show_reference(struct repository *r, const char *refname,\n \t\t\t  const struct object_id *oid,\n-\t\t\t  int flag, void *cb_data)\n+\t\t\t  int flag UNUSED, void *cb_data)\n {\n \tstruct show_data *data = cb_data;\n \n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479132","messageId":"20230703064428.GK3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 11/14] replace: mark unused parameter in each_mergetag_fn callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:28Z","receivedAt":"2023-07-03T06:44:43Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We don't look at the \"commit\" parameter to our callback, as our\n\"mergetag_data\" pointer contains the original name \"ref\", which we use\ninstead. But we can't get rid of it, since other for_each_mergetag\ncallbacks do use it. Let's mark the parameter to avoid\n-Wunused-parameter warnings.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/replace.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/replace.c b/builtin/replace.c\nindex 17b75229d2..da59600ad2 100644\n--- a/builtin/replace.c\n+++ b/builtin/replace.c\n@@ -409,7 +409,7 @@ struct check_mergetag_data {\n \tconst char **argv;\n };\n \n-static int check_one_mergetag(struct commit *commit,\n+static int check_one_mergetag(struct commit *commit UNUSED,\n \t\t\t       struct commit_extra_header *extra,\n \t\t\t       void *data)\n {\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479133","messageId":"20230703064431.GL3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 12/14] rev-parse: mark unused parameter in for_each_abbrev callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:31Z","receivedAt":"2023-07-03T06:44:43Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We don't need to use the \"data\" parameter in this instance. Let's mark\nit to avoid -Wunused-parameter warnings.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/rev-parse.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 3e2ee44177..075e2c5aa4 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -226,7 +226,7 @@ static int anti_reference(const char *refname, const struct object_id *oid,\n \treturn 0;\n }\n \n-static int show_abbrev(const struct object_id *oid, void *cb_data)\n+static int show_abbrev(const struct object_id *oid, void *cb_data UNUSED)\n {\n \tshow_rev(NORMAL, oid, NULL);\n \treturn 0;\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479134","messageId":"20230703064433.GM3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 13/14] tag: mark unused parameters in each_tag_name_fn callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:33Z","receivedAt":"2023-07-03T06:44:45Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We iterate over the set of input tag names using callbacks. But not all\noperations need the same inputs, so some parameters go unused (but of\ncourse not the same ones for each operation). Mark the unused ones to\navoid -Wunused-parameter warnings.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/tag.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/tag.c b/builtin/tag.c\nindex e63bee8eab..81ca3fa19a 100644\n--- a/builtin/tag.c\n+++ b/builtin/tag.c\n@@ -121,7 +121,7 @@ static int for_each_tag_name(const char **argv, each_tag_name_fn fn,\n \treturn had_error;\n }\n \n-static int collect_tags(const char *name, const char *ref,\n+static int collect_tags(const char *name UNUSED, const char *ref,\n \t\t\tconst struct object_id *oid, void *cb_data)\n {\n \tstruct string_list *ref_list = cb_data;\n@@ -155,7 +155,7 @@ static int delete_tags(const char **argv)\n \treturn result;\n }\n \n-static int verify_tag(const char *name, const char *ref,\n+static int verify_tag(const char *name, const char *ref UNUSED,\n \t\t      const struct object_id *oid, void *cb_data)\n {\n \tint flags;\n-- \n2.41.0.586.g3c0cc15bc7\n\n"},{"id":"479135","messageId":"20230703064436.GN3537614@coredump.intra.peff.net","threadId":"59946","inReplyTo":"20230703064347.GA3524892@coredump.intra.peff.net","subject":"[PATCH 14/14] t/helper: mark unused callback void data parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-07-03T06:44:36Z","receivedAt":"2023-07-03T06:44:51Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Many callback interfaces have an extra void data parameter, but we don't\nalways need it (especially for dumping functions like the ones in test\nhelpers). Mark them as unused to avoid -Wunused-parameter warnings.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/helper/test-dump-split-index.c | 2 +-\n t/helper/test-oid-array.c        | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c\nindex 5cf0b26dca..f29d18ef94 100644\n--- a/t/helper/test-dump-split-index.c\n+++ b/t/helper/test-dump-split-index.c\n@@ -7,7 +7,7 @@\n #include \"split-index.h\"\n #include \"ewah/ewok.h\"\n \n-static void show_bit(size_t pos, void *data)\n+static void show_bit(size_t pos, void *data UNUSED)\n {\n \tprintf(\" %d\", (int)pos);\n }\ndiff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c\nindex eef68833b7..aafe398ef0 100644\n--- a/t/helper/test-oid-array.c\n+++ b/t/helper/test-oid-array.c\n@@ -4,7 +4,7 @@\n #include \"setup.h\"\n #include \"strbuf.h\"\n \n-static int print_oid(const struct object_id *oid, void *data)\n+static int print_oid(const struct object_id *oid, void *data UNUSED)\n {\n \tputs(oid_to_hex(oid));\n \treturn 0;\n-- \n2.41.0.586.g3c0cc15bc7\n"}]}