{"thread":{"id":"60161","subject":"[PATCH 0/22] YAUPS: Yet Another Unused Parameter Series","startedAt":"2023-08-28T21:46:42Z","lastAt":"2023-08-30T18:30:01Z","messageCount":59,"participants":["Jeff King","Junio C Hamano","Taylor Blau","Phillip Wood"],"isPatch":true,"patchVersion":1,"patchTotal":22},"messages":[{"id":"481063","messageId":"20230828214604.GA3830831@coredump.intra.peff.net","threadId":"60161","inReplyTo":null,"subject":"[PATCH 0/22] YAUPS: Yet Another Unused Parameter Series","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:46:04Z","receivedAt":"2023-08-28T21:46:42Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"I'm back with another exciting installment of -Wunused-parameter warning\nfixes. Most of these are pretty boring and obvious; the first two are\nthe most interesting in terms of rationale.\n\nI promise we're closing in on the finish line here. I only have about 20\npatches left after this, at which point we should be able to turn on the\nwarning by default for developer builds.\n\n  [01/22]: sequencer: use repository parameter in short_commit_name()\n  [02/22]: sequencer: mark repository argument as unused\n  [03/22]: ref-filter: mark unused parameters in parser callbacks\n  [04/22]: pack-bitmap: mark unused parameters in show_object callback\n  [05/22]: worktree: mark unused parameters in each_ref_fn callback\n  [06/22]: commit-graph: mark unused data parameters in generation callbacks\n  [07/22]: ls-tree: mark unused parameter in callback\n  [08/22]: stash: mark unused parameter in diff callback\n  [09/22]: trace2: mark unused us_elapsed_absolute parameters\n  [10/22]: trace2: mark unused config callback parameter\n  [11/22]: test-trace2: mark unused argv/argc parameters\n  [12/22]: grep: mark unused parameter in output function\n  [13/22]: add-interactive: mark unused callback parameters\n  [14/22]: negotiator/noop: mark unused callback parameters\n  [15/22]: worktree: mark unused parameters in noop repair callback\n  [16/22]: imap-send: mark unused parameters with NO_OPENSSL\n  [17/22]: grep: mark unused parmaeters in pcre fallbacks\n  [18/22]: credential: mark unused parameter in urlmatch callback\n  [19/22]: fetch: mark unused parameter in ref_transaction callback\n  [20/22]: bundle-uri: mark unused parameters in callbacks\n  [21/22]: gc: mark unused descriptors in scheduler callbacks\n  [22/22]: update-ref: mark unused parameter in parser callbacks\n\n add-interactive.c       |  8 ++++----\n builtin/fetch.c         |  2 +-\n builtin/gc.c            |  6 +++---\n builtin/ls-tree.c       |  3 ++-\n builtin/stash.c         |  2 +-\n builtin/update-ref.c    | 14 +++++++-------\n builtin/worktree.c      |  8 ++++----\n bundle-uri.c            |  6 +++---\n commit-graph.c          |  8 +++++---\n credential.c            |  4 ++--\n grep.c                  | 12 +++++++-----\n imap-send.c             | 10 ++++++++--\n negotiator/noop.c       | 12 +++++++-----\n pack-bitmap.c           |  5 +++--\n ref-filter.c            |  8 +++++---\n sequencer.c             | 27 ++++++++++++++-------------\n t/helper/test-trace2.c  |  6 +++---\n trace2/tr2_sysenv.c     |  3 ++-\n trace2/tr2_tgt_event.c  | 23 +++++++++++++----------\n trace2/tr2_tgt_normal.c | 20 ++++++++++++--------\n worktree.c              |  6 ++++--\n 21 files changed, 110 insertions(+), 83 deletions(-)\n\n-Peff\n"},{"id":"481064","messageId":"20230828214629.GA3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 01/22] sequencer: use repository parameter in short_commit_name()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:46:29Z","receivedAt":"2023-08-28T21:47:16Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Instead of just using the_repository, we can take a repository parameter\nfrom the caller. Most of them already have one, and doing so clears up a\nfew -Wunused-parameter warnings. There are still a few callers which use\nthe_repository, but this pushes us one small step forward to eventually\ngetting rid of those.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n sequencer.c | 25 +++++++++++++------------\n 1 file changed, 13 insertions(+), 12 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 48475d1cc6..82dc3e160e 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -433,10 +433,9 @@ struct commit_message {\n \tconst char *message;\n };\n \n-static const char *short_commit_name(struct commit *commit)\n+static const char *short_commit_name(struct repository *r, struct commit *commit)\n {\n-\treturn repo_find_unique_abbrev(the_repository, &commit->object.oid,\n-\t\t\t\t       DEFAULT_ABBREV);\n+\treturn repo_find_unique_abbrev(r, &commit->object.oid, DEFAULT_ABBREV);\n }\n \n static int get_message(struct commit *commit, struct commit_message *out)\n@@ -446,7 +445,7 @@ static int get_message(struct commit *commit, struct commit_message *out)\n \n \tout->message = repo_logmsg_reencode(the_repository, commit, NULL,\n \t\t\t\t\t    get_commit_output_encoding());\n-\tabbrev = short_commit_name(commit);\n+\tabbrev = short_commit_name(the_repository, commit);\n \n \tsubject_len = find_commit_subject(out->message, &subject);\n \n@@ -2383,7 +2382,7 @@ static int do_pick_commit(struct repository *r,\n \t\terror(command == TODO_REVERT\n \t\t      ? _(\"could not revert %s... %s\")\n \t\t      : _(\"could not apply %s... %s\"),\n-\t\t      short_commit_name(commit), msg.subject);\n+\t\t      short_commit_name(r, commit), msg.subject);\n \t\tprint_advice(r, res == 1, opts);\n \t\trepo_rerere(r, opts->allow_rerere_auto);\n \t\tgoto leave;\n@@ -3172,7 +3171,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n \t\titem->offset_in_buf = todo_list->buf.len;\n \t\tsubject_len = find_commit_subject(commit_buffer, &subject);\n \t\tstrbuf_addf(&todo_list->buf, \"%s %s %.*s\\n\", command_string,\n-\t\t\tshort_commit_name(commit), subject_len, subject);\n+\t\t\tshort_commit_name(opts->revs->repo, commit),\n+\t\t\tsubject_len, subject);\n \t\trepo_unuse_commit_buffer(the_repository, commit,\n \t\t\t\t\t commit_buffer);\n \t}\n@@ -3593,7 +3593,7 @@ static int error_with_patch(struct repository *r,\n \t} else if (exit_code) {\n \t\tif (commit)\n \t\t\tfprintf_ln(stderr, _(\"Could not apply %s... %.*s\"),\n-\t\t\t\t   short_commit_name(commit), subject_len, subject);\n+\t\t\t\t   short_commit_name(r, commit), subject_len, subject);\n \t\telse\n \t\t\t/*\n \t\t\t * We don't have the hash of the parent so\n@@ -4728,7 +4728,7 @@ static int pick_commits(struct repository *r,\n \t\t\t\t\t\tterm_clear_line();\n \t\t\t\t\tfprintf(stderr,\n \t\t\t\t\t\t_(\"Stopped at %s...  %.*s\\n\"),\n-\t\t\t\t\t\tshort_commit_name(commit),\n+\t\t\t\t\t\tshort_commit_name(r, commit),\n \t\t\t\t\t\titem->arg_len, arg);\n \t\t\t\t}\n \t\t\t\treturn error_with_patch(r, commit,\n@@ -5564,7 +5564,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,\n \t\tif (!is_empty && (commit->object.flags & PATCHSAME)) {\n \t\t\tif (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS)\n \t\t\t\twarning(_(\"skipped previously applied commit %s\"),\n-\t\t\t\t\tshort_commit_name(commit));\n+\t\t\t\t\tshort_commit_name(revs->repo, commit));\n \t\t\tskipped_commit = 1;\n \t\t\tcontinue;\n \t\t}\n@@ -5800,7 +5800,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,\n \t\tif (!is_empty && (commit->object.flags & PATCHSAME)) {\n \t\t\tif (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS)\n \t\t\t\twarning(_(\"skipped previously applied commit %s\"),\n-\t\t\t\t\tshort_commit_name(commit));\n+\t\t\t\t\tshort_commit_name(r, commit));\n \t\t\tskipped_commit = 1;\n \t\t\tcontinue;\n \t\t}\n@@ -5892,7 +5892,8 @@ static void todo_list_add_exec_commands(struct todo_list *todo_list,\n \ttodo_list->alloc = alloc;\n }\n \n-static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_list,\n+static void todo_list_to_strbuf(struct repository *r,\n+\t\t\t\tstruct todo_list *todo_list,\n \t\t\t\tstruct strbuf *buf, int num, unsigned flags)\n {\n \tstruct todo_item *item;\n@@ -5921,7 +5922,7 @@ static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_lis\n \t\t/* add commit id */\n \t\tif (item->commit) {\n \t\t\tconst char *oid = flags & TODO_LIST_SHORTEN_IDS ?\n-\t\t\t\t\t  short_commit_name(item->commit) :\n+\t\t\t\t\t  short_commit_name(r, item->commit) :\n \t\t\t\t\t  oid_to_hex(&item->commit->object.oid);\n \n \t\t\tif (item->command == TODO_FIXUP) {\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481065","messageId":"20230828214717.GB3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 02/22] sequencer: mark repository argument as unused","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:17Z","receivedAt":"2023-08-28T21:48:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"In sequencer_get_last_command(), we don't ever look at the repository\nparameter. It _should_ be used when calling into git_path_* functions,\nbut the one we use here is declared with the non-REPO variant of\nGIT_PATH_FUNC(), and so just uses the_repository internally.\n\nWe could change the path helper to use REPO_GIT_PATH_FUNC(), but doing\nso piecemeal is not great. There are 41 uses of GIT_PATH_FUNC() in\nsequencer.c, and inconsistently switching one makes the code more\nconfusing. Likewise, this one function is used in half a dozen other\nspots, all of which would need to start passing in a repository argument\n(with rippling effects up the call stack).\n\nSo let's punt on that for now and just silence any -Wunused-parameter\nwarning.\n\nNote that we could also drop this parameter entirely, as the function is\nalways called directly, and not as a callback that has to conform to\nsome external interface. But since we'd eventually want to use the\nrepository parameter, let's leave it in place to avoid disrupting the\ncallers twice.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n sequencer.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 82dc3e160e..41fd79d215 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2649,7 +2649,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,\n \treturn item->commit ? 0 : -1;\n }\n \n-int sequencer_get_last_command(struct repository *r, enum replay_action *action)\n+int sequencer_get_last_command(struct repository *r UNUSED, enum replay_action *action)\n {\n \tconst char *todo_file, *bol;\n \tstruct strbuf buf = STRBUF_INIT;\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481066","messageId":"20230828214731.GD3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 04/22] pack-bitmap: mark unused parameters in show_object callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:31Z","receivedAt":"2023-08-28T21:48:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is similar to the cases in c50dca2a18 (list-objects: mark unused\ncallback parameters, 2023-02-24), but was added after that commit.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n pack-bitmap.c | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex 6afc03d1e4..ca8319b87c 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -1101,8 +1101,9 @@ static void show_boundary_commit(struct commit *commit, void *_data)\n \t}\n }\n \n-static void show_boundary_object(struct object *object,\n-\t\t\t\t const char *name, void *data)\n+static void show_boundary_object(struct object *object UNUSED,\n+\t\t\t\t const char *name UNUSED,\n+\t\t\t\t void *data UNUSED)\n {\n \tBUG(\"should not be called\");\n }\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481070","messageId":"20230828214724.GC3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 03/22] ref-filter: mark unused parameters in parser callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:24Z","receivedAt":"2023-08-28T21:48:21Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"These are similar to the cases annotated in 5fe9e1ce2f (ref-filter: mark\nunused callback parameters, 2023-02-24), but were added after that\ncommit.\n\nNote that the ahead/behind callback ignores its \"atom\" parameter, which\nis a little unusual, since that struct usually stores the result. But in\nthis case, the data is stored centrally in ref_array->counts, since we\nwant to compute all ahead/behinds at once, not per ref.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n ref-filter.c | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 1bfaf20fbf..88b021dd1d 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -549,7 +549,8 @@ static int signature_atom_parser(struct ref_format *format UNUSED,\n \treturn 0;\n }\n \n-static int trailers_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int trailers_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t\tstruct used_atom *atom,\n \t\t\t\tconst char *arg, struct strbuf *err)\n {\n \tatom->u.contents.trailer_opts.no_divider = 1;\n@@ -819,7 +820,7 @@ static int if_atom_parser(struct ref_format *format UNUSED,\n \treturn 0;\n }\n \n-static int rest_atom_parser(struct ref_format *format,\n+static int rest_atom_parser(struct ref_format *format UNUSED,\n \t\t\t    struct used_atom *atom UNUSED,\n \t\t\t    const char *arg, struct strbuf *err)\n {\n@@ -828,7 +829,8 @@ static int rest_atom_parser(struct ref_format *format,\n \treturn 0;\n }\n \n-static int ahead_behind_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int ahead_behind_atom_parser(struct ref_format *format,\n+\t\t\t\t    struct used_atom *atom UNUSED,\n \t\t\t\t    const char *arg, struct strbuf *err)\n {\n \tstruct string_list_item *item;\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481067","messageId":"20230828214746.GH3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 08/22] stash: mark unused parameter in diff callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:46Z","receivedAt":"2023-08-28T21:48:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is similar to the cases in 61bdc7c5d8 (diff: mark unused parameters\nin callbacks, 2022-12-13), but I missed it when making that commit.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/stash.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex fe64cde9ce..c9365bea13 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -362,7 +362,7 @@ static int is_path_a_directory(const char *path)\n }\n \n static void add_diff_to_buf(struct diff_queue_struct *q,\n-\t\t\t    struct diff_options *options,\n+\t\t\t    struct diff_options *options UNUSED,\n \t\t\t    void *data)\n {\n \tint i;\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481068","messageId":"20230828214736.GE3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 05/22] worktree: mark unused parameters in each_ref_fn callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:36Z","receivedAt":"2023-08-28T21:48:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is similar to the cases in 63e14ee2d6 (refs: mark unused\neach_ref_fn parameters, 2022-08-19), but it was added after that commit.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/worktree.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 10db70b7ec..62b7e26f4b 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -628,10 +628,10 @@ static void print_preparing_worktree_line(int detach,\n  *\n  * Returns 0 on failure and non-zero on success.\n  */\n-static int first_valid_ref(const char *refname,\n-\t\t\t   const struct object_id *oid,\n-\t\t\t   int flags,\n-\t\t\t   void *cb_data)\n+static int first_valid_ref(const char *refname UNUSED,\n+\t\t\t   const struct object_id *oid UNUSED,\n+\t\t\t   int flags UNUSED,\n+\t\t\t   void *cb_data UNUSED)\n {\n \treturn 1;\n }\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481069","messageId":"20230828214739.GF3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 06/22] commit-graph: mark unused data parameters in generation callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:39Z","receivedAt":"2023-08-28T21:48:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The compute_generation_info code uses function pointers to abstract the\nget/set generation operations. Some callers don't need the extra void\ndata pointer, which should be annotated to appease -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n commit-graph.c | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 0aa1640d15..73a539495b 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -1568,12 +1568,14 @@ static void compute_topological_levels(struct write_commit_graph_context *ctx)\n \tstop_progress(&ctx->progress);\n }\n \n-static timestamp_t get_generation_from_graph_data(struct commit *c, void *data)\n+static timestamp_t get_generation_from_graph_data(struct commit *c,\n+\t\t\t\t\t\t  void *data UNUSED)\n {\n \treturn commit_graph_data_at(c)->generation;\n }\n \n-static void set_generation_v2(struct commit *c, timestamp_t t, void *data)\n+static void set_generation_v2(struct commit *c, timestamp_t t,\n+\t\t\t      void *data UNUSED)\n {\n \tstruct commit_graph_data *g = commit_graph_data_at(c);\n \tg->generation = t;\n@@ -1616,7 +1618,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)\n }\n \n static void set_generation_in_graph_data(struct commit *c, timestamp_t t,\n-\t\t\t\t\t void *data)\n+\t\t\t\t\t void *data UNUSED)\n {\n \tcommit_graph_data_at(c)->generation = t;\n }\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481071","messageId":"20230828214742.GG3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 07/22] ls-tree: mark unused parameter in callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:42Z","receivedAt":"2023-08-28T21:48:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The formatting functions are dispatched from a table of function\npointers. The \"path name only\" function unsurprisingly does not need to\nlook at its \"oid\" parameter, but we must mark it as unused to make\n-Wunused-parameter happy.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/ls-tree.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex f558db5f3b..209d2dc0d5 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -241,7 +241,8 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,\n \treturn recurse;\n }\n \n-static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,\n+static int show_tree_name_only(const struct object_id *oid UNUSED,\n+\t\t\t       struct strbuf *base,\n \t\t\t       const char *pathname, unsigned mode,\n \t\t\t       void *context)\n {\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481072","messageId":"20230828214750.GI3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 09/22] trace2: mark unused us_elapsed_absolute parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:50Z","receivedAt":"2023-08-28T21:48:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Many trace2 targets ignore the absolute elapsed time parameters.\nHowever, the virtual interface needs to retain the parameter since it is\nused by others (e.g., the perf target).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n trace2/tr2_tgt_event.c  | 23 +++++++++++++----------\n trace2/tr2_tgt_normal.c | 20 ++++++++++++--------\n 2 files changed, 25 insertions(+), 18 deletions(-)\n\ndiff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c\nindex 53091781ec..59910a1a4f 100644\n--- a/trace2/tr2_tgt_event.c\n+++ b/trace2/tr2_tgt_event.c\n@@ -335,7 +335,7 @@ static void fn_alias_fl(const char *file, int line, const char *alias,\n }\n \n static void fn_child_start_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n \t\t\t      const struct child_process *cmd)\n {\n \tconst char *event_name = \"child_start\";\n@@ -367,7 +367,8 @@ static void fn_child_start_fl(const char *file, int line,\n }\n \n static void fn_child_exit_fl(const char *file, int line,\n-\t\t\t     uint64_t us_elapsed_absolute, int cid, int pid,\n+\t\t\t     uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t     int cid, int pid,\n \t\t\t     int code, uint64_t us_elapsed_child)\n {\n \tconst char *event_name = \"child_exit\";\n@@ -388,7 +389,8 @@ static void fn_child_exit_fl(const char *file, int line,\n }\n \n static void fn_child_ready_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute, int cid, int pid,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t      int cid, int pid,\n \t\t\t      const char *ready, uint64_t us_elapsed_child)\n {\n \tconst char *event_name = \"child_ready\";\n@@ -409,7 +411,7 @@ static void fn_child_ready_fl(const char *file, int line,\n }\n \n static void fn_thread_start_fl(const char *file, int line,\n-\t\t\t       uint64_t us_elapsed_absolute)\n+\t\t\t       uint64_t us_elapsed_absolute UNUSED)\n {\n \tconst char *event_name = \"thread_start\";\n \tstruct json_writer jw = JSON_WRITER_INIT;\n@@ -423,7 +425,7 @@ static void fn_thread_start_fl(const char *file, int line,\n }\n \n static void fn_thread_exit_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n \t\t\t      uint64_t us_elapsed_thread)\n {\n \tconst char *event_name = \"thread_exit\";\n@@ -439,7 +441,8 @@ static void fn_thread_exit_fl(const char *file, int line,\n \tjw_release(&jw);\n }\n \n-static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,\n+static void fn_exec_fl(const char *file, int line,\n+\t\t       uint64_t us_elapsed_absolute UNUSED,\n \t\t       int exec_id, const char *exe, const char **argv)\n {\n \tconst char *event_name = \"exec\";\n@@ -460,8 +463,8 @@ static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,\n }\n \n static void fn_exec_result_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute, int exec_id,\n-\t\t\t      int code)\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t      int exec_id, int code)\n {\n \tconst char *event_name = \"exec_result\";\n \tstruct json_writer jw = JSON_WRITER_INIT;\n@@ -511,7 +514,7 @@ static void fn_repo_fl(const char *file, int line,\n }\n \n static void fn_region_enter_printf_va_fl(const char *file, int line,\n-\t\t\t\t\t uint64_t us_elapsed_absolute,\n+\t\t\t\t\t uint64_t us_elapsed_absolute UNUSED,\n \t\t\t\t\t const char *category,\n \t\t\t\t\t const char *label,\n \t\t\t\t\t const struct repository *repo,\n@@ -538,7 +541,7 @@ static void fn_region_enter_printf_va_fl(const char *file, int line,\n }\n \n static void fn_region_leave_printf_va_fl(\n-\tconst char *file, int line, uint64_t us_elapsed_absolute,\n+\tconst char *file, int line, uint64_t us_elapsed_absolute UNUSED,\n \tuint64_t us_elapsed_region, const char *category, const char *label,\n \tconst struct repository *repo, const char *fmt, va_list ap)\n {\ndiff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c\nindex d25ea13164..38d5ebddf6 100644\n--- a/trace2/tr2_tgt_normal.c\n+++ b/trace2/tr2_tgt_normal.c\n@@ -86,7 +86,7 @@ static void fn_version_fl(const char *file, int line)\n }\n \n static void fn_start_fl(const char *file, int line,\n-\t\t\tuint64_t us_elapsed_absolute, const char **argv)\n+\t\t\tuint64_t us_elapsed_absolute UNUSED, const char **argv)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n \n@@ -215,7 +215,7 @@ static void fn_alias_fl(const char *file, int line, const char *alias,\n }\n \n static void fn_child_start_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n \t\t\t      const struct child_process *cmd)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n@@ -243,7 +243,8 @@ static void fn_child_start_fl(const char *file, int line,\n }\n \n static void fn_child_exit_fl(const char *file, int line,\n-\t\t\t     uint64_t us_elapsed_absolute, int cid, int pid,\n+\t\t\t     uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t     int cid, int pid,\n \t\t\t     int code, uint64_t us_elapsed_child)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n@@ -256,7 +257,8 @@ static void fn_child_exit_fl(const char *file, int line,\n }\n \n static void fn_child_ready_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute, int cid, int pid,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t      int cid, int pid,\n \t\t\t      const char *ready, uint64_t us_elapsed_child)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n@@ -268,7 +270,8 @@ static void fn_child_ready_fl(const char *file, int line,\n \tstrbuf_release(&buf_payload);\n }\n \n-static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,\n+static void fn_exec_fl(const char *file, int line,\n+\t\t       uint64_t us_elapsed_absolute UNUSED,\n \t\t       int exec_id, const char *exe, const char **argv)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n@@ -284,8 +287,8 @@ static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,\n }\n \n static void fn_exec_result_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute, int exec_id,\n-\t\t\t      int code)\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t      int exec_id, int code)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n \n@@ -321,7 +324,8 @@ static void fn_repo_fl(const char *file, int line,\n }\n \n static void fn_printf_va_fl(const char *file, int line,\n-\t\t\t    uint64_t us_elapsed_absolute, const char *fmt,\n+\t\t\t    uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t    const char *fmt,\n \t\t\t    va_list ap)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481073","messageId":"20230828214757.GK3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 11/22] test-trace2: mark unused argv/argc parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:57Z","receivedAt":"2023-08-28T21:48:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The trace2 test helper uses function pointers to dispatch to individual\ntests. Not all tests bother looking at their argv/argc parameters. We\ncould tighten this up (e.g., complaining when seeing unexpected\nparameters), but for internal test code it's not worth worrying about.\n\nThis is similar in spirit to 126e3b3d2a (t/helper: mark unused argv/argc\narguments, 2023-03-28).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/helper/test-trace2.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c\nindex 20c7495f38..d5ca0046c8 100644\n--- a/t/helper/test-trace2.c\n+++ b/t/helper/test-trace2.c\n@@ -45,7 +45,7 @@ static int get_i(int *p_value, const char *data)\n  * [] \"def_param\" events for all of the \"interesting\" pre-defined\n  * config settings.\n  */\n-static int ut_001return(int argc, const char **argv)\n+static int ut_001return(int argc UNUSED, const char **argv)\n {\n \tint rc;\n \n@@ -65,7 +65,7 @@ static int ut_001return(int argc, const char **argv)\n  * [] \"def_param\" events for all of the \"interesting\" pre-defined\n  * config settings.\n  */\n-static int ut_002exit(int argc, const char **argv)\n+static int ut_002exit(int argc UNUSED, const char **argv)\n {\n \tint rc;\n \n@@ -201,7 +201,7 @@ static int ut_006data(int argc, const char **argv)\n \treturn 0;\n }\n \n-static int ut_007BUG(int argc, const char **argv)\n+static int ut_007BUG(int argc UNUSED, const char **argv UNUSED)\n {\n \t/*\n \t * Exercise BUG() to ensure that the message is printed to trace2.\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481074","messageId":"20230828214759.GL3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 12/22] grep: mark unused parameter in output function","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:59Z","receivedAt":"2023-08-28T21:48:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is a callback used with grep_options.output, but we don't look at\nthe grep_opt parameter, as we're just writing the output to stdout.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n grep.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/grep.c b/grep.c\nindex 0904d55b24..0124eb1960 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -17,7 +17,7 @@ static int grep_source_load(struct grep_source *gs);\n static int grep_source_is_binary(struct grep_source *gs,\n \t\t\t\t struct index_state *istate);\n \n-static void std_output(struct grep_opt *opt, const void *buf, size_t size)\n+static void std_output(struct grep_opt *opt UNUSED, const void *buf, size_t size)\n {\n \tfwrite(buf, size, 1, stdout);\n }\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481075","messageId":"20230828214804.GN3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 14/22] negotiator/noop: mark unused callback parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:04Z","receivedAt":"2023-08-28T21:48:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The noop negotiator unsurprisingly does not bother looking at any of its\nparameters. Mark them unused to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n negotiator/noop.c | 12 +++++++-----\n 1 file changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/negotiator/noop.c b/negotiator/noop.c\nindex 7b72937686..de39028ab7 100644\n--- a/negotiator/noop.c\n+++ b/negotiator/noop.c\n@@ -3,22 +3,24 @@\n #include \"../commit.h\"\n #include \"../fetch-negotiator.h\"\n \n-static void known_common(struct fetch_negotiator *n, struct commit *c)\n+static void known_common(struct fetch_negotiator *n UNUSED,\n+\t\t\t struct commit *c UNUSED)\n {\n \t/* do nothing */\n }\n \n-static void add_tip(struct fetch_negotiator *n, struct commit *c)\n+static void add_tip(struct fetch_negotiator *n UNUSED,\n+\t\t    struct commit *c UNUSED)\n {\n \t/* do nothing */\n }\n \n-static const struct object_id *next(struct fetch_negotiator *n)\n+static const struct object_id *next(struct fetch_negotiator *n UNUSED)\n {\n \treturn NULL;\n }\n \n-static int ack(struct fetch_negotiator *n, struct commit *c)\n+static int ack(struct fetch_negotiator *n UNUSED, struct commit *c UNUSED)\n {\n \t/*\n \t * This negotiator does not emit any commits, so there is no commit to\n@@ -28,7 +30,7 @@ static int ack(struct fetch_negotiator *n, struct commit *c)\n \treturn 0;\n }\n \n-static void release(struct fetch_negotiator *n)\n+static void release(struct fetch_negotiator *n UNUSED)\n {\n \t/* nothing to release */\n }\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481076","messageId":"20230828214754.GJ3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 10/22] trace2: mark unused config callback parameter","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:47:54Z","receivedAt":"2023-08-28T21:48:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This should have been part of 783a86c142 (config: mark unused callback\nparameters, 2022-08-19), but was missed in that commit.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n trace2/tr2_sysenv.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/trace2/tr2_sysenv.c b/trace2/tr2_sysenv.c\nindex f26ec95ab4..d3ecac2772 100644\n--- a/trace2/tr2_sysenv.c\n+++ b/trace2/tr2_sysenv.c\n@@ -58,7 +58,8 @@ static struct tr2_sysenv_entry tr2_sysenv_settings[] = {\n /* clang-format on */\n \n static int tr2_sysenv_cb(const char *key, const char *value,\n-\t\t\t const struct config_context *ctx UNUSED, void *d)\n+\t\t\t const struct config_context *ctx UNUSED,\n+\t\t\t void *d UNUSED)\n {\n \tint k;\n \n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481077","messageId":"20230828214802.GM3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 13/22] add-interactive: mark unused callback parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:02Z","receivedAt":"2023-08-28T21:48:53Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The interactive commands are dispatched from a table of abstract\npointers, but not every command uses every parameter it receives. Mark\nthe unused ones to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n add-interactive.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex add9a1ad43..852e8e6b2f 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -1021,9 +1021,9 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,\n \treturn res;\n }\n \n-static int run_help(struct add_i_state *s, const struct pathspec *unused_ps,\n-\t\t    struct prefix_item_list *unused_files,\n-\t\t    struct list_and_choose_options *unused_opts)\n+static int run_help(struct add_i_state *s, const struct pathspec *ps UNUSED,\n+\t\t    struct prefix_item_list *files UNUSED,\n+\t\t    struct list_and_choose_options *opts UNUSED)\n {\n \tcolor_fprintf_ln(stdout, s->help_color, \"status        - %s\",\n \t\t\t _(\"show paths with changes\"));\n@@ -1074,7 +1074,7 @@ struct print_command_item_data {\n \tconst char *color, *reset;\n };\n \n-static void print_command_item(int i, int selected,\n+static void print_command_item(int i, int selected UNUSED,\n \t\t\t       struct string_list_item *item,\n \t\t\t       void *print_command_item_data)\n {\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481078","messageId":"20230828214807.GO3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 15/22] worktree: mark unused parameters in noop repair callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:07Z","receivedAt":"2023-08-28T21:48:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The noop repair callback unsurprisingly does not look at any of its\nparameters. Mark them as unused to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n worktree.c | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/worktree.c b/worktree.c\nindex b8cf29e6a1..a56a6c2a3d 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -581,8 +581,10 @@ static void repair_gitfile(struct worktree *wt,\n \tstrbuf_release(&dotgit);\n }\n \n-static void repair_noop(int iserr, const char *path, const char *msg,\n-\t\t\tvoid *cb_data)\n+static void repair_noop(int iserr UNUSED,\n+\t\t\tconst char *path UNUSED,\n+\t\t\tconst char *msg UNUSED,\n+\t\t\tvoid *cb_data UNUSED)\n {\n \t/* nothing */\n }\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481079","messageId":"20230828214810.GP3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 16/22] imap-send: mark unused parameters with NO_OPENSSL","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:10Z","receivedAt":"2023-08-28T21:48:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Earlier patches annotating unused parameters in imap-send missed a few\ncases in code that is compiled only with NO_OPENSSL. These need to\nretain the extra parameters to match the interfaces used when we compile\nwith openssl support.\n\nNote in the case of socket_perror() that the function declaration and\nparts of its code are shared between the two cases, and only the openssl\ncode looks at \"sock\". So we can't simply mark the parameter as always\nunused. Instead, we can add a noop statement that references it. This is\nugly, but should be portable.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n imap-send.c | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 06386e0b3b..996651e4f8 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -206,10 +206,14 @@ static void socket_perror(const char *func, struct imap_socket *sock, int ret)\n \t\telse\n \t\t\tfprintf(stderr, \"%s: unexpected EOF\\n\", func);\n \t}\n+\t/* mark as used to appease -Wunused-parameter with NO_OPENSSL */\n+\t(void)sock;\n }\n \n #ifdef NO_OPENSSL\n-static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int verify)\n+static int ssl_socket_connect(struct imap_socket *sock UNUSED,\n+\t\t\t      int use_tls_only UNUSED,\n+\t\t\t      int verify UNUSED)\n {\n \tfprintf(stderr, \"SSL requested but SSL support not compiled in\\n\");\n \treturn -1;\n@@ -904,7 +908,9 @@ static char *cram(const char *challenge_64, const char *user, const char *pass)\n \n #else\n \n-static char *cram(const char *challenge_64, const char *user, const char *pass)\n+static char *cram(const char *challenge_64 UNUSED,\n+\t\t  const char *user UNUSED,\n+\t\t  const char *pass UNUSED)\n {\n \tdie(\"If you want to use CRAM-MD5 authenticate method, \"\n \t    \"you have to build git-imap-send with OpenSSL library.\");\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481080","messageId":"20230828214812.GQ3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 17/22] grep: mark unused parmaeters in pcre fallbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:12Z","receivedAt":"2023-08-28T21:48:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"When USE_LIBPCRE2 is not defined, we compile several noop fallbacks.\nThese need to have their parameters annotated to avoid\n-Wunused-parameter warnings (and obviously we cannot remove the\nparameters, since the functions must match the non-fallback versions).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n grep.c | 10 ++++++----\n 1 file changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/grep.c b/grep.c\nindex 0124eb1960..fc2d0c837a 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -452,18 +452,20 @@ static void free_pcre2_pattern(struct grep_pat *p)\n \tpcre2_general_context_free(p->pcre2_general_context);\n }\n #else /* !USE_LIBPCRE2 */\n-static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt)\n+static void compile_pcre2_pattern(struct grep_pat *p UNUSED,\n+\t\t\t\t  const struct grep_opt *opt UNUSED)\n {\n \tdie(\"cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE\");\n }\n \n-static int pcre2match(struct grep_pat *p, const char *line, const char *eol,\n-\t\tregmatch_t *match, int eflags)\n+static int pcre2match(struct grep_pat *p UNUSED, const char *line UNUSED,\n+\t\t      const char *eol UNUSED, regmatch_t *match UNUSED,\n+\t\t      int eflags UNUSED)\n {\n \treturn 1;\n }\n \n-static void free_pcre2_pattern(struct grep_pat *p)\n+static void free_pcre2_pattern(struct grep_pat *p UNUSED)\n {\n }\n \n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481081","messageId":"20230828214815.GR3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 18/22] credential: mark unused parameter in urlmatch callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:15Z","receivedAt":"2023-08-28T21:48:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Our select_all() callback does not need to actually look at its\nparameters, since the point is to match everything. But we need to mark\nits parameters to satisfy -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n credential.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/credential.c b/credential.c\nindex d664754163..18098bd35e 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -88,8 +88,8 @@ static int proto_is_http(const char *s)\n static void credential_describe(struct credential *c, struct strbuf *out);\n static void credential_format(struct credential *c, struct strbuf *out);\n \n-static int select_all(const struct urlmatch_item *a,\n-\t\t      const struct urlmatch_item *b)\n+static int select_all(const struct urlmatch_item *a UNUSED,\n+\t\t      const struct urlmatch_item *b UNUSED)\n {\n \treturn 0;\n }\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481082","messageId":"20230828214818.GS3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 19/22] fetch: mark unused parameter in ref_transaction callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:18Z","receivedAt":"2023-08-28T21:49:24Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Since this callback is just trying to collect the set of queued tag\nupdates, there is no need for it to look at old_oid at all. Mark it as\nunused to appease -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/fetch.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex eed4a7cdb6..8f93529505 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -308,7 +308,7 @@ static void clear_item(struct refname_hash_entry *item)\n \n \n static void add_already_queued_tags(const char *refname,\n-\t\t\t\t    const struct object_id *old_oid,\n+\t\t\t\t    const struct object_id *old_oid UNUSED,\n \t\t\t\t    const struct object_id *new_oid,\n \t\t\t\t    void *cb_data)\n {\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481083","messageId":"20230828214820.GT3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 20/22] bundle-uri: mark unused parameters in callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:20Z","receivedAt":"2023-08-28T21:49:24Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The first hunk is similar to 02c3c59e62 (hashmap: mark unused callback\nparameters, 2022-08-19), but was added after that commit.\n\nThe other two are used with for_all_bundles_in_list(), but don't use\ntheir void data pointer.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n bundle-uri.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 4b5c49b93d..8492fffd2f 100644\n--- a/bundle-uri.c\n+++ b/bundle-uri.c\n@@ -20,7 +20,7 @@ static struct {\n \t{ BUNDLE_HEURISTIC_CREATIONTOKEN, \"creationToken\" },\n };\n \n-static int compare_bundles(const void *hashmap_cmp_fn_data,\n+static int compare_bundles(const void *hashmap_cmp_fn_data UNUSED,\n \t\t\t   const struct hashmap_entry *he1,\n \t\t\t   const struct hashmap_entry *he2,\n \t\t\t   const void *id)\n@@ -45,7 +45,7 @@ void init_bundle_list(struct bundle_list *list)\n }\n \n static int clear_remote_bundle_info(struct remote_bundle_info *bundle,\n-\t\t\t\t    void *data)\n+\t\t\t\t    void *data UNUSED)\n {\n \tFREE_AND_NULL(bundle->id);\n \tFREE_AND_NULL(bundle->uri);\n@@ -779,7 +779,7 @@ static int unbundle_all_bundles(struct repository *r,\n \treturn 0;\n }\n \n-static int unlink_bundle(struct remote_bundle_info *info, void *data)\n+static int unlink_bundle(struct remote_bundle_info *info, void *data UNUSED)\n {\n \tif (info->file)\n \t\tunlink_or_warn(info->file);\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481084","messageId":"20230828214826.GV3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 22/22] update-ref: mark unused parameter in parser callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:26Z","receivedAt":"2023-08-28T21:49:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The parsing of stdin is driven by a table of function pointers; mark\nunused parameters in concrete functions to avoid -Wunused-parameter\nwarnings.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/update-ref.c | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 242102273e..c0c4e65e6f 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -311,8 +311,8 @@ static void report_ok(const char *command)\n \tfflush(stdout);\n }\n \n-static void parse_cmd_option(struct ref_transaction *transaction,\n-\t\t\t     const char *next, const char *end)\n+static void parse_cmd_option(struct ref_transaction *transaction UNUSED,\n+\t\t\t     const char *next, const char *end UNUSED)\n {\n \tconst char *rest;\n \tif (skip_prefix(next, \"no-deref\", &rest) && *rest == line_termination)\n@@ -321,16 +321,16 @@ static void parse_cmd_option(struct ref_transaction *transaction,\n \t\tdie(\"option unknown: %s\", next);\n }\n \n-static void parse_cmd_start(struct ref_transaction *transaction,\n-\t\t\t    const char *next, const char *end)\n+static void parse_cmd_start(struct ref_transaction *transaction UNUSED,\n+\t\t\t    const char *next, const char *end UNUSED)\n {\n \tif (*next != line_termination)\n \t\tdie(\"start: extra input: %s\", next);\n \treport_ok(\"start\");\n }\n \n static void parse_cmd_prepare(struct ref_transaction *transaction,\n-\t\t\t      const char *next, const char *end)\n+\t\t\t      const char *next, const char *end UNUSED)\n {\n \tstruct strbuf error = STRBUF_INIT;\n \tif (*next != line_termination)\n@@ -341,7 +341,7 @@ static void parse_cmd_prepare(struct ref_transaction *transaction,\n }\n \n static void parse_cmd_abort(struct ref_transaction *transaction,\n-\t\t\t    const char *next, const char *end)\n+\t\t\t    const char *next, const char *end UNUSED)\n {\n \tstruct strbuf error = STRBUF_INIT;\n \tif (*next != line_termination)\n@@ -352,7 +352,7 @@ static void parse_cmd_abort(struct ref_transaction *transaction,\n }\n \n static void parse_cmd_commit(struct ref_transaction *transaction,\n-\t\t\t     const char *next, const char *end)\n+\t\t\t     const char *next, const char *end UNUSED)\n {\n \tstruct strbuf error = STRBUF_INIT;\n \tif (*next != line_termination)\n-- \n2.42.0.505.g4c6fb48dec\n"},{"id":"481085","messageId":"20230828214823.GU3831137@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH 21/22] gc: mark unused descriptors in scheduler callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-28T21:48:23Z","receivedAt":"2023-08-28T21:49:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Each of the scheduler update callbacks gets the descriptor of the lock\nfile, but only the crontab updater needs it. We have to retain the\nunused descriptors because these are dispatched from a table of function\npointers, but we should mark them to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/gc.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 1f53b66c7b..369bd43fb2 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1934,7 +1934,7 @@ static int launchctl_add_plists(void)\n \t       launchctl_schedule_plist(exec_path, SCHEDULE_WEEKLY);\n }\n \n-static int launchctl_update_schedule(int run_maintenance, int fd)\n+static int launchctl_update_schedule(int run_maintenance, int fd UNUSED)\n {\n \tif (run_maintenance)\n \t\treturn launchctl_add_plists();\n@@ -2115,7 +2115,7 @@ static int schtasks_schedule_tasks(void)\n \t       schtasks_schedule_task(exec_path, SCHEDULE_WEEKLY);\n }\n \n-static int schtasks_update_schedule(int run_maintenance, int fd)\n+static int schtasks_update_schedule(int run_maintenance, int fd UNUSED)\n {\n \tif (run_maintenance)\n \t\treturn schtasks_schedule_tasks();\n@@ -2556,7 +2556,7 @@ static int systemd_timer_setup_units(void)\n \treturn ret;\n }\n \n-static int systemd_timer_update_schedule(int run_maintenance, int fd)\n+static int systemd_timer_update_schedule(int run_maintenance, int fd UNUSED)\n {\n \tif (run_maintenance)\n \t\treturn systemd_timer_setup_units();\n-- \n2.42.0.505.g4c6fb48dec\n\n"},{"id":"481086","messageId":"xmqqsf82g65k.fsf@gitster.g","threadId":"60161","inReplyTo":"20230828214629.GA3831137@coredump.intra.peff.net","subject":"Re: [PATCH 01/22] sequencer: use repository parameter in short_commit_name()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-08-28T22:21:11Z","receivedAt":"2023-08-28T22:21:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> -static const char *short_commit_name(struct commit *commit)\n> +static const char *short_commit_name(struct repository *r, struct commit *commit)\n>  {\n> -\treturn repo_find_unique_abbrev(the_repository, &commit->object.oid,\n> -\t\t\t\t       DEFAULT_ABBREV);\n> +\treturn repo_find_unique_abbrev(r, &commit->object.oid, DEFAULT_ABBREV);\n>  }\n\nTheoretically this is the right thing to do, and ...\n\n>  static int get_message(struct commit *commit, struct commit_message *out)\n> @@ -446,7 +445,7 @@ static int get_message(struct commit *commit, struct commit_message *out)\n>  \n>  \tout->message = repo_logmsg_reencode(the_repository, commit, NULL,\n>  \t\t\t\t\t    get_commit_output_encoding());\n> -\tabbrev = short_commit_name(commit);\n> +\tabbrev = short_commit_name(the_repository, commit);\n\n... this is a no-op.\n\n> @@ -2383,7 +2382,7 @@ static int do_pick_commit(struct repository *r,\n>  \t\terror(command == TODO_REVERT\n>  \t\t      ? _(\"could not revert %s... %s\")\n>  \t\t      : _(\"could not apply %s... %s\"),\n> -\t\t      short_commit_name(commit), msg.subject);\n> +\t\t      short_commit_name(r, commit), msg.subject);\n\nAnd this is a logical consequence for a function that is told by the\ncaller in which repository to work in via its parameter.\n\n> @@ -3172,7 +3171,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n>  \t\titem->offset_in_buf = todo_list->buf.len;\n>  \t\tsubject_len = find_commit_subject(commit_buffer, &subject);\n>  \t\tstrbuf_addf(&todo_list->buf, \"%s %s %.*s\\n\", command_string,\n> -\t\t\tshort_commit_name(commit), subject_len, subject);\n> +\t\t\tshort_commit_name(opts->revs->repo, commit),\n> +\t\t\tsubject_len, subject);\n>  \t\trepo_unuse_commit_buffer(the_repository, commit,\n>  \t\t\t\t\t commit_buffer);\n\nBut how do we ascertain that opts->revs->repo is always safe to use\n(iow initialized to a sensible value)?  repo_init_revisions() takes\na repository as its parameter and the first thing it does is to set\nit to the revs->repo, so it is safe for any \"struct rev_info\" that\ncame from there, but REV_INFO_INIT omits initializer for the .repo\nmember.\n\nThe other two calls in this loop refer to the_repository so the\ncurrent code would be safe even if opts->revs->repo is set or NULL,\nbut that will no longer be true with the updated code.  I'd feel\nsafer if at the beginning of the function we create a local variable\n\"struct rev_info *repo\" that is initialized to opts->revs->repo and\nuse it throughout the function instead of the_repository.\n\n\n> @@ -5564,7 +5564,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,\n>  \t\tif (!is_empty && (commit->object.flags & PATCHSAME)) {\n>  \t\t\tif (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS)\n>  \t\t\t\twarning(_(\"skipped previously applied commit %s\"),\n> -\t\t\t\t\tshort_commit_name(commit));\n> +\t\t\t\t\tshort_commit_name(revs->repo, commit));\n>  \t\t\tskipped_commit = 1;\n>  \t\t\tcontinue;\n>  \t\t}\n\nThis one I am fairly certain is a safe and correct conversion; the\nfunction would be segfaulting in its call to get_revision() if\nrevs->repo were set to a bogus value.\n\nThanks.\n"},{"id":"481097","messageId":"ZO0oit19WhJuvhH8@nand.local","threadId":"60161","inReplyTo":"xmqqsf82g65k.fsf@gitster.g","subject":"Re: [PATCH 01/22] sequencer: use repository parameter in short_commit_name()","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-08-28T23:06:50Z","receivedAt":"2023-08-28T23:07:31Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Mon, Aug 28, 2023 at 03:21:11PM -0700, Junio C Hamano wrote:\n> > @@ -3172,7 +3171,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n> >  \t\titem->offset_in_buf = todo_list->buf.len;\n> >  \t\tsubject_len = find_commit_subject(commit_buffer, &subject);\n> >  \t\tstrbuf_addf(&todo_list->buf, \"%s %s %.*s\\n\", command_string,\n> > -\t\t\tshort_commit_name(commit), subject_len, subject);\n> > +\t\t\tshort_commit_name(opts->revs->repo, commit),\n> > +\t\t\tsubject_len, subject);\n> >  \t\trepo_unuse_commit_buffer(the_repository, commit,\n> >  \t\t\t\t\t commit_buffer);\n>\n> But how do we ascertain that opts->revs->repo is always safe to use\n> (iow initialized to a sensible value)?  repo_init_revisions() takes\n> a repository as its parameter and the first thing it does is to set\n> it to the revs->repo, so it is safe for any \"struct rev_info\" that\n> came from there, but REV_INFO_INIT omits initializer for the .repo\n> member.\n>\n> The other two calls in this loop refer to the_repository so the\n> current code would be safe even if opts->revs->repo is set or NULL,\n> but that will no longer be true with the updated code.  I'd feel\n> safer if at the beginning of the function we create a local variable\n> \"struct rev_info *repo\" that is initialized to opts->revs->repo and\n> use it throughout the function instead of the_repository.\n\nThis call comes from sequencer_pick_revisions() ->\nwalk_revs_populate_todo(), where opts is passed in from the caller of\nthe former function.\n\nThe sole caller of that function is run_sequencer() in builtin/revert.c.\nThe relevant portion of that function is:\n\n    if (cmd) {\n        opts->revs = NULL;\n    } else {\n        struct setup_revision_opt s_r_opt;\n        opts->revs = xmalloc(sizeof(*opts->revs));\n        repo_init_revisions(the_repository, opts->revs, NULL);\n        opts->revs->no_walk = 1;\n        opts->revs->unsorted_input = 1;\n        /* ... */\n    }\n\nSo as long as we end up in the else arm of this conditional, we'll have\ncalled repo_init_revisions(), causing opts->revs->repo to be equal to\nthe_repository.\n\nThankfully, we have an assert(opts->revs) at the beginning of\nsequencer_pick_revisions(), so we know that we always take the else arm\non this particular call path.\n\n...but, sequencer_pick_revisions() itself takes a repository pointer, so\nwe could equally use that, or drop it, like so:\n\n--- 8< ---\ndiff --git a/builtin/revert.c b/builtin/revert.c\nindex e6f9a1ad26..29e215c72a 100644\n--- a/builtin/revert.c\n+++ b/builtin/revert.c\n@@ -224,7 +224,7 @@ static int run_sequencer(int argc, const char **argv, const char *prefix,\n \t\treturn sequencer_rollback(the_repository, opts);\n \tif (cmd == 's')\n \t\treturn sequencer_skip(the_repository, opts);\n-\treturn sequencer_pick_revisions(the_repository, opts);\n+\treturn sequencer_pick_revisions(opts);\n }\n\n int cmd_revert(int argc, const char **argv, const char *prefix)\ndiff --git a/sequencer.c b/sequencer.c\nindex 48475d1cc6..bc7e687623 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -5201,14 +5201,15 @@ static int single_pick(struct repository *r,\n \treturn do_pick_commit(r, &item, opts, 0, &check_todo);\n }\n\n-int sequencer_pick_revisions(struct repository *r,\n-\t\t\t     struct replay_opts *opts)\n+int sequencer_pick_revisions(struct replay_opts *opts)\n {\n \tstruct todo_list todo_list = TODO_LIST_INIT;\n \tstruct object_id oid;\n+\tstruct repository *r;\n \tint i, res;\n\n \tassert(opts->revs);\n+\tr = opts->revs->repo;\n \tif (read_and_refresh_cache(r, opts))\n \t\treturn -1;\n\ndiff --git a/sequencer.h b/sequencer.h\nindex 913a0f652d..10caa3dc93 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -158,8 +158,7 @@ void todo_list_filter_update_refs(struct repository *r,\n\n /* Call this to setup defaults before parsing command line options */\n void sequencer_init_config(struct replay_opts *opts);\n-int sequencer_pick_revisions(struct repository *repo,\n-\t\t\t     struct replay_opts *opts);\n+int sequencer_pick_revisions(struct replay_opts *opts);\n int sequencer_continue(struct repository *repo, struct replay_opts *opts);\n int sequencer_rollback(struct repository *repo, struct replay_opts *opts);\n int sequencer_skip(struct repository *repo, struct replay_opts *opts);\n--- >8 ---\n\nthough it makes for an awkward API to have all of the other\nsequencer-related functions take as their first argument a pointer to a\nrepository struct, leaving sequencer_pick_revisions() as the odd one\nout.\n\nSo I'd probably just as soon drop that and do what Junio suggests:\n\n--- 8< ---\ndiff --git a/sequencer.c b/sequencer.c\nindex 82dc3e160e..6c06b8e1bb 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -3143,22 +3143,24 @@ int write_basic_state(struct replay_opts *opts, const char *head_name,\n }\n\n static int walk_revs_populate_todo(struct todo_list *todo_list,\n-\t\t\t\tstruct replay_opts *opts)\n+\t\t\t\t   struct replay_opts *opts)\n {\n \tenum todo_command command = opts->action == REPLAY_PICK ?\n \t\tTODO_PICK : TODO_REVERT;\n \tconst char *command_string = todo_command_info[command].str;\n \tconst char *encoding;\n \tstruct commit *commit;\n+\tstruct repository *r;\n\n \tif (prepare_revs(opts))\n \t\treturn -1;\n+\tr = opts->revs->repo;\n\n \tencoding = get_log_output_encoding();\n\n \twhile ((commit = get_revision(opts->revs))) {\n \t\tstruct todo_item *item = append_new_todo(todo_list);\n-\t\tconst char *commit_buffer = repo_logmsg_reencode(the_repository,\n+\t\tconst char *commit_buffer = repo_logmsg_reencode(r,\n \t\t\t\t\t\t\t\t commit, NULL,\n \t\t\t\t\t\t\t\t encoding);\n \t\tconst char *subject;\n@@ -3173,8 +3175,7 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n \t\tstrbuf_addf(&todo_list->buf, \"%s %s %.*s\\n\", command_string,\n \t\t\tshort_commit_name(opts->revs->repo, commit),\n \t\t\tsubject_len, subject);\n-\t\trepo_unuse_commit_buffer(the_repository, commit,\n-\t\t\t\t\t commit_buffer);\n+\t\trepo_unuse_commit_buffer(r, commit, commit_buffer);\n \t}\n\n \tif (!todo_list->nr)\n--- >8 ---\n\n> > @@ -5564,7 +5564,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,\n> >  \t\tif (!is_empty && (commit->object.flags & PATCHSAME)) {\n> >  \t\t\tif (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS)\n> >  \t\t\t\twarning(_(\"skipped previously applied commit %s\"),\n> > -\t\t\t\t\tshort_commit_name(commit));\n> > +\t\t\t\t\tshort_commit_name(revs->repo, commit));\n> >  \t\t\tskipped_commit = 1;\n> >  \t\t\tcontinue;\n> >  \t\t}\n>\n> This one I am fairly certain is a safe and correct conversion; the\n> function would be segfaulting in its call to get_revision() if\n> revs->repo were set to a bogus value.\n\nAgreed.\n\nThanks,\nTaylor\n"},{"id":"481099","messageId":"ZO0sxN/+RhvDi+62@nand.local","threadId":"60161","inReplyTo":"20230828214717.GB3831137@coredump.intra.peff.net","subject":"Re: [PATCH 02/22] sequencer: mark repository argument as unused","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-08-28T23:24:52Z","receivedAt":"2023-08-28T23:25:38Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Mon, Aug 28, 2023 at 05:47:17PM -0400, Jeff King wrote:\n> Note that we could also drop this parameter entirely, as the function is\n> always called directly, and not as a callback that has to conform to\n> some external interface. But since we'd eventually want to use the\n> repository parameter, let's leave it in place to avoid disrupting the\n> callers twice.\n\nYeah, I think that this (and the discussion on the previous patch) are\nhinting that we should consider dropping the repository argument more\nbroadly throughout the sequencer API, since we can often use\n`opts->revs->repo` in its place.\n\nBut we can definitely leave that for another day ;-). In the meantime,\nthis patch LGTM.\n\nThanks,\nTaylor\n"},{"id":"481100","messageId":"ZO0uq25DV6MIvG6q@nand.local","threadId":"60161","inReplyTo":"20230828214739.GF3831137@coredump.intra.peff.net","subject":"Re: [PATCH 06/22] commit-graph: mark unused data parameters in generation callbacks","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-08-28T23:32:59Z","receivedAt":"2023-08-28T23:33:50Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Mon, Aug 28, 2023 at 05:47:39PM -0400, Jeff King wrote:\n> The compute_generation_info code uses function pointers to abstract the\n> get/set generation operations. Some callers don't need the extra void\n> data pointer, which should be annotated to appease -Wunused-parameter.\n\nI think just the callbacks initialized by compute_topological_levels()\n(i.e, get_topo_level() and set_topo_level()) care about the ctx\nparameter.\n\nI think that we can go a bit further, though. The other caller in\ncompute_generation_numbers() assigns data to the argument ctx it takes\nin, but neither of its callbacks get_generation_from_graph_data() and\nset_generation_v2() use the data parameter, as is implied by the the\nexistence of this patch.\n\nSo I think that we could drop the assignment to data entirely like so,\napplied on top of this patch:\n\n--- 8< ---\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 0aa1640d15..eb3e27b720 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -1587,7 +1587,6 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)\n \t\t.commits = &ctx->commits,\n \t\t.get_generation = get_generation_from_graph_data,\n \t\t.set_generation = set_generation_v2,\n-\t\t.data = ctx,\n \t};\n\n \tif (ctx->report_progress)\n--- >8 ---\n\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>  commit-graph.c | 8 +++++---\n>  1 file changed, 5 insertions(+), 3 deletions(-)\n\nThe rest looks obviously correct to me, thanks.\n\nThanks,\nTaylor\n"},{"id":"481101","messageId":"ZO0vQk6LWxNhLrd3@nand.local","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"Re: [PATCH 0/22] YAUPS: Yet Another Unused Parameter Series","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-08-28T23:35:30Z","receivedAt":"2023-08-28T23:37:02Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Mon, Aug 28, 2023 at 05:46:04PM -0400, Jeff King wrote:\n> I'm back with another exciting installment of -Wunused-parameter warning\n> fixes. Most of these are pretty boring and obvious; the first two are\n> the most interesting in terms of rationale.\n>\n> I promise we're closing in on the finish line here. I only have about 20\n> patches left after this, at which point we should be able to turn on the\n> warning by default for developer builds.\n\nHeh ;-). It's good to see us getting dangerously close to being able to\nturn on -Wunused-parameter in the DEVELOPER builds.\n\nI reviewed this series, and all looked sensible. I left a couple notes\nthroughout for potential further cleanups that we could do on top, which\nmight be nice to squash in.\n\nBut I wouldn't be heartbroken if you want to ignore them, either. So\nwith or without my suggestions, this series LGTM.\n\nThanks,\nTaylor\n"},{"id":"481104","messageId":"20230829004801.GA3876652@coredump.intra.peff.net","threadId":"60161","inReplyTo":"xmqqsf82g65k.fsf@gitster.g","subject":"Re: [PATCH 01/22] sequencer: use repository parameter in short_commit_name()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T00:48:01Z","receivedAt":"2023-08-29T00:49:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 28, 2023 at 03:21:11PM -0700, Junio C Hamano wrote:\n\n> > @@ -3172,7 +3171,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n> >  \t\titem->offset_in_buf = todo_list->buf.len;\n> >  \t\tsubject_len = find_commit_subject(commit_buffer, &subject);\n> >  \t\tstrbuf_addf(&todo_list->buf, \"%s %s %.*s\\n\", command_string,\n> > -\t\t\tshort_commit_name(commit), subject_len, subject);\n> > +\t\t\tshort_commit_name(opts->revs->repo, commit),\n> > +\t\t\tsubject_len, subject);\n> >  \t\trepo_unuse_commit_buffer(the_repository, commit,\n> >  \t\t\t\t\t commit_buffer);\n> \n> But how do we ascertain that opts->revs->repo is always safe to use\n> (iow initialized to a sensible value)?  repo_init_revisions() takes\n> a repository as its parameter and the first thing it does is to set\n> it to the revs->repo, so it is safe for any \"struct rev_info\" that\n> came from there, but REV_INFO_INIT omits initializer for the .repo\n> member.\n\nI mostly just assumed it would have been initialized, because passing in\nanything else and expecting it to work is a bit crazy. REV_INFO_INIT\nspecifically says:\n\n   * This will not fully initialize a \"struct rev_info\", the\n   * repo_init_revisions() function needs to be called before\n   * setup_revisions() and any revision walking takes place.\n\nand then goes on to explain that the point is just so you can \"goto\ncleanup\" and free it if you never made it to the init_revisions() call.\nSo the code would already be pretty buggy in this case.\n\nThat said, all of the code paths here do call repo_init_revisions(), so\nI think it is OK. But if we want to make the patch simple and more\nobviously correct, I would prefer to just blindly use the_repository in\ncallers that don't have a \"struct repository\" themselves. Then we know\nit's a strict step forward (if slightly smaller), and we can leave the\nrefactoring of the rest of the sequencer code for another day. I was\ntrying hard to draw a reasonable line and not get this already-large\nseries derailed by only semi-related refactoring.\n\n> The other two calls in this loop refer to the_repository so the\n> current code would be safe even if opts->revs->repo is set or NULL,\n> but that will no longer be true with the updated code.  I'd feel\n> safer if at the beginning of the function we create a local variable\n> \"struct rev_info *repo\" that is initialized to opts->revs->repo and\n> use it throughout the function instead of the_repository.\n\nI'm not sure how that makes it any safer, as it would mean using the\nsuspect repo pointer in more places. Unless you are proposing to do:\n\n  struct repository *r = opts->revs->repo;\n  if (!r)\n\tr = the_repository; /* or BUG() ? */\n\n-Peff\n"},{"id":"481105","messageId":"20230829005208.GB3876652@coredump.intra.peff.net","threadId":"60161","inReplyTo":"ZO0uq25DV6MIvG6q@nand.local","subject":"Re: [PATCH 06/22] commit-graph: mark unused data parameters in generation callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T00:52:08Z","receivedAt":"2023-08-29T00:53:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 28, 2023 at 07:32:59PM -0400, Taylor Blau wrote:\n\n> On Mon, Aug 28, 2023 at 05:47:39PM -0400, Jeff King wrote:\n> > The compute_generation_info code uses function pointers to abstract the\n> > get/set generation operations. Some callers don't need the extra void\n> > data pointer, which should be annotated to appease -Wunused-parameter.\n> \n> I think just the callbacks initialized by compute_topological_levels()\n> (i.e, get_topo_level() and set_topo_level()) care about the ctx\n> parameter.\n> \n> I think that we can go a bit further, though. The other caller in\n> compute_generation_numbers() assigns data to the argument ctx it takes\n> in, but neither of its callbacks get_generation_from_graph_data() and\n> set_generation_v2() use the data parameter, as is implied by the the\n> existence of this patch.\n> \n> So I think that we could drop the assignment to data entirely like so,\n> applied on top of this patch:\n> \n> --- 8< ---\n> diff --git a/commit-graph.c b/commit-graph.c\n> index 0aa1640d15..eb3e27b720 100644\n> --- a/commit-graph.c\n> +++ b/commit-graph.c\n> @@ -1587,7 +1587,6 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)\n>  \t\t.commits = &ctx->commits,\n>  \t\t.get_generation = get_generation_from_graph_data,\n>  \t\t.set_generation = set_generation_v2,\n> -\t\t.data = ctx,\n>  \t};\n> \n>  \tif (ctx->report_progress)\n> --- >8 ---\n\nYeah, I didn't dig too much in the caller. I could see an argument for\nleaving it, in that it might be the \"least surprise\" for somebody who\nlater wants to look at the ctx variable from those callbacks. But since\nall they get is a void pointer, anybody writing that code would have to\ngo back to the caller to see what is passed in as \"data\" anyway.\n\nSo I think it is safe to add this cleanup. I'm going to re-roll to\nsimplify the first patch a bit, so I'll add this in as well. Thanks.\n\n-Peff\n"},{"id":"481108","messageId":"xmqqh6oify21.fsf@gitster.g","threadId":"60161","inReplyTo":"20230829004801.GA3876652@coredump.intra.peff.net","subject":"Re: [PATCH 01/22] sequencer: use repository parameter in short_commit_name()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-08-29T01:16:06Z","receivedAt":"2023-08-29T01:17:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n>> but that will no longer be true with the updated code.  I'd feel\n>> safer if at the beginning of the function we create a local variable\n>> \"struct rev_info *repo\" that is initialized to opts->revs->repo and\n>> use it throughout the function instead of the_repository.\n>\n> I'm not sure how that makes it any safer, as it would mean using the\n> suspect repo pointer in more places. Unless you are proposing to do:\n>\n>   struct repository *r = opts->revs->repo;\n>   if (!r)\n> \tr = the_repository; /* or BUG() ? */\n\nYup, the BUG() variant was exactly what I had in mind, but without\nthe assert, by using opts->revs->repo more consistently, we would\nmake sure nobody will call us with uninitialized opts->revs->repo\nnow or in the future.\n"},{"id":"481115","messageId":"e65c93ec-0221-492b-b538-450b60cf1e59@gmail.com","threadId":"60161","inReplyTo":"20230828214717.GB3831137@coredump.intra.peff.net","subject":"Re: [PATCH 02/22] sequencer: mark repository argument as unused","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2023-08-29T15:55:30Z","receivedAt":"2023-08-29T15:56:48Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Peff\n\nOn 28/08/2023 22:47, Jeff King wrote:\n> In sequencer_get_last_command(), we don't ever look at the repository\n> parameter. It _should_ be used when calling into git_path_* functions,\n> but the one we use here is declared with the non-REPO variant of\n> GIT_PATH_FUNC(), and so just uses the_repository internally.\n> \n> We could change the path helper to use REPO_GIT_PATH_FUNC(), but doing\n> so piecemeal is not great. There are 41 uses of GIT_PATH_FUNC() in\n> sequencer.c,\n\nWow, I knew there were quite a few but I hadn't realized there were that \nmany. Changing them all to take a struct repository will be a big change \nand will make struct repo_cache_path a lot larger.\n\n> and inconsistently switching one makes the code more\n> confusing. Likewise, this one function is used in half a dozen other\n> spots, all of which would need to start passing in a repository argument\n> (with rippling effects up the call stack).\n> \n> So let's punt on that for now and just silence any -Wunused-parameter\n> warning.\n> \n> Note that we could also drop this parameter entirely, as the function is\n> always called directly, and not as a callback that has to conform to\n> some external interface. But since we'd eventually want to use the\n> repository parameter, let's leave it in place to avoid disrupting the\n> callers twice.\n\nI think that makes sense as we're going to need that argument \neventually. I was curious as to why this function takes a repository \nargument. When the function was added in 4a72486de97 (fix \ncherry-pick/revert status after commit, 2019-04-16) it called \nparse_insn_line() which takes a repository argument. It was refactored \nin ed5b1ca10b (status: do not report errors in sequencer/todo, \n2019-06-27) and I failed to notice that the repository was unused \nafterwards.\n\nBest Wishes\n\nPhillip\n\n\n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n>   sequencer.c | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/sequencer.c b/sequencer.c\n> index 82dc3e160e..41fd79d215 100644\n> --- a/sequencer.c\n> +++ b/sequencer.c\n> @@ -2649,7 +2649,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,\n>   \treturn item->commit ? 0 : -1;\n>   }\n>   \n> -int sequencer_get_last_command(struct repository *r, enum replay_action *action)\n> +int sequencer_get_last_command(struct repository *r UNUSED, enum replay_action *action)\n>   {\n>   \tconst char *todo_file, *bol;\n>   \tstruct strbuf buf = STRBUF_INIT;\n"},{"id":"481141","messageId":"20230829233252.GA225495@coredump.intra.peff.net","threadId":"60161","inReplyTo":"e65c93ec-0221-492b-b538-450b60cf1e59@gmail.com","subject":"Re: [PATCH 02/22] sequencer: mark repository argument as unused","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:32:52Z","receivedAt":"2023-08-29T23:33:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Aug 29, 2023 at 04:55:30PM +0100, Phillip Wood wrote:\n\n> > We could change the path helper to use REPO_GIT_PATH_FUNC(), but doing\n> > so piecemeal is not great. There are 41 uses of GIT_PATH_FUNC() in\n> > sequencer.c,\n> \n> Wow, I knew there were quite a few but I hadn't realized there were that\n> many. Changing them all to take a struct repository will be a big change and\n> will make struct repo_cache_path a lot larger.\n\nYeah. One of the things that gave me pause is that some of them may need\nto be renamed, as well. Most of the existing ones are static local\nwithin sequencer.c, so names like git_path_head_file() are OK. But\nREPO_GIT_PATH_FUNC() requires a pointer in the global repo_cache_path,\nso the names need to be appropriate for a global view.\n\n> > Note that we could also drop this parameter entirely, as the function is\n> > always called directly, and not as a callback that has to conform to\n> > some external interface. But since we'd eventually want to use the\n> > repository parameter, let's leave it in place to avoid disrupting the\n> > callers twice.\n> \n> I think that makes sense as we're going to need that argument eventually. I\n> was curious as to why this function takes a repository argument. When the\n> function was added in 4a72486de97 (fix cherry-pick/revert status after\n> commit, 2019-04-16) it called parse_insn_line() which takes a repository\n> argument. It was refactored in ed5b1ca10b (status: do not report errors in\n> sequencer/todo, 2019-06-27) and I failed to notice that the repository was\n> unused afterwards.\n\nThanks for digging there. I usually do something similar for these\npatches (to help verify that there's no extra bug lurking), but with\n\"struct repository\" ones, the answer was usually uninteresting (\"it\nshould be used, but the underlying functions don't support it\" kind of\nthing).\n\nSince I'm re-rolling anyway, I'll throw your research into the commit\nmessage.\n\n-Peff\n"},{"id":"481142","messageId":"20230829234305.GA226944@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230828214604.GA3830831@coredump.intra.peff.net","subject":"[PATCH v2 0/22] Yet Another Unused Parameter Series","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:43:05Z","receivedAt":"2023-08-29T23:43:47Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Aug 28, 2023 at 05:46:04PM -0400, Jeff King wrote:\n\n> I'm back with another exciting installment of -Wunused-parameter warning\n> fixes. Most of these are pretty boring and obvious; the first two are\n> the most interesting in terms of rationale.\n> \n> I promise we're closing in on the finish line here. I only have about 20\n> patches left after this, at which point we should be able to turn on the\n> warning by default for developer builds.\n\nAnd here's a v2 based on feedback from round 1. The changes are small,\nso I'll let the range-diff below speak for itself.\n\n 1:  6009723d8a !  1:  c11e9b9bd6 sequencer: use repository parameter in short_commit_name()\n    @@ Commit message\n         the_repository, but this pushes us one small step forward to eventually\n         getting rid of those.\n     \n    +    Note that a few of these functions have a \"rev_info\" whose \"repo\"\n    +    parameter could probably be used instead of the_repository. I'm leaving\n    +    that for further cleanups, as it's not immediately obvious that\n    +    revs->repo is always valid, and there's quite a bit of other possible\n    +    refactoring here (even getting rid of some \"struct repository\" arguments\n    +    in favor of revs->repo).\n    +\n         Signed-off-by: Jeff King <peff@peff.net>\n     \n      ## sequencer.c ##\n    @@ sequencer.c: static int walk_revs_populate_todo(struct todo_list *todo_list,\n      \t\tsubject_len = find_commit_subject(commit_buffer, &subject);\n      \t\tstrbuf_addf(&todo_list->buf, \"%s %s %.*s\\n\", command_string,\n     -\t\t\tshort_commit_name(commit), subject_len, subject);\n    -+\t\t\tshort_commit_name(opts->revs->repo, commit),\n    ++\t\t\tshort_commit_name(the_repository, commit),\n     +\t\t\tsubject_len, subject);\n      \t\trepo_unuse_commit_buffer(the_repository, commit,\n      \t\t\t\t\t commit_buffer);\n    @@ sequencer.c: static int make_script_with_merges(struct pretty_print_context *pp,\n      \t\t\tif (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS)\n      \t\t\t\twarning(_(\"skipped previously applied commit %s\"),\n     -\t\t\t\t\tshort_commit_name(commit));\n    -+\t\t\t\t\tshort_commit_name(revs->repo, commit));\n    ++\t\t\t\t\tshort_commit_name(the_repository, commit));\n      \t\t\tskipped_commit = 1;\n      \t\t\tcontinue;\n      \t\t}\n 2:  f9068919f9 !  2:  3d0030ed7a sequencer: mark repository argument as unused\n    @@ Commit message\n         sequencer: mark repository argument as unused\n     \n         In sequencer_get_last_command(), we don't ever look at the repository\n    -    parameter. It _should_ be used when calling into git_path_* functions,\n    +    parameter. This is due to ed5b1ca10b (status: do not report errors in\n    +    sequencer/todo, 2019-06-27), which dropped the call to parse_insn_line().\n    +\n    +    However, it _should_ be used when calling into git_path_* functions,\n         but the one we use here is declared with the non-REPO variant of\n         GIT_PATH_FUNC(), and so just uses the_repository internally.\n     \n 3:  cf28e8793a =  3:  deca060ede ref-filter: mark unused parameters in parser callbacks\n 4:  baba1341f3 =  4:  4c15910f4e pack-bitmap: mark unused parameters in show_object callback\n 5:  444d67676b =  5:  9125111e5e worktree: mark unused parameters in each_ref_fn callback\n 6:  4d5fbed1aa !  6:  4e044c1005 commit-graph: mark unused data parameters in generation callbacks\n    @@ Commit message\n         get/set generation operations. Some callers don't need the extra void\n         data pointer, which should be annotated to appease -Wunused-parameter.\n     \n    +    Note that we can drop the assignment of the \"data\" parameter in\n    +    compute_generation_numbers(), as we've just shown that neither of the\n    +    callbacks it uses will access it. This matches the caller in\n    +    ensure_generations_valid(), which already does not bother to set \"data\".\n    +\n         Signed-off-by: Jeff King <peff@peff.net>\n     \n      ## commit-graph.c ##\n    @@ commit-graph.c: static void compute_topological_levels(struct write_commit_graph\n      {\n      \tstruct commit_graph_data *g = commit_graph_data_at(c);\n      \tg->generation = t;\n    +@@ commit-graph.c: static void compute_generation_numbers(struct write_commit_graph_context *ctx)\n    + \t\t.commits = &ctx->commits,\n    + \t\t.get_generation = get_generation_from_graph_data,\n    + \t\t.set_generation = set_generation_v2,\n    +-\t\t.data = ctx,\n    + \t};\n    + \n    + \tif (ctx->report_progress)\n     @@ commit-graph.c: static void compute_generation_numbers(struct write_commit_graph_context *ctx)\n      }\n      \n 7:  b5ad1e7e6a =  7:  8441011ab3 ls-tree: mark unused parameter in callback\n 8:  d0d9fb3c7e =  8:  4ee523564a stash: mark unused parameter in diff callback\n 9:  eefe7daf5d =  9:  21a23b51a9 trace2: mark unused us_elapsed_absolute parameters\n10:  38021bc8ce = 10:  76db35e8f1 trace2: mark unused config callback parameter\n11:  a6eccfab8b = 11:  312c6bd59b test-trace2: mark unused argv/argc parameters\n12:  6d971c4381 = 12:  e74362f5a8 grep: mark unused parameter in output function\n13:  ac7347663c = 13:  a8525ab460 add-interactive: mark unused callback parameters\n14:  d14aab5b51 = 14:  27df60c02f negotiator/noop: mark unused callback parameters\n15:  2d405dc294 = 15:  4eeac4bc33 worktree: mark unused parameters in noop repair callback\n16:  9c1f3b668b = 16:  d81464b1f1 imap-send: mark unused parameters with NO_OPENSSL\n17:  ad63f999b9 = 17:  ea865a1077 grep: mark unused parmaeters in pcre fallbacks\n18:  af414f38fc = 18:  335c42823b credential: mark unused parameter in urlmatch callback\n19:  14694671eb = 19:  f06f36371b fetch: mark unused parameter in ref_transaction callback\n20:  a375abd8fa = 20:  b1fe7e7e34 bundle-uri: mark unused parameters in callbacks\n21:  611dc4d367 = 21:  c9e258e0fa gc: mark unused descriptors in scheduler callbacks\n22:  0ec53b7a46 = 22:  7c2c8fd614 update-ref: mark unused parameter in parser callbacks\n\n  [01/22]: sequencer: use repository parameter in short_commit_name()\n  [02/22]: sequencer: mark repository argument as unused\n  [03/22]: ref-filter: mark unused parameters in parser callbacks\n  [04/22]: pack-bitmap: mark unused parameters in show_object callback\n  [05/22]: worktree: mark unused parameters in each_ref_fn callback\n  [06/22]: commit-graph: mark unused data parameters in generation callbacks\n  [07/22]: ls-tree: mark unused parameter in callback\n  [08/22]: stash: mark unused parameter in diff callback\n  [09/22]: trace2: mark unused us_elapsed_absolute parameters\n  [10/22]: trace2: mark unused config callback parameter\n  [11/22]: test-trace2: mark unused argv/argc parameters\n  [12/22]: grep: mark unused parameter in output function\n  [13/22]: add-interactive: mark unused callback parameters\n  [14/22]: negotiator/noop: mark unused callback parameters\n  [15/22]: worktree: mark unused parameters in noop repair callback\n  [16/22]: imap-send: mark unused parameters with NO_OPENSSL\n  [17/22]: grep: mark unused parmaeters in pcre fallbacks\n  [18/22]: credential: mark unused parameter in urlmatch callback\n  [19/22]: fetch: mark unused parameter in ref_transaction callback\n  [20/22]: bundle-uri: mark unused parameters in callbacks\n  [21/22]: gc: mark unused descriptors in scheduler callbacks\n  [22/22]: update-ref: mark unused parameter in parser callbacks\n\n add-interactive.c       |  8 ++++----\n builtin/fetch.c         |  2 +-\n builtin/gc.c            |  6 +++---\n builtin/ls-tree.c       |  3 ++-\n builtin/stash.c         |  2 +-\n builtin/update-ref.c    | 14 +++++++-------\n builtin/worktree.c      |  8 ++++----\n bundle-uri.c            |  6 +++---\n commit-graph.c          |  9 +++++----\n credential.c            |  4 ++--\n grep.c                  | 12 +++++++-----\n imap-send.c             | 10 ++++++++--\n negotiator/noop.c       | 12 +++++++-----\n pack-bitmap.c           |  5 +++--\n ref-filter.c            |  8 +++++---\n sequencer.c             | 27 ++++++++++++++-------------\n t/helper/test-trace2.c  |  6 +++---\n trace2/tr2_sysenv.c     |  3 ++-\n trace2/tr2_tgt_event.c  | 23 +++++++++++++----------\n trace2/tr2_tgt_normal.c | 20 ++++++++++++--------\n worktree.c              |  6 ++++--\n 21 files changed, 110 insertions(+), 84 deletions(-)\n"},{"id":"481143","messageId":"20230829234339.GA227087@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 01/22] sequencer: use repository parameter in short_commit_name()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:43:39Z","receivedAt":"2023-08-29T23:44:17Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Instead of just using the_repository, we can take a repository parameter\nfrom the caller. Most of them already have one, and doing so clears up a\nfew -Wunused-parameter warnings. There are still a few callers which use\nthe_repository, but this pushes us one small step forward to eventually\ngetting rid of those.\n\nNote that a few of these functions have a \"rev_info\" whose \"repo\"\nparameter could probably be used instead of the_repository. I'm leaving\nthat for further cleanups, as it's not immediately obvious that\nrevs->repo is always valid, and there's quite a bit of other possible\nrefactoring here (even getting rid of some \"struct repository\" arguments\nin favor of revs->repo).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n sequencer.c | 25 +++++++++++++------------\n 1 file changed, 13 insertions(+), 12 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 48475d1cc6..cd5264171a 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -433,10 +433,9 @@ struct commit_message {\n \tconst char *message;\n };\n \n-static const char *short_commit_name(struct commit *commit)\n+static const char *short_commit_name(struct repository *r, struct commit *commit)\n {\n-\treturn repo_find_unique_abbrev(the_repository, &commit->object.oid,\n-\t\t\t\t       DEFAULT_ABBREV);\n+\treturn repo_find_unique_abbrev(r, &commit->object.oid, DEFAULT_ABBREV);\n }\n \n static int get_message(struct commit *commit, struct commit_message *out)\n@@ -446,7 +445,7 @@ static int get_message(struct commit *commit, struct commit_message *out)\n \n \tout->message = repo_logmsg_reencode(the_repository, commit, NULL,\n \t\t\t\t\t    get_commit_output_encoding());\n-\tabbrev = short_commit_name(commit);\n+\tabbrev = short_commit_name(the_repository, commit);\n \n \tsubject_len = find_commit_subject(out->message, &subject);\n \n@@ -2383,7 +2382,7 @@ static int do_pick_commit(struct repository *r,\n \t\terror(command == TODO_REVERT\n \t\t      ? _(\"could not revert %s... %s\")\n \t\t      : _(\"could not apply %s... %s\"),\n-\t\t      short_commit_name(commit), msg.subject);\n+\t\t      short_commit_name(r, commit), msg.subject);\n \t\tprint_advice(r, res == 1, opts);\n \t\trepo_rerere(r, opts->allow_rerere_auto);\n \t\tgoto leave;\n@@ -3172,7 +3171,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list,\n \t\titem->offset_in_buf = todo_list->buf.len;\n \t\tsubject_len = find_commit_subject(commit_buffer, &subject);\n \t\tstrbuf_addf(&todo_list->buf, \"%s %s %.*s\\n\", command_string,\n-\t\t\tshort_commit_name(commit), subject_len, subject);\n+\t\t\tshort_commit_name(the_repository, commit),\n+\t\t\tsubject_len, subject);\n \t\trepo_unuse_commit_buffer(the_repository, commit,\n \t\t\t\t\t commit_buffer);\n \t}\n@@ -3593,7 +3593,7 @@ static int error_with_patch(struct repository *r,\n \t} else if (exit_code) {\n \t\tif (commit)\n \t\t\tfprintf_ln(stderr, _(\"Could not apply %s... %.*s\"),\n-\t\t\t\t   short_commit_name(commit), subject_len, subject);\n+\t\t\t\t   short_commit_name(r, commit), subject_len, subject);\n \t\telse\n \t\t\t/*\n \t\t\t * We don't have the hash of the parent so\n@@ -4728,7 +4728,7 @@ static int pick_commits(struct repository *r,\n \t\t\t\t\t\tterm_clear_line();\n \t\t\t\t\tfprintf(stderr,\n \t\t\t\t\t\t_(\"Stopped at %s...  %.*s\\n\"),\n-\t\t\t\t\t\tshort_commit_name(commit),\n+\t\t\t\t\t\tshort_commit_name(r, commit),\n \t\t\t\t\t\titem->arg_len, arg);\n \t\t\t\t}\n \t\t\t\treturn error_with_patch(r, commit,\n@@ -5564,7 +5564,7 @@ static int make_script_with_merges(struct pretty_print_context *pp,\n \t\tif (!is_empty && (commit->object.flags & PATCHSAME)) {\n \t\t\tif (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS)\n \t\t\t\twarning(_(\"skipped previously applied commit %s\"),\n-\t\t\t\t\tshort_commit_name(commit));\n+\t\t\t\t\tshort_commit_name(the_repository, commit));\n \t\t\tskipped_commit = 1;\n \t\t\tcontinue;\n \t\t}\n@@ -5800,7 +5800,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,\n \t\tif (!is_empty && (commit->object.flags & PATCHSAME)) {\n \t\t\tif (flags & TODO_LIST_WARN_SKIPPED_CHERRY_PICKS)\n \t\t\t\twarning(_(\"skipped previously applied commit %s\"),\n-\t\t\t\t\tshort_commit_name(commit));\n+\t\t\t\t\tshort_commit_name(r, commit));\n \t\t\tskipped_commit = 1;\n \t\t\tcontinue;\n \t\t}\n@@ -5892,7 +5892,8 @@ static void todo_list_add_exec_commands(struct todo_list *todo_list,\n \ttodo_list->alloc = alloc;\n }\n \n-static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_list,\n+static void todo_list_to_strbuf(struct repository *r,\n+\t\t\t\tstruct todo_list *todo_list,\n \t\t\t\tstruct strbuf *buf, int num, unsigned flags)\n {\n \tstruct todo_item *item;\n@@ -5921,7 +5922,7 @@ static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_lis\n \t\t/* add commit id */\n \t\tif (item->commit) {\n \t\t\tconst char *oid = flags & TODO_LIST_SHORTEN_IDS ?\n-\t\t\t\t\t  short_commit_name(item->commit) :\n+\t\t\t\t\t  short_commit_name(r, item->commit) :\n \t\t\t\t\t  oid_to_hex(&item->commit->object.oid);\n \n \t\t\tif (item->command == TODO_FIXUP) {\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481144","messageId":"20230829234423.GB227087@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 02/22] sequencer: mark repository argument as unused","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:44:23Z","receivedAt":"2023-08-29T23:45:23Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"In sequencer_get_last_command(), we don't ever look at the repository\nparameter. This is due to ed5b1ca10b (status: do not report errors in\nsequencer/todo, 2019-06-27), which dropped the call to parse_insn_line().\n\nHowever, it _should_ be used when calling into git_path_* functions,\nbut the one we use here is declared with the non-REPO variant of\nGIT_PATH_FUNC(), and so just uses the_repository internally.\n\nWe could change the path helper to use REPO_GIT_PATH_FUNC(), but doing\nso piecemeal is not great. There are 41 uses of GIT_PATH_FUNC() in\nsequencer.c, and inconsistently switching one makes the code more\nconfusing. Likewise, this one function is used in half a dozen other\nspots, all of which would need to start passing in a repository argument\n(with rippling effects up the call stack).\n\nSo let's punt on that for now and just silence any -Wunused-parameter\nwarning.\n\nNote that we could also drop this parameter entirely, as the function is\nalways called directly, and not as a callback that has to conform to\nsome external interface. But since we'd eventually want to use the\nrepository parameter, let's leave it in place to avoid disrupting the\ncallers twice.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n sequencer.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex cd5264171a..70696d4a65 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -2649,7 +2649,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item,\n \treturn item->commit ? 0 : -1;\n }\n \n-int sequencer_get_last_command(struct repository *r, enum replay_action *action)\n+int sequencer_get_last_command(struct repository *r UNUSED, enum replay_action *action)\n {\n \tconst char *todo_file, *bol;\n \tstruct strbuf buf = STRBUF_INIT;\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481145","messageId":"20230829234506.GA227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 03/22] ref-filter: mark unused parameters in parser callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:06Z","receivedAt":"2023-08-29T23:45:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"These are similar to the cases annotated in 5fe9e1ce2f (ref-filter: mark\nunused callback parameters, 2023-02-24), but were added after that\ncommit.\n\nNote that the ahead/behind callback ignores its \"atom\" parameter, which\nis a little unusual, since that struct usually stores the result. But in\nthis case, the data is stored centrally in ref_array->counts, since we\nwant to compute all ahead/behinds at once, not per ref.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n ref-filter.c | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 1bfaf20fbf..88b021dd1d 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -549,7 +549,8 @@ static int signature_atom_parser(struct ref_format *format UNUSED,\n \treturn 0;\n }\n \n-static int trailers_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int trailers_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t\tstruct used_atom *atom,\n \t\t\t\tconst char *arg, struct strbuf *err)\n {\n \tatom->u.contents.trailer_opts.no_divider = 1;\n@@ -819,7 +820,7 @@ static int if_atom_parser(struct ref_format *format UNUSED,\n \treturn 0;\n }\n \n-static int rest_atom_parser(struct ref_format *format,\n+static int rest_atom_parser(struct ref_format *format UNUSED,\n \t\t\t    struct used_atom *atom UNUSED,\n \t\t\t    const char *arg, struct strbuf *err)\n {\n@@ -828,7 +829,8 @@ static int rest_atom_parser(struct ref_format *format,\n \treturn 0;\n }\n \n-static int ahead_behind_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int ahead_behind_atom_parser(struct ref_format *format,\n+\t\t\t\t    struct used_atom *atom UNUSED,\n \t\t\t\t    const char *arg, struct strbuf *err)\n {\n \tstruct string_list_item *item;\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481146","messageId":"20230829234513.GB227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 04/22] pack-bitmap: mark unused parameters in show_object callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:13Z","receivedAt":"2023-08-29T23:45:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is similar to the cases in c50dca2a18 (list-objects: mark unused\ncallback parameters, 2023-02-24), but was added after that commit.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n pack-bitmap.c | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex 6afc03d1e4..ca8319b87c 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -1101,8 +1101,9 @@ static void show_boundary_commit(struct commit *commit, void *_data)\n \t}\n }\n \n-static void show_boundary_object(struct object *object,\n-\t\t\t\t const char *name, void *data)\n+static void show_boundary_object(struct object *object UNUSED,\n+\t\t\t\t const char *name UNUSED,\n+\t\t\t\t void *data UNUSED)\n {\n \tBUG(\"should not be called\");\n }\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481147","messageId":"20230829234517.GD227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 06/22] commit-graph: mark unused data parameters in generation callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:17Z","receivedAt":"2023-08-29T23:45:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The compute_generation_info code uses function pointers to abstract the\nget/set generation operations. Some callers don't need the extra void\ndata pointer, which should be annotated to appease -Wunused-parameter.\n\nNote that we can drop the assignment of the \"data\" parameter in\ncompute_generation_numbers(), as we've just shown that neither of the\ncallbacks it uses will access it. This matches the caller in\nensure_generations_valid(), which already does not bother to set \"data\".\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n commit-graph.c | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/commit-graph.c b/commit-graph.c\nindex 0aa1640d15..e11f326097 100644\n--- a/commit-graph.c\n+++ b/commit-graph.c\n@@ -1568,12 +1568,14 @@ static void compute_topological_levels(struct write_commit_graph_context *ctx)\n \tstop_progress(&ctx->progress);\n }\n \n-static timestamp_t get_generation_from_graph_data(struct commit *c, void *data)\n+static timestamp_t get_generation_from_graph_data(struct commit *c,\n+\t\t\t\t\t\t  void *data UNUSED)\n {\n \treturn commit_graph_data_at(c)->generation;\n }\n \n-static void set_generation_v2(struct commit *c, timestamp_t t, void *data)\n+static void set_generation_v2(struct commit *c, timestamp_t t,\n+\t\t\t      void *data UNUSED)\n {\n \tstruct commit_graph_data *g = commit_graph_data_at(c);\n \tg->generation = t;\n@@ -1587,7 +1589,6 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)\n \t\t.commits = &ctx->commits,\n \t\t.get_generation = get_generation_from_graph_data,\n \t\t.set_generation = set_generation_v2,\n-\t\t.data = ctx,\n \t};\n \n \tif (ctx->report_progress)\n@@ -1616,7 +1617,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)\n }\n \n static void set_generation_in_graph_data(struct commit *c, timestamp_t t,\n-\t\t\t\t\t void *data)\n+\t\t\t\t\t void *data UNUSED)\n {\n \tcommit_graph_data_at(c)->generation = t;\n }\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481148","messageId":"20230829234519.GE227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 07/22] ls-tree: mark unused parameter in callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:19Z","receivedAt":"2023-08-29T23:45:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The formatting functions are dispatched from a table of function\npointers. The \"path name only\" function unsurprisingly does not need to\nlook at its \"oid\" parameter, but we must mark it as unused to make\n-Wunused-parameter happy.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/ls-tree.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/ls-tree.c b/builtin/ls-tree.c\nindex f558db5f3b..209d2dc0d5 100644\n--- a/builtin/ls-tree.c\n+++ b/builtin/ls-tree.c\n@@ -241,7 +241,8 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,\n \treturn recurse;\n }\n \n-static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,\n+static int show_tree_name_only(const struct object_id *oid UNUSED,\n+\t\t\t       struct strbuf *base,\n \t\t\t       const char *pathname, unsigned mode,\n \t\t\t       void *context)\n {\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481149","messageId":"20230829234515.GC227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 05/22] worktree: mark unused parameters in each_ref_fn callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:15Z","receivedAt":"2023-08-29T23:45:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is similar to the cases in 63e14ee2d6 (refs: mark unused\neach_ref_fn parameters, 2022-08-19), but it was added after that commit.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/worktree.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/worktree.c b/builtin/worktree.c\nindex 10db70b7ec..62b7e26f4b 100644\n--- a/builtin/worktree.c\n+++ b/builtin/worktree.c\n@@ -628,10 +628,10 @@ static void print_preparing_worktree_line(int detach,\n  *\n  * Returns 0 on failure and non-zero on success.\n  */\n-static int first_valid_ref(const char *refname,\n-\t\t\t   const struct object_id *oid,\n-\t\t\t   int flags,\n-\t\t\t   void *cb_data)\n+static int first_valid_ref(const char *refname UNUSED,\n+\t\t\t   const struct object_id *oid UNUSED,\n+\t\t\t   int flags UNUSED,\n+\t\t\t   void *cb_data UNUSED)\n {\n \treturn 1;\n }\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481150","messageId":"20230829234520.GF227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 08/22] stash: mark unused parameter in diff callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:20Z","receivedAt":"2023-08-29T23:46:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is similar to the cases in 61bdc7c5d8 (diff: mark unused parameters\nin callbacks, 2022-12-13), but I missed it when making that commit.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/stash.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/stash.c b/builtin/stash.c\nindex fe64cde9ce..c9365bea13 100644\n--- a/builtin/stash.c\n+++ b/builtin/stash.c\n@@ -362,7 +362,7 @@ static int is_path_a_directory(const char *path)\n }\n \n static void add_diff_to_buf(struct diff_queue_struct *q,\n-\t\t\t    struct diff_options *options,\n+\t\t\t    struct diff_options *options UNUSED,\n \t\t\t    void *data)\n {\n \tint i;\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481151","messageId":"20230829234523.GH227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 10/22] trace2: mark unused config callback parameter","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:23Z","receivedAt":"2023-08-29T23:46:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This should have been part of 783a86c142 (config: mark unused callback\nparameters, 2022-08-19), but was missed in that commit.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n trace2/tr2_sysenv.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/trace2/tr2_sysenv.c b/trace2/tr2_sysenv.c\nindex f26ec95ab4..d3ecac2772 100644\n--- a/trace2/tr2_sysenv.c\n+++ b/trace2/tr2_sysenv.c\n@@ -58,7 +58,8 @@ static struct tr2_sysenv_entry tr2_sysenv_settings[] = {\n /* clang-format on */\n \n static int tr2_sysenv_cb(const char *key, const char *value,\n-\t\t\t const struct config_context *ctx UNUSED, void *d)\n+\t\t\t const struct config_context *ctx UNUSED,\n+\t\t\t void *d UNUSED)\n {\n \tint k;\n \n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481152","messageId":"20230829234522.GG227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 09/22] trace2: mark unused us_elapsed_absolute parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:22Z","receivedAt":"2023-08-29T23:46:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Many trace2 targets ignore the absolute elapsed time parameters.\nHowever, the virtual interface needs to retain the parameter since it is\nused by others (e.g., the perf target).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n trace2/tr2_tgt_event.c  | 23 +++++++++++++----------\n trace2/tr2_tgt_normal.c | 20 ++++++++++++--------\n 2 files changed, 25 insertions(+), 18 deletions(-)\n\ndiff --git a/trace2/tr2_tgt_event.c b/trace2/tr2_tgt_event.c\nindex 53091781ec..59910a1a4f 100644\n--- a/trace2/tr2_tgt_event.c\n+++ b/trace2/tr2_tgt_event.c\n@@ -335,7 +335,7 @@ static void fn_alias_fl(const char *file, int line, const char *alias,\n }\n \n static void fn_child_start_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n \t\t\t      const struct child_process *cmd)\n {\n \tconst char *event_name = \"child_start\";\n@@ -367,7 +367,8 @@ static void fn_child_start_fl(const char *file, int line,\n }\n \n static void fn_child_exit_fl(const char *file, int line,\n-\t\t\t     uint64_t us_elapsed_absolute, int cid, int pid,\n+\t\t\t     uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t     int cid, int pid,\n \t\t\t     int code, uint64_t us_elapsed_child)\n {\n \tconst char *event_name = \"child_exit\";\n@@ -388,7 +389,8 @@ static void fn_child_exit_fl(const char *file, int line,\n }\n \n static void fn_child_ready_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute, int cid, int pid,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t      int cid, int pid,\n \t\t\t      const char *ready, uint64_t us_elapsed_child)\n {\n \tconst char *event_name = \"child_ready\";\n@@ -409,7 +411,7 @@ static void fn_child_ready_fl(const char *file, int line,\n }\n \n static void fn_thread_start_fl(const char *file, int line,\n-\t\t\t       uint64_t us_elapsed_absolute)\n+\t\t\t       uint64_t us_elapsed_absolute UNUSED)\n {\n \tconst char *event_name = \"thread_start\";\n \tstruct json_writer jw = JSON_WRITER_INIT;\n@@ -423,7 +425,7 @@ static void fn_thread_start_fl(const char *file, int line,\n }\n \n static void fn_thread_exit_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n \t\t\t      uint64_t us_elapsed_thread)\n {\n \tconst char *event_name = \"thread_exit\";\n@@ -439,7 +441,8 @@ static void fn_thread_exit_fl(const char *file, int line,\n \tjw_release(&jw);\n }\n \n-static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,\n+static void fn_exec_fl(const char *file, int line,\n+\t\t       uint64_t us_elapsed_absolute UNUSED,\n \t\t       int exec_id, const char *exe, const char **argv)\n {\n \tconst char *event_name = \"exec\";\n@@ -460,8 +463,8 @@ static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,\n }\n \n static void fn_exec_result_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute, int exec_id,\n-\t\t\t      int code)\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t      int exec_id, int code)\n {\n \tconst char *event_name = \"exec_result\";\n \tstruct json_writer jw = JSON_WRITER_INIT;\n@@ -511,7 +514,7 @@ static void fn_repo_fl(const char *file, int line,\n }\n \n static void fn_region_enter_printf_va_fl(const char *file, int line,\n-\t\t\t\t\t uint64_t us_elapsed_absolute,\n+\t\t\t\t\t uint64_t us_elapsed_absolute UNUSED,\n \t\t\t\t\t const char *category,\n \t\t\t\t\t const char *label,\n \t\t\t\t\t const struct repository *repo,\n@@ -538,7 +541,7 @@ static void fn_region_enter_printf_va_fl(const char *file, int line,\n }\n \n static void fn_region_leave_printf_va_fl(\n-\tconst char *file, int line, uint64_t us_elapsed_absolute,\n+\tconst char *file, int line, uint64_t us_elapsed_absolute UNUSED,\n \tuint64_t us_elapsed_region, const char *category, const char *label,\n \tconst struct repository *repo, const char *fmt, va_list ap)\n {\ndiff --git a/trace2/tr2_tgt_normal.c b/trace2/tr2_tgt_normal.c\nindex d25ea13164..38d5ebddf6 100644\n--- a/trace2/tr2_tgt_normal.c\n+++ b/trace2/tr2_tgt_normal.c\n@@ -86,7 +86,7 @@ static void fn_version_fl(const char *file, int line)\n }\n \n static void fn_start_fl(const char *file, int line,\n-\t\t\tuint64_t us_elapsed_absolute, const char **argv)\n+\t\t\tuint64_t us_elapsed_absolute UNUSED, const char **argv)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n \n@@ -215,7 +215,7 @@ static void fn_alias_fl(const char *file, int line, const char *alias,\n }\n \n static void fn_child_start_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n \t\t\t      const struct child_process *cmd)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n@@ -243,7 +243,8 @@ static void fn_child_start_fl(const char *file, int line,\n }\n \n static void fn_child_exit_fl(const char *file, int line,\n-\t\t\t     uint64_t us_elapsed_absolute, int cid, int pid,\n+\t\t\t     uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t     int cid, int pid,\n \t\t\t     int code, uint64_t us_elapsed_child)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n@@ -256,7 +257,8 @@ static void fn_child_exit_fl(const char *file, int line,\n }\n \n static void fn_child_ready_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute, int cid, int pid,\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t      int cid, int pid,\n \t\t\t      const char *ready, uint64_t us_elapsed_child)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n@@ -268,7 +270,8 @@ static void fn_child_ready_fl(const char *file, int line,\n \tstrbuf_release(&buf_payload);\n }\n \n-static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,\n+static void fn_exec_fl(const char *file, int line,\n+\t\t       uint64_t us_elapsed_absolute UNUSED,\n \t\t       int exec_id, const char *exe, const char **argv)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n@@ -284,8 +287,8 @@ static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,\n }\n \n static void fn_exec_result_fl(const char *file, int line,\n-\t\t\t      uint64_t us_elapsed_absolute, int exec_id,\n-\t\t\t      int code)\n+\t\t\t      uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t      int exec_id, int code)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n \n@@ -321,7 +324,8 @@ static void fn_repo_fl(const char *file, int line,\n }\n \n static void fn_printf_va_fl(const char *file, int line,\n-\t\t\t    uint64_t us_elapsed_absolute, const char *fmt,\n+\t\t\t    uint64_t us_elapsed_absolute UNUSED,\n+\t\t\t    const char *fmt,\n \t\t\t    va_list ap)\n {\n \tstruct strbuf buf_payload = STRBUF_INIT;\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481153","messageId":"20230829234525.GI227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 11/22] test-trace2: mark unused argv/argc parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:25Z","receivedAt":"2023-08-29T23:46:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The trace2 test helper uses function pointers to dispatch to individual\ntests. Not all tests bother looking at their argv/argc parameters. We\ncould tighten this up (e.g., complaining when seeing unexpected\nparameters), but for internal test code it's not worth worrying about.\n\nThis is similar in spirit to 126e3b3d2a (t/helper: mark unused argv/argc\narguments, 2023-03-28).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/helper/test-trace2.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c\nindex 20c7495f38..d5ca0046c8 100644\n--- a/t/helper/test-trace2.c\n+++ b/t/helper/test-trace2.c\n@@ -45,7 +45,7 @@ static int get_i(int *p_value, const char *data)\n  * [] \"def_param\" events for all of the \"interesting\" pre-defined\n  * config settings.\n  */\n-static int ut_001return(int argc, const char **argv)\n+static int ut_001return(int argc UNUSED, const char **argv)\n {\n \tint rc;\n \n@@ -65,7 +65,7 @@ static int ut_001return(int argc, const char **argv)\n  * [] \"def_param\" events for all of the \"interesting\" pre-defined\n  * config settings.\n  */\n-static int ut_002exit(int argc, const char **argv)\n+static int ut_002exit(int argc UNUSED, const char **argv)\n {\n \tint rc;\n \n@@ -201,7 +201,7 @@ static int ut_006data(int argc, const char **argv)\n \treturn 0;\n }\n \n-static int ut_007BUG(int argc, const char **argv)\n+static int ut_007BUG(int argc UNUSED, const char **argv UNUSED)\n {\n \t/*\n \t * Exercise BUG() to ensure that the message is printed to trace2.\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481154","messageId":"20230829234527.GJ227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 12/22] grep: mark unused parameter in output function","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:27Z","receivedAt":"2023-08-29T23:46:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This is a callback used with grep_options.output, but we don't look at\nthe grep_opt parameter, as we're just writing the output to stdout.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n grep.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/grep.c b/grep.c\nindex 0904d55b24..0124eb1960 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -17,7 +17,7 @@ static int grep_source_load(struct grep_source *gs);\n static int grep_source_is_binary(struct grep_source *gs,\n \t\t\t\t struct index_state *istate);\n \n-static void std_output(struct grep_opt *opt, const void *buf, size_t size)\n+static void std_output(struct grep_opt *opt UNUSED, const void *buf, size_t size)\n {\n \tfwrite(buf, size, 1, stdout);\n }\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481155","messageId":"20230829234528.GK227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 13/22] add-interactive: mark unused callback parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:28Z","receivedAt":"2023-08-29T23:46:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The interactive commands are dispatched from a table of abstract\npointers, but not every command uses every parameter it receives. Mark\nthe unused ones to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n add-interactive.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/add-interactive.c b/add-interactive.c\nindex add9a1ad43..852e8e6b2f 100644\n--- a/add-interactive.c\n+++ b/add-interactive.c\n@@ -1021,9 +1021,9 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,\n \treturn res;\n }\n \n-static int run_help(struct add_i_state *s, const struct pathspec *unused_ps,\n-\t\t    struct prefix_item_list *unused_files,\n-\t\t    struct list_and_choose_options *unused_opts)\n+static int run_help(struct add_i_state *s, const struct pathspec *ps UNUSED,\n+\t\t    struct prefix_item_list *files UNUSED,\n+\t\t    struct list_and_choose_options *opts UNUSED)\n {\n \tcolor_fprintf_ln(stdout, s->help_color, \"status        - %s\",\n \t\t\t _(\"show paths with changes\"));\n@@ -1074,7 +1074,7 @@ struct print_command_item_data {\n \tconst char *color, *reset;\n };\n \n-static void print_command_item(int i, int selected,\n+static void print_command_item(int i, int selected UNUSED,\n \t\t\t       struct string_list_item *item,\n \t\t\t       void *print_command_item_data)\n {\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481156","messageId":"20230829234530.GL227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 14/22] negotiator/noop: mark unused callback parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:30Z","receivedAt":"2023-08-29T23:46:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The noop negotiator unsurprisingly does not bother looking at any of its\nparameters. Mark them unused to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n negotiator/noop.c | 12 +++++++-----\n 1 file changed, 7 insertions(+), 5 deletions(-)\n\ndiff --git a/negotiator/noop.c b/negotiator/noop.c\nindex 7b72937686..de39028ab7 100644\n--- a/negotiator/noop.c\n+++ b/negotiator/noop.c\n@@ -3,22 +3,24 @@\n #include \"../commit.h\"\n #include \"../fetch-negotiator.h\"\n \n-static void known_common(struct fetch_negotiator *n, struct commit *c)\n+static void known_common(struct fetch_negotiator *n UNUSED,\n+\t\t\t struct commit *c UNUSED)\n {\n \t/* do nothing */\n }\n \n-static void add_tip(struct fetch_negotiator *n, struct commit *c)\n+static void add_tip(struct fetch_negotiator *n UNUSED,\n+\t\t    struct commit *c UNUSED)\n {\n \t/* do nothing */\n }\n \n-static const struct object_id *next(struct fetch_negotiator *n)\n+static const struct object_id *next(struct fetch_negotiator *n UNUSED)\n {\n \treturn NULL;\n }\n \n-static int ack(struct fetch_negotiator *n, struct commit *c)\n+static int ack(struct fetch_negotiator *n UNUSED, struct commit *c UNUSED)\n {\n \t/*\n \t * This negotiator does not emit any commits, so there is no commit to\n@@ -28,7 +30,7 @@ static int ack(struct fetch_negotiator *n, struct commit *c)\n \treturn 0;\n }\n \n-static void release(struct fetch_negotiator *n)\n+static void release(struct fetch_negotiator *n UNUSED)\n {\n \t/* nothing to release */\n }\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481157","messageId":"20230829234531.GM227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 15/22] worktree: mark unused parameters in noop repair callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:31Z","receivedAt":"2023-08-29T23:46:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The noop repair callback unsurprisingly does not look at any of its\nparameters. Mark them as unused to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n worktree.c | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/worktree.c b/worktree.c\nindex b8cf29e6a1..a56a6c2a3d 100644\n--- a/worktree.c\n+++ b/worktree.c\n@@ -581,8 +581,10 @@ static void repair_gitfile(struct worktree *wt,\n \tstrbuf_release(&dotgit);\n }\n \n-static void repair_noop(int iserr, const char *path, const char *msg,\n-\t\t\tvoid *cb_data)\n+static void repair_noop(int iserr UNUSED,\n+\t\t\tconst char *path UNUSED,\n+\t\t\tconst char *msg UNUSED,\n+\t\t\tvoid *cb_data UNUSED)\n {\n \t/* nothing */\n }\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481161","messageId":"20230829234533.GN227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 16/22] imap-send: mark unused parameters with NO_OPENSSL","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:33Z","receivedAt":"2023-08-29T23:46:59Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Earlier patches annotating unused parameters in imap-send missed a few\ncases in code that is compiled only with NO_OPENSSL. These need to\nretain the extra parameters to match the interfaces used when we compile\nwith openssl support.\n\nNote in the case of socket_perror() that the function declaration and\nparts of its code are shared between the two cases, and only the openssl\ncode looks at \"sock\". So we can't simply mark the parameter as always\nunused. Instead, we can add a noop statement that references it. This is\nugly, but should be portable.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n imap-send.c | 10 ++++++++--\n 1 file changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 06386e0b3b..996651e4f8 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -206,10 +206,14 @@ static void socket_perror(const char *func, struct imap_socket *sock, int ret)\n \t\telse\n \t\t\tfprintf(stderr, \"%s: unexpected EOF\\n\", func);\n \t}\n+\t/* mark as used to appease -Wunused-parameter with NO_OPENSSL */\n+\t(void)sock;\n }\n \n #ifdef NO_OPENSSL\n-static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int verify)\n+static int ssl_socket_connect(struct imap_socket *sock UNUSED,\n+\t\t\t      int use_tls_only UNUSED,\n+\t\t\t      int verify UNUSED)\n {\n \tfprintf(stderr, \"SSL requested but SSL support not compiled in\\n\");\n \treturn -1;\n@@ -904,7 +908,9 @@ static char *cram(const char *challenge_64, const char *user, const char *pass)\n \n #else\n \n-static char *cram(const char *challenge_64, const char *user, const char *pass)\n+static char *cram(const char *challenge_64 UNUSED,\n+\t\t  const char *user UNUSED,\n+\t\t  const char *pass UNUSED)\n {\n \tdie(\"If you want to use CRAM-MD5 authenticate method, \"\n \t    \"you have to build git-imap-send with OpenSSL library.\");\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481158","messageId":"20230829234534.GO227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 17/22] grep: mark unused parmaeters in pcre fallbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:34Z","receivedAt":"2023-08-29T23:47:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"When USE_LIBPCRE2 is not defined, we compile several noop fallbacks.\nThese need to have their parameters annotated to avoid\n-Wunused-parameter warnings (and obviously we cannot remove the\nparameters, since the functions must match the non-fallback versions).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n grep.c | 10 ++++++----\n 1 file changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/grep.c b/grep.c\nindex 0124eb1960..fc2d0c837a 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -452,18 +452,20 @@ static void free_pcre2_pattern(struct grep_pat *p)\n \tpcre2_general_context_free(p->pcre2_general_context);\n }\n #else /* !USE_LIBPCRE2 */\n-static void compile_pcre2_pattern(struct grep_pat *p, const struct grep_opt *opt)\n+static void compile_pcre2_pattern(struct grep_pat *p UNUSED,\n+\t\t\t\t  const struct grep_opt *opt UNUSED)\n {\n \tdie(\"cannot use Perl-compatible regexes when not compiled with USE_LIBPCRE\");\n }\n \n-static int pcre2match(struct grep_pat *p, const char *line, const char *eol,\n-\t\tregmatch_t *match, int eflags)\n+static int pcre2match(struct grep_pat *p UNUSED, const char *line UNUSED,\n+\t\t      const char *eol UNUSED, regmatch_t *match UNUSED,\n+\t\t      int eflags UNUSED)\n {\n \treturn 1;\n }\n \n-static void free_pcre2_pattern(struct grep_pat *p)\n+static void free_pcre2_pattern(struct grep_pat *p UNUSED)\n {\n }\n \n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481159","messageId":"20230829234537.GQ227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 19/22] fetch: mark unused parameter in ref_transaction callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:37Z","receivedAt":"2023-08-29T23:47:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Since this callback is just trying to collect the set of queued tag\nupdates, there is no need for it to look at old_oid at all. Mark it as\nunused to appease -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/fetch.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex eed4a7cdb6..8f93529505 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -308,7 +308,7 @@ static void clear_item(struct refname_hash_entry *item)\n \n \n static void add_already_queued_tags(const char *refname,\n-\t\t\t\t    const struct object_id *old_oid,\n+\t\t\t\t    const struct object_id *old_oid UNUSED,\n \t\t\t\t    const struct object_id *new_oid,\n \t\t\t\t    void *cb_data)\n {\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481160","messageId":"20230829234536.GP227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 18/22] credential: mark unused parameter in urlmatch callback","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:36Z","receivedAt":"2023-08-29T23:47:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Our select_all() callback does not need to actually look at its\nparameters, since the point is to match everything. But we need to mark\nits parameters to satisfy -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n credential.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/credential.c b/credential.c\nindex d664754163..18098bd35e 100644\n--- a/credential.c\n+++ b/credential.c\n@@ -88,8 +88,8 @@ static int proto_is_http(const char *s)\n static void credential_describe(struct credential *c, struct strbuf *out);\n static void credential_format(struct credential *c, struct strbuf *out);\n \n-static int select_all(const struct urlmatch_item *a,\n-\t\t      const struct urlmatch_item *b)\n+static int select_all(const struct urlmatch_item *a UNUSED,\n+\t\t      const struct urlmatch_item *b UNUSED)\n {\n \treturn 0;\n }\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481162","messageId":"20230829234540.GS227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 21/22] gc: mark unused descriptors in scheduler callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:40Z","receivedAt":"2023-08-29T23:47:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Each of the scheduler update callbacks gets the descriptor of the lock\nfile, but only the crontab updater needs it. We have to retain the\nunused descriptors because these are dispatched from a table of function\npointers, but we should mark them to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/gc.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 1f53b66c7b..369bd43fb2 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -1934,7 +1934,7 @@ static int launchctl_add_plists(void)\n \t       launchctl_schedule_plist(exec_path, SCHEDULE_WEEKLY);\n }\n \n-static int launchctl_update_schedule(int run_maintenance, int fd)\n+static int launchctl_update_schedule(int run_maintenance, int fd UNUSED)\n {\n \tif (run_maintenance)\n \t\treturn launchctl_add_plists();\n@@ -2115,7 +2115,7 @@ static int schtasks_schedule_tasks(void)\n \t       schtasks_schedule_task(exec_path, SCHEDULE_WEEKLY);\n }\n \n-static int schtasks_update_schedule(int run_maintenance, int fd)\n+static int schtasks_update_schedule(int run_maintenance, int fd UNUSED)\n {\n \tif (run_maintenance)\n \t\treturn schtasks_schedule_tasks();\n@@ -2556,7 +2556,7 @@ static int systemd_timer_setup_units(void)\n \treturn ret;\n }\n \n-static int systemd_timer_update_schedule(int run_maintenance, int fd)\n+static int systemd_timer_update_schedule(int run_maintenance, int fd UNUSED)\n {\n \tif (run_maintenance)\n \t\treturn systemd_timer_setup_units();\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481163","messageId":"20230829234539.GR227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 20/22] bundle-uri: mark unused parameters in callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:39Z","receivedAt":"2023-08-29T23:47:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The first hunk is similar to 02c3c59e62 (hashmap: mark unused callback\nparameters, 2022-08-19), but was added after that commit.\n\nThe other two are used with for_all_bundles_in_list(), but don't use\ntheir void data pointer.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n bundle-uri.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 4b5c49b93d..8492fffd2f 100644\n--- a/bundle-uri.c\n+++ b/bundle-uri.c\n@@ -20,7 +20,7 @@ static struct {\n \t{ BUNDLE_HEURISTIC_CREATIONTOKEN, \"creationToken\" },\n };\n \n-static int compare_bundles(const void *hashmap_cmp_fn_data,\n+static int compare_bundles(const void *hashmap_cmp_fn_data UNUSED,\n \t\t\t   const struct hashmap_entry *he1,\n \t\t\t   const struct hashmap_entry *he2,\n \t\t\t   const void *id)\n@@ -45,7 +45,7 @@ void init_bundle_list(struct bundle_list *list)\n }\n \n static int clear_remote_bundle_info(struct remote_bundle_info *bundle,\n-\t\t\t\t    void *data)\n+\t\t\t\t    void *data UNUSED)\n {\n \tFREE_AND_NULL(bundle->id);\n \tFREE_AND_NULL(bundle->uri);\n@@ -779,7 +779,7 @@ static int unbundle_all_bundles(struct repository *r,\n \treturn 0;\n }\n \n-static int unlink_bundle(struct remote_bundle_info *info, void *data)\n+static int unlink_bundle(struct remote_bundle_info *info, void *data UNUSED)\n {\n \tif (info->file)\n \t\tunlink_or_warn(info->file);\n-- \n2.42.0.528.g7950723a09\n\n"},{"id":"481164","messageId":"20230829234542.GT227214@coredump.intra.peff.net","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"[PATCH v2 22/22] update-ref: mark unused parameter in parser callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-08-29T23:45:42Z","receivedAt":"2023-08-29T23:47:00Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The parsing of stdin is driven by a table of function pointers; mark\nunused parameters in concrete functions to avoid -Wunused-parameter\nwarnings.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/update-ref.c | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/update-ref.c b/builtin/update-ref.c\nindex 242102273e..c0c4e65e6f 100644\n--- a/builtin/update-ref.c\n+++ b/builtin/update-ref.c\n@@ -311,8 +311,8 @@ static void report_ok(const char *command)\n \tfflush(stdout);\n }\n \n-static void parse_cmd_option(struct ref_transaction *transaction,\n-\t\t\t     const char *next, const char *end)\n+static void parse_cmd_option(struct ref_transaction *transaction UNUSED,\n+\t\t\t     const char *next, const char *end UNUSED)\n {\n \tconst char *rest;\n \tif (skip_prefix(next, \"no-deref\", &rest) && *rest == line_termination)\n@@ -321,16 +321,16 @@ static void parse_cmd_option(struct ref_transaction *transaction,\n \t\tdie(\"option unknown: %s\", next);\n }\n \n-static void parse_cmd_start(struct ref_transaction *transaction,\n-\t\t\t    const char *next, const char *end)\n+static void parse_cmd_start(struct ref_transaction *transaction UNUSED,\n+\t\t\t    const char *next, const char *end UNUSED)\n {\n \tif (*next != line_termination)\n \t\tdie(\"start: extra input: %s\", next);\n \treport_ok(\"start\");\n }\n \n static void parse_cmd_prepare(struct ref_transaction *transaction,\n-\t\t\t      const char *next, const char *end)\n+\t\t\t      const char *next, const char *end UNUSED)\n {\n \tstruct strbuf error = STRBUF_INIT;\n \tif (*next != line_termination)\n@@ -341,7 +341,7 @@ static void parse_cmd_prepare(struct ref_transaction *transaction,\n }\n \n static void parse_cmd_abort(struct ref_transaction *transaction,\n-\t\t\t    const char *next, const char *end)\n+\t\t\t    const char *next, const char *end UNUSED)\n {\n \tstruct strbuf error = STRBUF_INIT;\n \tif (*next != line_termination)\n@@ -352,7 +352,7 @@ static void parse_cmd_abort(struct ref_transaction *transaction,\n }\n \n static void parse_cmd_commit(struct ref_transaction *transaction,\n-\t\t\t     const char *next, const char *end)\n+\t\t\t     const char *next, const char *end UNUSED)\n {\n \tstruct strbuf error = STRBUF_INIT;\n \tif (*next != line_termination)\n-- \n2.42.0.528.g7950723a09\n"},{"id":"481168","messageId":"xmqqwmxd9wf9.fsf@gitster.g","threadId":"60161","inReplyTo":"20230829234305.GA226944@coredump.intra.peff.net","subject":"Re: [PATCH v2 0/22] Yet Another Unused Parameter Series","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-08-30T01:00:10Z","receivedAt":"2023-08-30T01:00:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Aug 28, 2023 at 05:46:04PM -0400, Jeff King wrote:\n>\n>> I'm back with another exciting installment of -Wunused-parameter warning\n>> fixes. Most of these are pretty boring and obvious; the first two are\n>> the most interesting in terms of rationale.\n>> \n>> I promise we're closing in on the finish line here. I only have about 20\n>> patches left after this, at which point we should be able to turn on the\n>> warning by default for developer builds.\n>\n> And here's a v2 based on feedback from round 1. The changes are small,\n> so I'll let the range-diff below speak for itself.\n\nThe first one in this round is consistently more conservative\ncompared to the previous round, which is very nice.\n\nAll other updates do look good, too.\n\nWill replace.  Thanks.\n"},{"id":"481177","messageId":"2ad36ef4-4bfa-4e2a-956e-a25d80ce25fd@gmail.com","threadId":"60161","inReplyTo":"20230829234339.GA227087@coredump.intra.peff.net","subject":"Re: [PATCH v2 01/22] sequencer: use repository parameter in short_commit_name()","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2023-08-30T13:24:12Z","receivedAt":"2023-08-30T18:29:30Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 30/08/2023 00:43, Jeff King wrote:\n> Instead of just using the_repository, we can take a repository parameter\n> from the caller. Most of them already have one, and doing so clears up a\n> few -Wunused-parameter warnings. There are still a few callers which use\n> the_repository, but this pushes us one small step forward to eventually\n> getting rid of those.\n> \n> Note that a few of these functions have a \"rev_info\" whose \"repo\"\n> parameter could probably be used instead of the_repository. I'm leaving\n> that for further cleanups, as it's not immediately obvious that\n> revs->repo is always valid, and there's quite a bit of other possible\n> refactoring here (even getting rid of some \"struct repository\" arguments\n> in favor of revs->repo).\n\nI think opts->revs is only initialized when we're building to todo list \nfor cherry-picking/reverting a sequence of commits so I the scope for \nremoving \"struct repository\" arguments is pretty limited as any function \nthat is called by \"cherry-pick --continue\" or rebase needs a separate \nrepository argument. I'm pretty sure your v1 was safe but this version \nis much more obviously safe.\n\nBest Wishes\n\nPhillip\n\n"},{"id":"481192","messageId":"48d7763b-2661-48af-8e64-00178de612ed@gmail.com","threadId":"60161","inReplyTo":"20230829233252.GA225495@coredump.intra.peff.net","subject":"Re: [PATCH 02/22] sequencer: mark repository argument as unused","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2023-08-30T13:35:07Z","receivedAt":"2023-08-30T18:30:01Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 30/08/2023 00:32, Jeff King wrote:\n> On Tue, Aug 29, 2023 at 04:55:30PM +0100, Phillip Wood wrote:\n> \n>>> We could change the path helper to use REPO_GIT_PATH_FUNC(), but doing\n>>> so piecemeal is not great. There are 41 uses of GIT_PATH_FUNC() in\n>>> sequencer.c,\n>>\n>> Wow, I knew there were quite a few but I hadn't realized there were that\n>> many. Changing them all to take a struct repository will be a big change and\n>> will make struct repo_cache_path a lot larger.\n> \n> Yeah. One of the things that gave me pause is that some of them may need\n> to be renamed, as well. Most of the existing ones are static local\n> within sequencer.c, so names like git_path_head_file() are OK. But\n> REPO_GIT_PATH_FUNC() requires a pointer in the global repo_cache_path,\n> so the names need to be appropriate for a global view.\n\nIt's definitely worth leaving that for a separate patch series. A lot of \nthe paths start rebase_path_... (I think it is only the paths used by \ncherry-pick/revert that start git_path_...) so we'd need a separate \nmacro unless we renamed them. Having a different prefix is probably a \ngood thing for making them global functions but it still leaves the \nproblem of renaming the ones like git_path_head_file().\n\nBest Wishes\n\nPhillip\n"}]}