{"thread":{"id":"59301","subject":"[PATCH 0/21] more -Wunused-parameter fixes","startedAt":"2023-02-24T06:34:25Z","lastAt":"2023-02-24T17:59:40Z","messageCount":24,"participants":["Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":21},"messages":[{"id":"472617","messageId":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","threadId":"59301","inReplyTo":null,"subject":"[PATCH 0/21] more -Wunused-parameter fixes","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:34:21Z","receivedAt":"2023-02-24T06:34:25Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"I've been sitting on this series for a while, waiting for a moment when\nI didn't have a backlog of other topics I ought to be reviewing. But it\nseems like that never happens, so I thought I'd just send it. :) Nothing\nurgent, of course, but this takes us a few steps closer to being able to\nturn on -Wunused-parameter all the time.\n\nI've tried to float the more interesting patches to the top. The later\nones are mostly \"yep, this callback needs to marked with UNUSED\".\n\n-Peff\n\n  [01/21]: ref-filter: drop unused atom parameter from get_worktree_path()\n  [02/21]: ls-refs: drop config caching\n  [03/21]: serve: use repository pointer to get config\n  [04/21]: serve: mark unused parameters in virtual functions\n  [05/21]: object-name: mark unused parameters in disambiguate callbacks\n  [06/21]: http-backend: mark argc/argv unused\n  [07/21]: http-backend: mark unused parameters in virtual functions\n  [08/21]: ref-filter: mark unused callback parameters\n  [09/21]: mark \"pointless\" data pointers in callbacks\n  [10/21]: run-command: mark error routine parameters as unused\n  [11/21]: mark unused parameters in signal handlers\n  [12/21]: list-objects: mark unused callback parameters\n  [13/21]: for_each_object: mark unused callback parameters\n  [14/21]: prio-queue: mark unused parameters in comparison functions\n  [15/21]: notes: mark unused callback parameters\n  [16/21]: fetch-pack: mark unused parameter in callback function\n  [17/21]: rewrite_parents(): mark unused callback parameter\n  [18/21]: for_each_commit_graft(): mark unused callback parameter\n  [19/21]: userformat_want_item(): mark unused parameter\n  [20/21]: run_processes_parallel: mark unused callback parameters\n  [21/21]: help: mark unused parameter in git_unknown_cmd_config()\n\n builtin/cat-file.c          |  8 ++---\n builtin/count-objects.c     |  6 ++--\n builtin/fast-import.c       |  2 +-\n builtin/fetch.c             |  6 ++--\n builtin/fsck.c              | 25 +++++++-------\n builtin/gc.c                | 14 ++++----\n builtin/log.c               |  2 +-\n builtin/notes.c             |  5 +--\n builtin/pack-objects.c      | 26 ++++++++-------\n builtin/prune.c             |  6 ++--\n builtin/repack.c            |  5 +--\n builtin/rev-list.c          | 13 ++++----\n builtin/submodule--helper.c |  4 +--\n bundle-uri.c                |  2 +-\n commit.c                    |  6 ++--\n daemon.c                    |  2 +-\n diagnose.c                  |  3 +-\n fetch-pack.c                |  2 +-\n help.c                      |  3 +-\n hook.c                      | 12 +++----\n http-backend.c              |  8 ++---\n line-log.c                  |  3 +-\n log-tree.c                  |  3 +-\n ls-refs.c                   | 36 ++++++++------------\n midx.c                      |  2 +-\n negotiator/skipping.c       |  2 +-\n notes.c                     | 11 ++++---\n object-file.c               |  3 +-\n object-name.c               | 14 ++++----\n pack-bitmap.c               |  6 ++--\n packfile.c                  |  4 +--\n path.c                      |  3 +-\n pretty.c                    |  3 +-\n progress.c                  |  2 +-\n reachable.c                 | 15 +++++----\n ref-filter.c                | 66 +++++++++++++++++++++++--------------\n revision.c                  |  6 ++--\n run-command.c               |  6 ++--\n serve.c                     | 12 +++----\n submodule.c                 |  4 +--\n t/helper/test-prio-queue.c  |  2 +-\n t/helper/test-run-command.c | 14 ++++----\n upload-pack.c               | 10 +++---\n 43 files changed, 211 insertions(+), 176 deletions(-)\n\n"},{"id":"472618","messageId":"Y/hahKMhm4EYz3Pf@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 01/21] ref-filter: drop unused atom parameter from get_worktree_path()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:34:44Z","receivedAt":"2023-02-24T06:34:50Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The get_worktree_path() function is used to populate the %(worktreepath)\nvalue, but it has never used its \"atom\" parameter since it was added in\n2582083fa1 (ref-filter: add worktreepath atom, 2019-04-28).\n\nNormally we'd use the atom struct to cache any work we do, but in this\ncase there's a global hashmap that does that caching already. So we can\njust drop the unused parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n ref-filter.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/ref-filter.c b/ref-filter.c\nindex f8203c6b05..434a28c830 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -1822,7 +1822,7 @@ static void lazy_init_worktree_map(void)\n \tpopulate_worktree_map(&(ref_to_worktree_map.map), ref_to_worktree_map.worktrees);\n }\n \n-static char *get_worktree_path(const struct used_atom *atom, const struct ref_array_item *ref)\n+static char *get_worktree_path(const struct ref_array_item *ref)\n {\n \tstruct hashmap_entry entry, *e;\n \tstruct ref_to_worktree_entry *lookup_result;\n@@ -1881,7 +1881,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)\n \t\t\trefname = get_refname(atom, ref);\n \t\telse if (atom_type == ATOM_WORKTREEPATH) {\n \t\t\tif (ref->kind == FILTER_REFS_BRANCHES)\n-\t\t\t\tv->s = get_worktree_path(atom, ref);\n+\t\t\t\tv->s = get_worktree_path(ref);\n \t\t\telse\n \t\t\t\tv->s = xstrdup(\"\");\n \t\t\tcontinue;\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472619","messageId":"Y/hbIj9T61+UYKF5@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 02/21] ls-refs: drop config caching","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:37:22Z","receivedAt":"2023-02-24T06:37:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The code for the v2 ls-refs command has an ensure_config_read() function\nthat tries to read the lsrefs.unborn config only once and caches it in\nsome static global variables.\n\nThere's no real need for this caching. In any given process we'd only\nneed the value twice (once to decide whether to advertise, and once if\nsomebody runs the command). And since the config code already has its\nown cache, each access is only incurring a hash lookup and string\ncomparison anyway.\n\nSince the values we set are going to be specific to the_repository, the\nglobals we set are a mild anti-pattern. In practice it's not a bug (yet)\nsince the server-side v2 code only handles a single repository anyway.\nBut it doesn't hurt to take a small step in the right direction and\nmodel a good approach.\n\nNote that we currently set two booleans: advertise_unborn and\nallow_unborn. But we can get away with a single value, since \"advertise\"\nnaturally implies \"allow\". That lets us just convert this to a function\nwith a return value.\n\nNote that we still always read from the_repository; we'll deal with that\nin a follow-on patch.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nMostly done as prep for the next patch, but IMHO the simplification here\nis nice in its own right.\n\n ls-refs.c | 34 ++++++++++++----------------------\n 1 file changed, 12 insertions(+), 22 deletions(-)\n\ndiff --git a/ls-refs.c b/ls-refs.c\nindex 697d4beb8d..4863813655 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -8,38 +8,32 @@\n #include \"config.h\"\n #include \"string-list.h\"\n \n-static int config_read;\n-static int advertise_unborn;\n-static int allow_unborn;\n-\n-static void ensure_config_read(void)\n+static enum {\n+\tUNBORN_IGNORE = 0,\n+\tUNBORN_ALLOW,\n+\tUNBORN_ADVERTISE /* implies ALLOW */\n+} unborn_config(void)\n {\n \tconst char *str = NULL;\n \n-\tif (config_read)\n-\t\treturn;\n-\n \tif (repo_config_get_string_tmp(the_repository, \"lsrefs.unborn\", &str)) {\n \t\t/*\n \t\t * If there is no such config, advertise and allow it by\n \t\t * default.\n \t\t */\n-\t\tadvertise_unborn = 1;\n-\t\tallow_unborn = 1;\n+\t\treturn UNBORN_ADVERTISE;\n \t} else {\n \t\tif (!strcmp(str, \"advertise\")) {\n-\t\t\tadvertise_unborn = 1;\n-\t\t\tallow_unborn = 1;\n+\t\t\treturn UNBORN_ADVERTISE;\n \t\t} else if (!strcmp(str, \"allow\")) {\n-\t\t\tallow_unborn = 1;\n+\t\t\treturn UNBORN_ALLOW;\n \t\t} else if (!strcmp(str, \"ignore\")) {\n-\t\t\t/* do nothing */\n+\t\t\treturn UNBORN_IGNORE;\n \t\t} else {\n \t\t\tdie(_(\"invalid value for '%s': '%s'\"),\n \t\t\t    \"lsrefs.unborn\", str);\n \t\t}\n \t}\n-\tconfig_read = 1;\n }\n \n /*\n@@ -159,7 +153,6 @@ int ls_refs(struct repository *r, struct packet_reader *request)\n \tstrbuf_init(&data.buf, 0);\n \tstring_list_init_dup(&data.hidden_refs);\n \n-\tensure_config_read();\n \tgit_config(ls_refs_config, &data);\n \n \twhile (packet_reader_read(request) == PACKET_READ_NORMAL) {\n@@ -175,7 +168,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)\n \t\t\t\tstrvec_push(&data.prefixes, out);\n \t\t}\n \t\telse if (!strcmp(\"unborn\", arg))\n-\t\t\tdata.unborn = allow_unborn;\n+\t\t\tdata.unborn = !!unborn_config();\n \t\telse\n \t\t\tdie(_(\"unexpected line: '%s'\"), arg);\n \t}\n@@ -206,11 +199,8 @@ int ls_refs(struct repository *r, struct packet_reader *request)\n \n int ls_refs_advertise(struct repository *r, struct strbuf *value)\n {\n-\tif (value) {\n-\t\tensure_config_read();\n-\t\tif (advertise_unborn)\n-\t\t\tstrbuf_addstr(value, \"unborn\");\n-\t}\n+\tif (value && unborn_config() == UNBORN_ADVERTISE)\n+\t\tstrbuf_addstr(value, \"unborn\");\n \n \treturn 1;\n }\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472620","messageId":"Y/hbUsGPVNAxTdmS@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 03/21] serve: use repository pointer to get config","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:38:10Z","receivedAt":"2023-02-24T06:38:15Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"A few of the v2 \"serve\" callbacks ignore their repository parameter and\nread config using the_repository (either directly or implicitly by\ncalling wrapper functions). This isn't a bug since the server code only\nhandles a single main repository anyway (and indeed, if you look at the\ncallers, these repository parameters will always be the_repository). But\nin the long run we want to get rid of the_repository, so let's take a\ntiny step in that direction.\n\nAs a bonus, this silences some -Wunused-parameter warnings.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n bundle-uri.c  | 2 +-\n ls-refs.c     | 8 ++++----\n serve.c       | 2 +-\n upload-pack.c | 8 ++++----\n 4 files changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/bundle-uri.c b/bundle-uri.c\nindex 8a3c39ce57..177c181040 100644\n--- a/bundle-uri.c\n+++ b/bundle-uri.c\n@@ -884,7 +884,7 @@ int bundle_uri_command(struct repository *r,\n \t * Read all \"bundle.*\" config lines to the client as key=value\n \t * packet lines.\n \t */\n-\tgit_config(config_to_packet_line, &writer);\n+\trepo_config(r, config_to_packet_line, &writer);\n \n \tpacket_writer_flush(&writer);\n \ndiff --git a/ls-refs.c b/ls-refs.c\nindex 4863813655..bd9ab2c348 100644\n--- a/ls-refs.c\n+++ b/ls-refs.c\n@@ -12,11 +12,11 @@ static enum {\n \tUNBORN_IGNORE = 0,\n \tUNBORN_ALLOW,\n \tUNBORN_ADVERTISE /* implies ALLOW */\n-} unborn_config(void)\n+} unborn_config(struct repository *r)\n {\n \tconst char *str = NULL;\n \n-\tif (repo_config_get_string_tmp(the_repository, \"lsrefs.unborn\", &str)) {\n+\tif (repo_config_get_string_tmp(r, \"lsrefs.unborn\", &str)) {\n \t\t/*\n \t\t * If there is no such config, advertise and allow it by\n \t\t * default.\n@@ -168,7 +168,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)\n \t\t\t\tstrvec_push(&data.prefixes, out);\n \t\t}\n \t\telse if (!strcmp(\"unborn\", arg))\n-\t\t\tdata.unborn = !!unborn_config();\n+\t\t\tdata.unborn = !!unborn_config(r);\n \t\telse\n \t\t\tdie(_(\"unexpected line: '%s'\"), arg);\n \t}\n@@ -199,7 +199,7 @@ int ls_refs(struct repository *r, struct packet_reader *request)\n \n int ls_refs_advertise(struct repository *r, struct strbuf *value)\n {\n-\tif (value && unborn_config() == UNBORN_ADVERTISE)\n+\tif (value && unborn_config(r) == UNBORN_ADVERTISE)\n \t\tstrbuf_addstr(value, \"unborn\");\n \n \treturn 1;\ndiff --git a/serve.c b/serve.c\nindex cbf4a143cf..2ccc03c16b 100644\n--- a/serve.c\n+++ b/serve.c\n@@ -48,7 +48,7 @@ static void object_format_receive(struct repository *r,\n static int session_id_advertise(struct repository *r, struct strbuf *value)\n {\n \tif (advertise_sid == -1 &&\n-\t    git_config_get_bool(\"transfer.advertisesid\", &advertise_sid))\n+\t    repo_config_get_bool(r, \"transfer.advertisesid\", &advertise_sid))\n \t\tadvertise_sid = 0;\n \tif (!advertise_sid)\n \t\treturn 0;\ndiff --git a/upload-pack.c b/upload-pack.c\nindex 551f22ffa5..bcb702a5ba 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1775,26 +1775,26 @@ int upload_pack_advertise(struct repository *r,\n \n \t\tstrbuf_addstr(value, \"shallow wait-for-done\");\n \n-\t\tif (!repo_config_get_bool(the_repository,\n+\t\tif (!repo_config_get_bool(r,\n \t\t\t\t\t \"uploadpack.allowfilter\",\n \t\t\t\t\t &allow_filter_value) &&\n \t\t    allow_filter_value)\n \t\t\tstrbuf_addstr(value, \" filter\");\n \n-\t\tif (!repo_config_get_bool(the_repository,\n+\t\tif (!repo_config_get_bool(r,\n \t\t\t\t\t \"uploadpack.allowrefinwant\",\n \t\t\t\t\t &allow_ref_in_want) &&\n \t\t    allow_ref_in_want)\n \t\t\tstrbuf_addstr(value, \" ref-in-want\");\n \n \t\tif (git_env_bool(\"GIT_TEST_SIDEBAND_ALL\", 0) ||\n-\t\t    (!repo_config_get_bool(the_repository,\n+\t\t    (!repo_config_get_bool(r,\n \t\t\t\t\t   \"uploadpack.allowsidebandall\",\n \t\t\t\t\t   &allow_sideband_all_value) &&\n \t\t     allow_sideband_all_value))\n \t\t\tstrbuf_addstr(value, \" sideband-all\");\n \n-\t\tif (!repo_config_get_string(the_repository,\n+\t\tif (!repo_config_get_string(r,\n \t\t\t\t\t    \"uploadpack.blobpackfileuri\",\n \t\t\t\t\t    &str) &&\n \t\t    str) {\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472621","messageId":"Y/hbXxnWeK5DxAXU@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 04/21] serve: mark unused parameters in virtual functions","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:38:23Z","receivedAt":"2023-02-24T06:38:27Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Each v2 \"serve\" action has a virtual function for advertising and\nimplementing the command. A few of these are so trivial that they don't\nneed to look at their parameters, especially the \"repository\" parameter.\nWe can mark them so that -Wunused-parameter doesn't complain.\n\nNote that upload_pack_v2() probably _should_ be using its repository\npointer. But teaching the functions it calls to do so is non-trivial.\nEven using it for something as simple as reading config is tricky, both\nbecause it shares code with the v1 upload pack, and because the\ngit_protected_config() mechanism it uses does not have a repo-specific\ninterface. So we'll just annotate it for now, and cleaning it up can be\npart of the larger work to drop references to the_repository.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n serve.c       | 10 +++++-----\n upload-pack.c |  2 +-\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/serve.c b/serve.c\nindex 2ccc03c16b..e08a980083 100644\n--- a/serve.c\n+++ b/serve.c\n@@ -12,13 +12,13 @@\n static int advertise_sid = -1;\n static int client_hash_algo = GIT_HASH_SHA1;\n \n-static int always_advertise(struct repository *r,\n-\t\t\t    struct strbuf *value)\n+static int always_advertise(struct repository *r UNUSED,\n+\t\t\t    struct strbuf *value UNUSED)\n {\n \treturn 1;\n }\n \n-static int agent_advertise(struct repository *r,\n+static int agent_advertise(struct repository *r UNUSED,\n \t\t\t   struct strbuf *value)\n {\n \tif (value)\n@@ -34,7 +34,7 @@ static int object_format_advertise(struct repository *r,\n \treturn 1;\n }\n \n-static void object_format_receive(struct repository *r,\n+static void object_format_receive(struct repository *r UNUSED,\n \t\t\t\t  const char *algo_name)\n {\n \tif (!algo_name)\n@@ -57,7 +57,7 @@ static int session_id_advertise(struct repository *r, struct strbuf *value)\n \treturn 1;\n }\n \n-static void session_id_receive(struct repository *r,\n+static void session_id_receive(struct repository *r UNUSED,\n \t\t\t       const char *client_sid)\n {\n \tif (!client_sid)\ndiff --git a/upload-pack.c b/upload-pack.c\nindex bcb702a5ba..f6f4da0fef 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -1699,7 +1699,7 @@ enum fetch_state {\n \tFETCH_DONE,\n };\n \n-int upload_pack_v2(struct repository *r, struct packet_reader *request)\n+int upload_pack_v2(struct repository *r UNUSED, struct packet_reader *request)\n {\n \tenum fetch_state state = FETCH_PROCESS_ARGS;\n \tstruct upload_pack_data data;\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472622","messageId":"Y/hbZqVZhRyIlFTk@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 05/21] object-name: mark unused parameters in disambiguate callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:38:30Z","receivedAt":"2023-02-24T06:38:35Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The object-name disambiguation code triggers a callback for each\npossible object id we find. This is really used for two purposes:\n\n  - \"hint\" functions like disambiguate_commit_only report back on\n    whether the value is usable\n\n  - iterator functions like repo_for_each_abbrev() use it to collect\n    and report matching names.\n\nCompiling with -Wunused-parameter generates several warnings, but\nthey're distinct for each type. The \"hint\" functions never look at the\nvoid cb_data pointer; they only care whether the oid matches our hint.\nThe iterator functions never look at the \"struct repository\" parameter;\nthey're just reporting back the oids they see, and always return 0.\n\nSo arguably these could be two separate interfaces:\n\n  int (*hint)(struct repository *r, const struct object_id *oid);\n  void (*iter)(const struct object_id *oid, void *cb_data);\n\nBut doing so would complicate the disambiguation code, which now has to\naccept and call the two different types. Since we can easily squelch the\ncompiler warnings by annotating the functions, let's just do that.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n object-name.c | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/object-name.c b/object-name.c\nindex 2dd1a0f56e..7d1986ad48 100644\n--- a/object-name.c\n+++ b/object-name.c\n@@ -223,15 +223,15 @@ static int finish_object_disambiguation(struct disambiguate_state *ds,\n \n static int disambiguate_commit_only(struct repository *r,\n \t\t\t\t    const struct object_id *oid,\n-\t\t\t\t    void *cb_data_unused)\n+\t\t\t\t    void *cb_data UNUSED)\n {\n \tint kind = oid_object_info(r, oid, NULL);\n \treturn kind == OBJ_COMMIT;\n }\n \n static int disambiguate_committish_only(struct repository *r,\n \t\t\t\t\tconst struct object_id *oid,\n-\t\t\t\t\tvoid *cb_data_unused)\n+\t\t\t\t\tvoid *cb_data UNUSED)\n {\n \tstruct object *obj;\n \tint kind;\n@@ -251,15 +251,15 @@ static int disambiguate_committish_only(struct repository *r,\n \n static int disambiguate_tree_only(struct repository *r,\n \t\t\t\t  const struct object_id *oid,\n-\t\t\t\t  void *cb_data_unused)\n+\t\t\t\t  void *cb_data UNUSED)\n {\n \tint kind = oid_object_info(r, oid, NULL);\n \treturn kind == OBJ_TREE;\n }\n \n static int disambiguate_treeish_only(struct repository *r,\n \t\t\t\t     const struct object_id *oid,\n-\t\t\t\t     void *cb_data_unused)\n+\t\t\t\t     void *cb_data UNUSED)\n {\n \tstruct object *obj;\n \tint kind;\n@@ -279,7 +279,7 @@ static int disambiguate_treeish_only(struct repository *r,\n \n static int disambiguate_blob_only(struct repository *r,\n \t\t\t\t  const struct object_id *oid,\n-\t\t\t\t  void *cb_data_unused)\n+\t\t\t\t  void *cb_data UNUSED)\n {\n \tint kind = oid_object_info(r, oid, NULL);\n \treturn kind == OBJ_BLOB;\n@@ -473,7 +473,7 @@ static int collect_ambiguous(const struct object_id *oid, void *data)\n \treturn 0;\n }\n \n-static int repo_collect_ambiguous(struct repository *r,\n+static int repo_collect_ambiguous(struct repository *r UNUSED,\n \t\t\t\t  const struct object_id *oid,\n \t\t\t\t  void *data)\n {\n@@ -665,7 +665,7 @@ static int extend_abbrev_len(const struct object_id *oid, void *cb_data)\n \treturn 0;\n }\n \n-static int repo_extend_abbrev_len(struct repository *r,\n+static int repo_extend_abbrev_len(struct repository *r UNUSED,\n \t\t\t\t  const struct object_id *oid,\n \t\t\t\t  void *cb_data)\n {\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472623","messageId":"Y/hba4Zq/j4ZhFoM@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 06/21] http-backend: mark argc/argv unused","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:38:35Z","receivedAt":"2023-02-24T06:38:40Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"We can't drop them because it's cmd_main(), which has a set prototype,\nbut the CGI interface does not do anything with such arguments.\n\nArguably we could detect them and complain. It's possible this could\ndetect misconfigurations or other mistakes, but:\n\n  - as far as I can tell common webservers like apache do not have any\n    mechanism to pass arguments to a CGI at all, so this isn't a mistake\n    one could even make\n\n  - it's possible that some obscure webserver might pass arguments, and\n    we'd break that case. I have no idea if such a webserver exists; the\n    CGI standard says only \"The script is invoked in a system-defined\n    manner\".\n\nSo probably it would not hurt to detect them, but it also is unlikely to\nhelp anyone. Let's just mark them as unused, which retains the current\nbehavior but silences -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n http-backend.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/http-backend.c b/http-backend.c\nindex 8ab58e55f8..fc3ab97c0f 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -736,7 +736,7 @@ static int bad_request(struct strbuf *hdr, const struct service_cmd *c)\n \treturn 0;\n }\n \n-int cmd_main(int argc, const char **argv)\n+int cmd_main(int argc UNUSED, const char **argv UNUSED)\n {\n \tchar *method = getenv(\"REQUEST_METHOD\");\n \tconst char *proto_header;\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472624","messageId":"Y/hbc7gsBMXQcpJ+@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 07/21] http-backend: mark unused parameters in virtual functions","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:38:43Z","receivedAt":"2023-02-24T06:38:47Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The http-backend dispatches requests via a table of virtual functions.\nSome of the functions ignore their \"arg\" parameter, because it's\nimplicit in the function (e.g., get_info_refs knows that it is\ndispatched only for a request to \"/info/refs\").\n\nMark these unused parameters to silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n http-backend.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/http-backend.c b/http-backend.c\nindex fc3ab97c0f..db963e64d7 100644\n--- a/http-backend.c\n+++ b/http-backend.c\n@@ -524,7 +524,7 @@ static int show_text_ref(const char *name, const struct object_id *oid,\n \treturn 0;\n }\n \n-static void get_info_refs(struct strbuf *hdr, char *arg)\n+static void get_info_refs(struct strbuf *hdr, char *arg UNUSED)\n {\n \tconst char *service_name = get_parameter(\"service\");\n \tstruct strbuf buf = STRBUF_INIT;\n@@ -578,7 +578,7 @@ static int show_head_ref(const char *refname, const struct object_id *oid,\n \treturn 0;\n }\n \n-static void get_head(struct strbuf *hdr, char *arg)\n+static void get_head(struct strbuf *hdr, char *arg UNUSED)\n {\n \tstruct strbuf buf = STRBUF_INIT;\n \n@@ -588,7 +588,7 @@ static void get_head(struct strbuf *hdr, char *arg)\n \tstrbuf_release(&buf);\n }\n \n-static void get_info_packs(struct strbuf *hdr, char *arg)\n+static void get_info_packs(struct strbuf *hdr, char *arg UNUSED)\n {\n \tsize_t objdirlen = strlen(get_object_directory());\n \tstruct strbuf buf = STRBUF_INIT;\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472625","messageId":"Y/hbimqTTSmZ8k2w@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 08/21] ref-filter: mark unused callback parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:06Z","receivedAt":"2023-02-24T06:39:12Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The ref-filter code uses virtual functions to handle specific atoms, but\nmany of the functions ignore some parameters:\n\n  - most atom parsers do not need the ref_format itself, unless they are\n    looking at centralized options like use_color, quote_style, etc.\n\n  - meta-atom handlers like append_atom(), align_atom_handler(), etc,\n    can't generate errors, so ignore their \"err\" parameter\n\n  - likewise, the handlers for then/else/end do not even need to look at\n    their atom_value, as the \"if\" handler put everything they need into\n    the ref_formatting_state stack\n\nSince these functions all have to conform to virtual function\ninterfaces, we can't just drop the unused parameters, but must mark them\nas UNUSED (to appease -Wunused-parameter).\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n ref-filter.c | 62 +++++++++++++++++++++++++++++++++-------------------\n 1 file changed, 40 insertions(+), 22 deletions(-)\n\ndiff --git a/ref-filter.c b/ref-filter.c\nindex 434a28c830..acdee7fe3d 100644\n--- a/ref-filter.c\n+++ b/ref-filter.c\n@@ -282,7 +282,8 @@ static int refname_atom_parser_internal(struct refname_atom *atom, const char *a\n \treturn 0;\n }\n \n-static int remote_ref_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int remote_ref_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t\t  struct used_atom *atom,\n \t\t\t\t  const char *arg, struct strbuf *err)\n {\n \tstruct string_list params = STRING_LIST_INIT_DUP;\n@@ -329,7 +330,8 @@ static int remote_ref_atom_parser(struct ref_format *format, struct used_atom *a\n \treturn 0;\n }\n \n-static int objecttype_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int objecttype_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t\t  struct used_atom *atom,\n \t\t\t\t  const char *arg, struct strbuf *err)\n {\n \tif (arg)\n@@ -341,7 +343,8 @@ static int objecttype_atom_parser(struct ref_format *format, struct used_atom *a\n \treturn 0;\n }\n \n-static int objectsize_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int objectsize_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t\t  struct used_atom *atom,\n \t\t\t\t  const char *arg, struct strbuf *err)\n {\n \tif (!arg) {\n@@ -361,7 +364,8 @@ static int objectsize_atom_parser(struct ref_format *format, struct used_atom *a\n \treturn 0;\n }\n \n-static int deltabase_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int deltabase_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t\t struct used_atom *atom,\n \t\t\t\t const char *arg, struct strbuf *err)\n {\n \tif (arg)\n@@ -373,7 +377,8 @@ static int deltabase_atom_parser(struct ref_format *format, struct used_atom *at\n \treturn 0;\n }\n \n-static int body_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int body_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t    struct used_atom *atom,\n \t\t\t    const char *arg, struct strbuf *err)\n {\n \tif (arg)\n@@ -382,7 +387,8 @@ static int body_atom_parser(struct ref_format *format, struct used_atom *atom,\n \treturn 0;\n }\n \n-static int subject_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int subject_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t       struct used_atom *atom,\n \t\t\t       const char *arg, struct strbuf *err)\n {\n \tif (!arg)\n@@ -394,7 +400,8 @@ static int subject_atom_parser(struct ref_format *format, struct used_atom *atom\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@@ -448,8 +455,9 @@ static int contents_atom_parser(struct ref_format *format, struct used_atom *ato\n \treturn 0;\n }\n \n-static int raw_atom_parser(struct ref_format *format, struct used_atom *atom,\n-\t\t\t\tconst char *arg, struct strbuf *err)\n+static int raw_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t   struct used_atom *atom,\n+\t\t\t   const char *arg, struct strbuf *err)\n {\n \tif (!arg)\n \t\tatom->u.raw_data.option = RAW_BARE;\n@@ -460,7 +468,8 @@ static int raw_atom_parser(struct ref_format *format, struct used_atom *atom,\n \treturn 0;\n }\n \n-static int oid_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int oid_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t   struct used_atom *atom,\n \t\t\t   const char *arg, struct strbuf *err)\n {\n \tif (!arg)\n@@ -479,7 +488,8 @@ static int oid_atom_parser(struct ref_format *format, struct used_atom *atom,\n \treturn 0;\n }\n \n-static int person_email_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int person_email_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t\t    struct used_atom *atom,\n \t\t\t\t    const char *arg, struct strbuf *err)\n {\n \tif (!arg)\n@@ -493,7 +503,8 @@ static int person_email_atom_parser(struct ref_format *format, struct used_atom\n \treturn 0;\n }\n \n-static int refname_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int refname_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t       struct used_atom *atom,\n \t\t\t       const char *arg, struct strbuf *err)\n {\n \treturn refname_atom_parser_internal(&atom->u.refname, arg, atom->name, err);\n@@ -510,7 +521,8 @@ static align_type parse_align_position(const char *s)\n \treturn -1;\n }\n \n-static int align_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int align_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t     struct used_atom *atom,\n \t\t\t     const char *arg, struct strbuf *err)\n {\n \tstruct align *align = &atom->u.align;\n@@ -562,7 +574,8 @@ static int align_atom_parser(struct ref_format *format, struct used_atom *atom,\n \treturn 0;\n }\n \n-static int if_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int if_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t  struct used_atom *atom,\n \t\t\t  const char *arg, struct strbuf *err)\n {\n \tif (!arg) {\n@@ -577,7 +590,8 @@ static int if_atom_parser(struct ref_format *format, struct used_atom *atom,\n \treturn 0;\n }\n \n-static int rest_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int rest_atom_parser(struct ref_format *format,\n+\t\t\t    struct used_atom *atom UNUSED,\n \t\t\t    const char *arg, struct strbuf *err)\n {\n \tif (arg)\n@@ -586,7 +600,8 @@ static int rest_atom_parser(struct ref_format *format, struct used_atom *atom,\n \treturn 0;\n }\n \n-static int head_atom_parser(struct ref_format *format, struct used_atom *atom,\n+static int head_atom_parser(struct ref_format *format UNUSED,\n+\t\t\t    struct used_atom *atom,\n \t\t\t    const char *arg, struct strbuf *err)\n {\n \tif (arg)\n@@ -791,7 +806,7 @@ static void quote_formatting(struct strbuf *s, const char *str, ssize_t len, int\n }\n \n static int append_atom(struct atom_value *v, struct ref_formatting_state *state,\n-\t\t       struct strbuf *unused_err)\n+\t\t       struct strbuf *err UNUSED)\n {\n \t/*\n \t * Quote formatting is only done when the stack has a single\n@@ -841,7 +856,7 @@ static void end_align_handler(struct ref_formatting_stack **stack)\n }\n \n static int align_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,\n-\t\t\t      struct strbuf *unused_err)\n+\t\t\t      struct strbuf *err UNUSED)\n {\n \tstruct ref_formatting_stack *new_stack;\n \n@@ -888,7 +903,7 @@ static void if_then_else_handler(struct ref_formatting_stack **stack)\n }\n \n static int if_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,\n-\t\t\t   struct strbuf *unused_err)\n+\t\t\t   struct strbuf *err UNUSED)\n {\n \tstruct ref_formatting_stack *new_stack;\n \tstruct if_then_else *if_then_else = xcalloc(1,\n@@ -915,7 +930,8 @@ static int is_empty(struct strbuf *buf)\n \treturn cur == end;\n  }\n \n-static int then_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,\n+static int then_atom_handler(struct atom_value *atomv UNUSED,\n+\t\t\t     struct ref_formatting_state *state,\n \t\t\t     struct strbuf *err)\n {\n \tstruct ref_formatting_stack *cur = state->stack;\n@@ -952,7 +968,8 @@ static int then_atom_handler(struct atom_value *atomv, struct ref_formatting_sta\n \treturn 0;\n }\n \n-static int else_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,\n+static int else_atom_handler(struct atom_value *atomv UNUSED,\n+\t\t\t     struct ref_formatting_state *state,\n \t\t\t     struct strbuf *err)\n {\n \tstruct ref_formatting_stack *prev = state->stack;\n@@ -973,7 +990,8 @@ static int else_atom_handler(struct atom_value *atomv, struct ref_formatting_sta\n \treturn 0;\n }\n \n-static int end_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state,\n+static int end_atom_handler(struct atom_value *atomv UNUSED,\n+\t\t\t    struct ref_formatting_state *state,\n \t\t\t    struct strbuf *err)\n {\n \tstruct ref_formatting_stack *current = state->stack;\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472626","messageId":"Y/hbk3/wMqhqTRAF@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 09/21] mark \"pointless\" data pointers in callbacks","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:15Z","receivedAt":"2023-02-24T06:39:26Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Both the object_array_filter() and trie_find() functions use callback\nfunctions that let the caller specify which elements match. These\ncallbacks take a void pointer in case the caller wants to pass in extra\ndata. But in each case, the single user of these functions just passes\nNULL, and the callback ignores the extra pointer.\n\nWe could just remove these unused parameters from the callback interface\nentirely. But it's good practice to provide such a pointer, as it guides\nfuture callers of the function in the right direction (rather than\ntempting them to access global data). Plus it's consistent with other\ngeneric callback interfaces.\n\nSo let's instead annotate the unused parameters, in order to silence the\ncompiler's -Wunused-parameter warning.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n path.c     | 3 ++-\n revision.c | 2 +-\n 2 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/path.c b/path.c\nindex 492e17ad12..0b641233e3 100644\n--- a/path.c\n+++ b/path.c\n@@ -347,7 +347,8 @@ static void init_common_trie(void)\n  * Helper function for update_common_dir: returns 1 if the dir\n  * prefix is common.\n  */\n-static int check_common(const char *unmatched, void *value, void *baton)\n+static int check_common(const char *unmatched, void *value,\n+\t\t\tvoid *baton UNUSED)\n {\n \tstruct common_dir *dir = value;\n \ndiff --git a/revision.c b/revision.c\nindex 21f5f572c2..4a24fc3fcd 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -4159,7 +4159,7 @@ static struct commit *get_revision_1(struct rev_info *revs)\n  * Return true for entries that have not yet been shown.  (This is an\n  * object_array_each_func_t.)\n  */\n-static int entry_unshown(struct object_array_entry *entry, void *cb_data_unused)\n+static int entry_unshown(struct object_array_entry *entry, void *cb_data UNUSED)\n {\n \treturn !(entry->item->flags & SHOWN);\n }\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472627","messageId":"Y/hbli5wEl8cMTj1@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 10/21] run-command: mark error routine parameters as unused","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:18Z","receivedAt":"2023-02-24T06:39:33Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"After forking but before exec-ing a command, we install special\nerror/warn/die handlers in the child. These ignore the error messages\nthey get, since the idea is that they shouldn't be called in the first\nplace.\n\nArguably they could pass along that error message _in addition_ to\nsaying \"error() should not be called in a child\", but since the whole\npoint is to avoid any conflicts on stdio/malloc locks, etc, we're better\nto just keep these simple. Seeing them trigger is effectively a bug, and\nthe developer is probably better off grabbing a stack trace.\n\nBut we do want to mark the functions so that -Wunused-parameter doesn't\ncomplain.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n run-command.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/run-command.c b/run-command.c\nindex 6bd16acb06..ba617655b2 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -341,19 +341,19 @@ static void child_close_pair(int fd[2])\n \tchild_close(fd[1]);\n }\n \n-static void child_error_fn(const char *err, va_list params)\n+static void child_error_fn(const char *err UNUSED, va_list params UNUSED)\n {\n \tconst char msg[] = \"error() should not be called in child\\n\";\n \txwrite(2, msg, sizeof(msg) - 1);\n }\n \n-static void child_warn_fn(const char *err, va_list params)\n+static void child_warn_fn(const char *err UNUSED, va_list params UNUSED)\n {\n \tconst char msg[] = \"warn() should not be called in child\\n\";\n \txwrite(2, msg, sizeof(msg) - 1);\n }\n \n-static void NORETURN child_die_fn(const char *err, va_list params)\n+static void NORETURN child_die_fn(const char *err UNUSED, va_list params UNUSED)\n {\n \tconst char msg[] = \"die() should not be called in child\\n\";\n \txwrite(2, msg, sizeof(msg) - 1);\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472628","messageId":"Y/hbmIwVOtOJanAc@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 11/21] mark unused parameters in signal handlers","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:20Z","receivedAt":"2023-02-24T06:39:38Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Signal handlers receive their signal number as a parameter, but many\ndon't care what it is (because they only handle one signal, or because\ntheir action is the same regardless of the signal). Mark such parameters\nto silence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/fast-import.c | 2 +-\n builtin/log.c         | 2 +-\n daemon.c              | 2 +-\n progress.c            | 2 +-\n 4 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/fast-import.c b/builtin/fast-import.c\nindex 7134683ab9..4a8c835062 100644\n--- a/builtin/fast-import.c\n+++ b/builtin/fast-import.c\n@@ -436,7 +436,7 @@ static void set_checkpoint_signal(void)\n \n #else\n \n-static void checkpoint_signal(int signo)\n+static void checkpoint_signal(int signo UNUSED)\n {\n \tcheckpoint_requested = 1;\n }\ndiff --git a/builtin/log.c b/builtin/log.c\nindex 04412dd9c9..813b768e24 100644\n--- a/builtin/log.c\n+++ b/builtin/log.c\n@@ -436,7 +436,7 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)\n \tsetitimer(ITIMER_REAL, &early_output_timer, NULL);\n }\n \n-static void early_output(int signal)\n+static void early_output(int signal UNUSED)\n {\n \tshow_early_output = log_show_early;\n }\ndiff --git a/daemon.c b/daemon.c\nindex 0ae7d12b5c..06d5bc6931 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -928,7 +928,7 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)\n \t\tadd_child(&cld, addr, addrlen);\n }\n \n-static void child_handler(int signo)\n+static void child_handler(int signo UNUSED)\n {\n \t/*\n \t * Otherwise empty handler because systemcalls will get interrupted\ndiff --git a/progress.c b/progress.c\nindex 0cdd875d37..9b33a2df32 100644\n--- a/progress.c\n+++ b/progress.c\n@@ -59,7 +59,7 @@ void progress_test_force_update(void)\n }\n \n \n-static void progress_interval(int signum)\n+static void progress_interval(int signum UNUSED)\n {\n \tprogress_update = 1;\n }\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472629","messageId":"Y/hbmh2jpj4OgWUN@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 12/21] list-objects: mark unused callback parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:22Z","receivedAt":"2023-02-24T06:39:44Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Our graph-traversal functions take callbacks for showing commits and\nobjects, but not all callbacks need each parameter.  Likewise for the\nsimilar traverse_bitmap_commit_list(), which has a different interface\nbut serves the same purpose. And the include_check mechanism, which\npasses along a void pointer which is not always used.\n\nMark the unused ones to to make -Wunused-parameter happy.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/pack-objects.c | 11 ++++++-----\n builtin/rev-list.c     | 10 +++++-----\n pack-bitmap.c          |  6 ++++--\n reachable.c            | 12 +++++++-----\n 4 files changed, 22 insertions(+), 17 deletions(-)\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 74a167a180..fb92a9686b 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1590,7 +1590,7 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,\n \n static int add_object_entry_from_bitmap(const struct object_id *oid,\n \t\t\t\t\tenum object_type type,\n-\t\t\t\t\tint flags, uint32_t name_hash,\n+\t\t\t\t\tint flags UNUSED, uint32_t name_hash,\n \t\t\t\t\tstruct packed_git *pack, off_t offset)\n {\n \tdisplay_progress(progress_state, ++nr_seen);\n@@ -3464,7 +3464,7 @@ static void add_cruft_object_entry(const struct object_id *oid, enum object_type\n \treturn;\n }\n \n-static void show_cruft_object(struct object *obj, const char *name, void *data)\n+static void show_cruft_object(struct object *obj, const char *name, void *data UNUSED)\n {\n \t/*\n \t * if we did not record it earlier, it's at least as old as our\n@@ -3484,7 +3484,7 @@ static void show_cruft_commit(struct commit *commit, void *data)\n \tshow_cruft_object((struct object*)commit, NULL, data);\n }\n \n-static int cruft_include_check_obj(struct object *obj, void *data)\n+static int cruft_include_check_obj(struct object *obj, void *data UNUSED)\n {\n \treturn !has_object_kept_pack(&obj->oid, IN_CORE_KEEP_PACKS);\n }\n@@ -3663,7 +3663,7 @@ static void read_object_list_from_stdin(void)\n \t}\n }\n \n-static void show_commit(struct commit *commit, void *data)\n+static void show_commit(struct commit *commit, void *data UNUSED)\n {\n \tadd_object_entry(&commit->object.oid, OBJ_COMMIT, NULL, 0);\n \n@@ -3674,7 +3674,8 @@ static void show_commit(struct commit *commit, void *data)\n \t\tpropagate_island_marks(commit);\n }\n \n-static void show_object(struct object *obj, const char *name, void *data)\n+static void show_object(struct object *obj, const char *name,\n+\t\t\tvoid *data UNUSED)\n {\n \tadd_preferred_base_object(name);\n \tadd_object_entry(&obj->oid, obj->type, name, 0);\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex d42db0b0cc..cceb5de975 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -362,11 +362,11 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)\n \n static int show_object_fast(\n \tconst struct object_id *oid,\n-\tenum object_type type,\n-\tint exclude,\n-\tuint32_t name_hash,\n-\tstruct packed_git *found_pack,\n-\toff_t found_offset)\n+\tenum object_type type UNUSED,\n+\tint exclude UNUSED,\n+\tuint32_t name_hash UNUSED,\n+\tstruct packed_git *found_pack UNUSED,\n+\toff_t found_offset UNUSED)\n {\n \tfprintf(stdout, \"%s\\n\", oid_to_hex(oid));\n \treturn 1;\ndiff --git a/pack-bitmap.c b/pack-bitmap.c\nindex d2a42abf28..c8994a0f00 100644\n--- a/pack-bitmap.c\n+++ b/pack-bitmap.c\n@@ -951,7 +951,8 @@ static void show_object(struct object *object, const char *name, void *data_)\n \tbitmap_set(data->base, bitmap_pos);\n }\n \n-static void show_commit(struct commit *commit, void *data)\n+static void show_commit(struct commit *commit UNUSED,\n+\t\t\tvoid *data UNUSED)\n {\n }\n \n@@ -1940,7 +1941,8 @@ static void test_bitmap_type(struct bitmap_test_data *tdata,\n \t\t    type_name(bitmap_type));\n }\n \n-static void test_show_object(struct object *object, const char *name,\n+static void test_show_object(struct object *object,\n+\t\t\t     const char *name UNUSED,\n \t\t\t     void *data)\n {\n \tstruct bitmap_test_data *tdata = data;\ndiff --git a/reachable.c b/reachable.c\nindex aba63ebeb3..08f290c2be 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -48,7 +48,9 @@ static int add_one_ref(const char *path, const struct object_id *oid,\n  * The traversal will have already marked us as SEEN, so we\n  * only need to handle any progress reporting here.\n  */\n-static void mark_object(struct object *obj, const char *name, void *data)\n+static void mark_object(struct object *obj UNUSED,\n+\t\t\tconst char *name UNUSED,\n+\t\t\tvoid *data)\n {\n \tupdate_progress(data);\n }\n@@ -202,10 +204,10 @@ int add_unseen_recent_objects_to_traversal(struct rev_info *revs,\n \n static int mark_object_seen(const struct object_id *oid,\n \t\t\t     enum object_type type,\n-\t\t\t     int exclude,\n-\t\t\t     uint32_t name_hash,\n-\t\t\t     struct packed_git *found_pack,\n-\t\t\t     off_t found_offset)\n+\t\t\t     int exclude UNUSED,\n+\t\t\t     uint32_t name_hash UNUSED,\n+\t\t\t     struct packed_git *found_pack UNUSED,\n+\t\t\t     off_t found_offset UNUSED)\n {\n \tstruct object *obj = lookup_object_by_type(the_repository, oid, type);\n \tif (!obj)\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472630","messageId":"Y/hbnCJmo9G+YqE6@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 13/21] for_each_object: mark unused callback parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:24Z","receivedAt":"2023-02-24T06:39:51Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The for_each_{loose,packed}_object interface uses callback functions,\nbut not every callback needs all of the parameters. Mark the unused ones\nto satisfy -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/cat-file.c      |  8 ++++----\n builtin/count-objects.c |  6 ++++--\n builtin/fsck.c          | 25 +++++++++++++------------\n builtin/gc.c            | 14 +++++++-------\n builtin/pack-objects.c  | 15 ++++++++-------\n builtin/prune.c         |  6 ++++--\n builtin/repack.c        |  5 +++--\n builtin/rev-list.c      |  3 ++-\n diagnose.c              |  3 ++-\n midx.c                  |  2 +-\n object-file.c           |  3 ++-\n packfile.c              |  4 ++--\n reachable.c             |  3 ++-\n revision.c              |  4 ++--\n 14 files changed, 56 insertions(+), 45 deletions(-)\n\ndiff --git a/builtin/cat-file.c b/builtin/cat-file.c\nindex cc17635e76..0dec21c107 100644\n--- a/builtin/cat-file.c\n+++ b/builtin/cat-file.c\n@@ -559,16 +559,16 @@ static int batch_object_cb(const struct object_id *oid, void *vdata)\n }\n \n static int collect_loose_object(const struct object_id *oid,\n-\t\t\t\tconst char *path,\n+\t\t\t\tconst char *path UNUSED,\n \t\t\t\tvoid *data)\n {\n \toid_array_append(data, oid);\n \treturn 0;\n }\n \n static int collect_packed_object(const struct object_id *oid,\n-\t\t\t\t struct packed_git *pack,\n-\t\t\t\t uint32_t pos,\n+\t\t\t\t struct packed_git *pack UNUSED,\n+\t\t\t\t uint32_t pos UNUSED,\n \t\t\t\t void *data)\n {\n \toid_array_append(data, oid);\n@@ -591,7 +591,7 @@ static int batch_unordered_object(const struct object_id *oid,\n }\n \n static int batch_unordered_loose(const struct object_id *oid,\n-\t\t\t\t const char *path,\n+\t\t\t\t const char *path UNUSED,\n \t\t\t\t void *data)\n {\n \treturn batch_unordered_object(oid, NULL, 0, data);\ndiff --git a/builtin/count-objects.c b/builtin/count-objects.c\nindex 07b9419596..bb21bc43e4 100644\n--- a/builtin/count-objects.c\n+++ b/builtin/count-objects.c\n@@ -57,7 +57,8 @@ static void loose_garbage(const char *path)\n \t\treport_garbage(PACKDIR_FILE_GARBAGE, path);\n }\n \n-static int count_loose(const struct object_id *oid, const char *path, void *data)\n+static int count_loose(const struct object_id *oid, const char *path,\n+\t\t       void *data UNUSED)\n {\n \tstruct stat st;\n \n@@ -72,7 +73,8 @@ static int count_loose(const struct object_id *oid, const char *path, void *data\n \treturn 0;\n }\n \n-static int count_cruft(const char *basename, const char *path, void *data)\n+static int count_cruft(const char *basename UNUSED, const char *path,\n+\t\t       void *data UNUSED)\n {\n \tloose_garbage(path);\n \treturn 0;\ndiff --git a/builtin/fsck.c b/builtin/fsck.c\nindex d207bd909b..56aba054ed 100644\n--- a/builtin/fsck.c\n+++ b/builtin/fsck.c\n@@ -233,17 +233,17 @@ static void mark_unreachable_referents(const struct object_id *oid)\n }\n \n static int mark_loose_unreachable_referents(const struct object_id *oid,\n-\t\t\t\t\t    const char *path,\n-\t\t\t\t\t    void *data)\n+\t\t\t\t\t    const char *path UNUSED,\n+\t\t\t\t\t    void *data UNUSED)\n {\n \tmark_unreachable_referents(oid);\n \treturn 0;\n }\n \n static int mark_packed_unreachable_referents(const struct object_id *oid,\n-\t\t\t\t\t     struct packed_git *pack,\n-\t\t\t\t\t     uint32_t pos,\n-\t\t\t\t\t     void *data)\n+\t\t\t\t\t     struct packed_git *pack UNUSED,\n+\t\t\t\t\t     uint32_t pos UNUSED,\n+\t\t\t\t\t     void *data UNUSED)\n {\n \tmark_unreachable_referents(oid);\n \treturn 0;\n@@ -661,14 +661,15 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)\n \treturn 0; /* keep checking other objects, even if we saw an error */\n }\n \n-static int fsck_cruft(const char *basename, const char *path, void *data)\n+static int fsck_cruft(const char *basename, const char *path,\n+\t\t      void *data UNUSED)\n {\n \tif (!starts_with(basename, \"tmp_obj_\"))\n \t\tfprintf_ln(stderr, _(\"bad sha1 file: %s\"), path);\n \treturn 0;\n }\n \n-static int fsck_subdir(unsigned int nr, const char *path, void *data)\n+static int fsck_subdir(unsigned int nr, const char *path UNUSED, void *data)\n {\n \tstruct for_each_loose_cb *cb_data = data;\n \tstruct progress *progress = cb_data->progress;\n@@ -803,17 +804,17 @@ static void mark_object_for_connectivity(const struct object_id *oid)\n }\n \n static int mark_loose_for_connectivity(const struct object_id *oid,\n-\t\t\t\t       const char *path,\n-\t\t\t\t       void *data)\n+\t\t\t\t       const char *path UNUSED,\n+\t\t\t\t       void *data UNUSED)\n {\n \tmark_object_for_connectivity(oid);\n \treturn 0;\n }\n \n static int mark_packed_for_connectivity(const struct object_id *oid,\n-\t\t\t\t\tstruct packed_git *pack,\n-\t\t\t\t\tuint32_t pos,\n-\t\t\t\t\tvoid *data)\n+\t\t\t\t\tstruct packed_git *pack UNUSED,\n+\t\t\t\t\tuint32_t pos UNUSED,\n+\t\t\t\t\tvoid *data UNUSED)\n {\n \tmark_object_for_connectivity(oid);\n \treturn 0;\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 02455fdcd7..4486438624 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -976,9 +976,9 @@ struct write_loose_object_data {\n \n static int loose_object_auto_limit = 100;\n \n-static int loose_object_count(const struct object_id *oid,\n-\t\t\t       const char *path,\n-\t\t\t       void *data)\n+static int loose_object_count(const struct object_id *oid UNUSED,\n+\t\t\t      const char *path UNUSED,\n+\t\t\t      void *data)\n {\n \tint *count = (int*)data;\n \tif (++(*count) >= loose_object_auto_limit)\n@@ -1003,15 +1003,15 @@ static int loose_object_auto_condition(void)\n \t\t\t\t\t     NULL, NULL, &count);\n }\n \n-static int bail_on_loose(const struct object_id *oid,\n-\t\t\t const char *path,\n-\t\t\t void *data)\n+static int bail_on_loose(const struct object_id *oid UNUSED,\n+\t\t\t const char *path UNUSED,\n+\t\t\t void *data UNUSED)\n {\n \treturn 1;\n }\n \n static int write_loose_object_to_stdin(const struct object_id *oid,\n-\t\t\t\t       const char *path,\n+\t\t\t\t       const char *path UNUSED,\n \t\t\t\t       void *data)\n {\n \tstruct write_loose_object_data *d = (struct write_loose_object_data *)data;\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex fb92a9686b..d7eebeb6eb 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -3260,13 +3260,14 @@ static int add_object_entry_from_pack(const struct object_id *oid,\n \treturn 0;\n }\n \n-static void show_commit_pack_hint(struct commit *commit, void *_data)\n+static void show_commit_pack_hint(struct commit *commit UNUSED,\n+\t\t\t\t  void *data UNUSED)\n {\n \t/* nothing to do; commits don't have a namehash */\n }\n \n static void show_object_pack_hint(struct object *object, const char *name,\n-\t\t\t\t  void *_data)\n+\t\t\t\t  void *data UNUSED)\n {\n \tstruct object_entry *oe = packlist_find(&to_pack, &object->oid);\n \tif (!oe)\n@@ -3762,7 +3763,7 @@ static void show_edge(struct commit *commit)\n static int add_object_in_unpacked_pack(const struct object_id *oid,\n \t\t\t\t       struct packed_git *pack,\n \t\t\t\t       uint32_t pos,\n-\t\t\t\t       void *_data)\n+\t\t\t\t       void *data UNUSED)\n {\n \tif (cruft) {\n \t\toff_t offset;\n@@ -3796,7 +3797,7 @@ static void add_objects_in_unpacked_packs(void)\n }\n \n static int add_loose_object(const struct object_id *oid, const char *path,\n-\t\t\t    void *data)\n+\t\t\t    void *data UNUSED)\n {\n \tenum object_type type = oid_object_info(the_repository, oid, NULL);\n \n@@ -3947,13 +3948,13 @@ static int get_object_list_from_bitmap(struct rev_info *revs)\n }\n \n static void record_recent_object(struct object *obj,\n-\t\t\t\t const char *name,\n-\t\t\t\t void *data)\n+\t\t\t\t const char *name UNUSED,\n+\t\t\t\t void *data UNUSED)\n {\n \toid_array_append(&recent_objects, &obj->oid);\n }\n \n-static void record_recent_commit(struct commit *commit, void *data)\n+static void record_recent_commit(struct commit *commit, void *data UNUSED)\n {\n \toid_array_append(&recent_objects, &commit->object.oid);\n }\ndiff --git a/builtin/prune.c b/builtin/prune.c\nindex 2719220108..4580890393 100644\n--- a/builtin/prune.c\n+++ b/builtin/prune.c\n@@ -98,7 +98,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath,\n \treturn 0;\n }\n \n-static int prune_cruft(const char *basename, const char *path, void *data)\n+static int prune_cruft(const char *basename, const char *path,\n+\t\t       void *data UNUSED)\n {\n \tif (starts_with(basename, \"tmp_obj_\"))\n \t\tprune_tmp_file(path);\n@@ -107,7 +108,8 @@ static int prune_cruft(const char *basename, const char *path, void *data)\n \treturn 0;\n }\n \n-static int prune_subdir(unsigned int nr, const char *path, void *data)\n+static int prune_subdir(unsigned int nr UNUSED, const char *path,\n+\t\t\tvoid *data UNUSED)\n {\n \tif (!show_only)\n \t\trmdir(path);\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex f649379531..36b511c564 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -182,8 +182,9 @@ static void prepare_pack_objects(struct child_process *cmd,\n  * Write oid to the given struct child_process's stdin, starting it first if\n  * necessary.\n  */\n-static int write_oid(const struct object_id *oid, struct packed_git *pack,\n-\t\t     uint32_t pos, void *data)\n+static int write_oid(const struct object_id *oid,\n+\t\t     struct packed_git *pack UNUSED,\n+\t\t     uint32_t pos UNUSED, void *data)\n {\n \tstruct child_process *cmd = data;\n \ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex cceb5de975..888ad6b5c0 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -257,7 +257,8 @@ static inline void finish_object__ma(struct object *obj)\n \t}\n }\n \n-static int finish_object(struct object *obj, const char *name, void *cb_data)\n+static int finish_object(struct object *obj, const char *name UNUSED,\n+\t\t\t void *cb_data)\n {\n \tstruct rev_list_info *info = cb_data;\n \tif (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {\ndiff --git a/diagnose.c b/diagnose.c\nindex 8f26569896..e7c42b3a71 100644\n--- a/diagnose.c\n+++ b/diagnose.c\n@@ -43,7 +43,8 @@ int option_parse_diagnose(const struct option *opt, const char *arg, int unset)\n \treturn error(_(\"invalid --%s value '%s'\"), opt->long_name, arg);\n }\n \n-static void dir_file_stats_objects(const char *full_path, size_t full_path_len,\n+static void dir_file_stats_objects(const char *full_path,\n+\t\t\t\t   size_t full_path_len UNUSED,\n \t\t\t\t   const char *file_name, void *data)\n {\n \tstruct strbuf *buf = data;\ndiff --git a/midx.c b/midx.c\nindex 7cfad04a24..d761cc50bd 100644\n--- a/midx.c\n+++ b/midx.c\n@@ -1607,7 +1607,7 @@ struct clear_midx_data {\n \tconst char *ext;\n };\n \n-static void clear_midx_file_ext(const char *full_path, size_t full_path_len,\n+static void clear_midx_file_ext(const char *full_path, size_t full_path_len UNUSED,\n \t\t\t\tconst char *file_name, void *_data)\n {\n \tstruct clear_midx_data *data = _data;\ndiff --git a/object-file.c b/object-file.c\nindex 939865c1ae..389d452e48 100644\n--- a/object-file.c\n+++ b/object-file.c\n@@ -2644,7 +2644,8 @@ int for_each_loose_object(each_loose_object_fn cb, void *data,\n \treturn 0;\n }\n \n-static int append_loose_object(const struct object_id *oid, const char *path,\n+static int append_loose_object(const struct object_id *oid,\n+\t\t\t       const char *path UNUSED,\n \t\t\t       void *data)\n {\n \toidtree_insert(data, oid);\ndiff --git a/packfile.c b/packfile.c\nindex 79e21ab18e..4dc0e15aa5 100644\n--- a/packfile.c\n+++ b/packfile.c\n@@ -2204,8 +2204,8 @@ int for_each_packed_object(each_packed_object_fn cb, void *data,\n }\n \n static int add_promisor_object(const struct object_id *oid,\n-\t\t\t       struct packed_git *pack,\n-\t\t\t       uint32_t pos,\n+\t\t\t       struct packed_git *pack UNUSED,\n+\t\t\t       uint32_t pos UNUSED,\n \t\t\t       void *set_)\n {\n \tstruct oidset *set = set_;\ndiff --git a/reachable.c b/reachable.c\nindex 08f290c2be..0afe80c203 100644\n--- a/reachable.c\n+++ b/reachable.c\n@@ -154,7 +154,8 @@ static int add_recent_loose(const struct object_id *oid,\n }\n \n static int add_recent_packed(const struct object_id *oid,\n-\t\t\t     struct packed_git *p, uint32_t pos,\n+\t\t\t     struct packed_git *p,\n+\t\t\t     uint32_t pos,\n \t\t\t     void *data)\n {\n \tstruct object *obj;\ndiff --git a/revision.c b/revision.c\nindex 4a24fc3fcd..65fca1ed6c 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -3440,8 +3440,8 @@ void reset_revision_walk(void)\n }\n \n static int mark_uninteresting(const struct object_id *oid,\n-\t\t\t      struct packed_git *pack,\n-\t\t\t      uint32_t pos,\n+\t\t\t      struct packed_git *pack UNUSED,\n+\t\t\t      uint32_t pos UNUSED,\n \t\t\t      void *cb)\n {\n \tstruct rev_info *revs = cb;\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472631","messageId":"Y/hbnxLl88xiCrH9@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 14/21] prio-queue: mark unused parameters in comparison functions","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:27Z","receivedAt":"2023-02-24T06:39:55Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The prio_queue_compare_fn interface has a void pointer to allow callers\nto pass arbitrary data, but most comparison functions don't need it.\nMark those cases to make -Wunused-parameter happy.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n commit.c                   | 6 ++++--\n negotiator/skipping.c      | 2 +-\n t/helper/test-prio-queue.c | 2 +-\n 3 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/commit.c b/commit.c\nindex e433c33bb0..0606d16e3a 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -801,7 +801,8 @@ int compare_commits_by_author_date(const void *a_, const void *b_,\n \treturn 0;\n }\n \n-int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void *unused)\n+int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_,\n+\t\t\t\t\t    void *unused UNUSED)\n {\n \tconst struct commit *a = a_, *b = b_;\n \tconst timestamp_t generation_a = commit_graph_generation(a),\n@@ -821,7 +822,8 @@ int compare_commits_by_gen_then_commit_date(const void *a_, const void *b_, void\n \treturn 0;\n }\n \n-int compare_commits_by_commit_date(const void *a_, const void *b_, void *unused)\n+int compare_commits_by_commit_date(const void *a_, const void *b_,\n+\t\t\t\t   void *unused UNUSED)\n {\n \tconst struct commit *a = a_, *b = b_;\n \t/* newer commits with larger date first */\ndiff --git a/negotiator/skipping.c b/negotiator/skipping.c\nindex 0f5ac48e87..4867efc5f5 100644\n--- a/negotiator/skipping.c\n+++ b/negotiator/skipping.c\n@@ -50,7 +50,7 @@ struct data {\n \tint non_common_revs;\n };\n \n-static int compare(const void *a_, const void *b_, void *unused)\n+static int compare(const void *a_, const void *b_, void *data UNUSED)\n {\n \tconst struct entry *a = a_;\n \tconst struct entry *b = b_;\ndiff --git a/t/helper/test-prio-queue.c b/t/helper/test-prio-queue.c\nindex 133b5e6f4a..496c7be07d 100644\n--- a/t/helper/test-prio-queue.c\n+++ b/t/helper/test-prio-queue.c\n@@ -2,7 +2,7 @@\n #include \"cache.h\"\n #include \"prio-queue.h\"\n \n-static int intcmp(const void *va, const void *vb, void *data)\n+static int intcmp(const void *va, const void *vb, void *data UNUSED)\n {\n \tconst int *a = va, *b = vb;\n \treturn *a - *b;\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472632","messageId":"Y/hbo9JJhD0WTarU@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 15/21] notes: mark unused callback parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:31Z","receivedAt":"2023-02-24T06:40:03Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"for_each_note() requires a callback, but not all callbacks need all of\nthe parameters. Likewise, init_notes() takes a callback to implement the\n\"combine\" strategy, but the \"ignore\" variant obviously doesn't look at\nits arguments at all. Mark unused parameters as appropriate to silence\ncompiler warnings.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/notes.c |  5 +++--\n notes.c         | 11 ++++++-----\n 2 files changed, 9 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 80d9dfd25c..d5713a9fac 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -113,8 +113,9 @@ static void free_note_data(struct note_data *d)\n }\n \n static int list_each_note(const struct object_id *object_oid,\n-\t\tconst struct object_id *note_oid, char *note_path,\n-\t\tvoid *cb_data)\n+\t\t\t  const struct object_id *note_oid,\n+\t\t\t  char *note_path UNUSED,\n+\t\t\t  void *cb_data UNUSED)\n {\n \tprintf(\"%s %s\\n\", oid_to_hex(note_oid), oid_to_hex(object_oid));\n \treturn 0;\ndiff --git a/notes.c b/notes.c\nindex f2805d51bb..20af123d91 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -752,7 +752,7 @@ static int write_each_non_note_until(const char *note_path,\n \treturn 0;\n }\n \n-static int write_each_note(const struct object_id *object_oid,\n+static int write_each_note(const struct object_id *object_oid UNUSED,\n \t\tconst struct object_id *note_oid, char *note_path,\n \t\tvoid *cb_data)\n {\n@@ -780,8 +780,9 @@ struct note_delete_list {\n };\n \n static int prune_notes_helper(const struct object_id *object_oid,\n-\t\tconst struct object_id *note_oid, char *note_path,\n-\t\tvoid *cb_data)\n+\t\t\t      const struct object_id *note_oid UNUSED,\n+\t\t\t      char *note_path UNUSED,\n+\t\t\t      void *cb_data)\n {\n \tstruct note_delete_list **l = (struct note_delete_list **) cb_data;\n \tstruct note_delete_list *n;\n@@ -848,8 +849,8 @@ int combine_notes_overwrite(struct object_id *cur_oid,\n \treturn 0;\n }\n \n-int combine_notes_ignore(struct object_id *cur_oid,\n-\t\t\t const struct object_id *new_oid)\n+int combine_notes_ignore(struct object_id *cur_oid UNUSED,\n+\t\t\t const struct object_id *new_oid UNUSED)\n {\n \treturn 0;\n }\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472633","messageId":"Y/hbp4onkIEqELNN@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 16/21] fetch-pack: mark unused parameter in callback function","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:35Z","receivedAt":"2023-02-24T06:40:09Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The for_each_cached_alternate() interface requires a callback that takes\na negotiator parameter, but not all implementations need it. Mark the\nunused one as such to appease -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n fetch-pack.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 04016d1e32..67a7786865 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -722,7 +722,7 @@ static void filter_refs(struct fetch_pack_args *args,\n \t*refs = newlist;\n }\n \n-static void mark_alternate_complete(struct fetch_negotiator *unused,\n+static void mark_alternate_complete(struct fetch_negotiator *negotiator UNUSED,\n \t\t\t\t    struct object *obj)\n {\n \tmark_complete(&obj->oid);\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472634","messageId":"Y/hbqRGwWa0NPTI1@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 17/21] rewrite_parents(): mark unused callback parameter","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:37Z","receivedAt":"2023-02-24T06:40:11Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The rewrite_parents() function takes a callback, but not every callback\nneeds the \"rev\" parameter. Mark the unused one so -Wunused-parameter\nwill be happy.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n line-log.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/line-log.c b/line-log.c\nindex a7f3e7f6ce..1ab2d75f29 100644\n--- a/line-log.c\n+++ b/line-log.c\n@@ -1281,7 +1281,8 @@ int line_log_process_ranges_arbitrary_commit(struct rev_info *rev, struct commit\n \treturn changed;\n }\n \n-static enum rewrite_result line_log_rewrite_one(struct rev_info *rev, struct commit **pp)\n+static enum rewrite_result line_log_rewrite_one(struct rev_info *rev UNUSED,\n+\t\t\t\t\t\tstruct commit **pp)\n {\n \tfor (;;) {\n \t\tstruct commit *p = *pp;\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472635","messageId":"Y/hbrHxK2npFU5lR@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 18/21] for_each_commit_graft(): mark unused callback parameter","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:40Z","receivedAt":"2023-02-24T06:40:18Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The for_each_commit_graft() functions takes a callback, but not every\ncallback uses the void data parameter. Mark the unused one to appease\nthe -Wunused-parameter warning.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n log-tree.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/log-tree.c b/log-tree.c\nindex 1dd5fcbf7b..0f08864ae8 100644\n--- a/log-tree.c\n+++ b/log-tree.c\n@@ -196,7 +196,8 @@ static int add_ref_decoration(const char *refname, const struct object_id *oid,\n \treturn 0;\n }\n \n-static int add_graft_decoration(const struct commit_graft *graft, void *cb_data)\n+static int add_graft_decoration(const struct commit_graft *graft,\n+\t\t\t\tvoid *cb_data UNUSED)\n {\n \tstruct commit *commit = lookup_commit(the_repository, &graft->oid);\n \tif (!commit)\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472636","messageId":"Y/hbr8J0vxKYnd+/@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 19/21] userformat_want_item(): mark unused parameter","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:43Z","receivedAt":"2023-02-24T06:40:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"This function is used as a callback to strbuf_expand(), so it must\nconform to the correct interface. But naturally it doesn't need to touch\nits \"sb\" parameter, since it is only examining the placeholder string,\nand not actually writing any output. So mark the unused parameter to\nsilence -Wunused-parameter.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n pretty.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/pretty.c b/pretty.c\nindex 1e1e21878c..2e47292407 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -1857,7 +1857,8 @@ static size_t format_commit_item(struct strbuf *sb, /* in UTF-8 */\n \treturn consumed + 1;\n }\n \n-static size_t userformat_want_item(struct strbuf *sb, const char *placeholder,\n+static size_t userformat_want_item(struct strbuf *sb UNUSED,\n+\t\t\t\t   const char *placeholder,\n \t\t\t\t   void *context)\n {\n \tstruct userformat_want *w = context;\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472637","messageId":"Y/hbssWC1mtAZN4j@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 20/21] run_processes_parallel: mark unused callback parameters","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:46Z","receivedAt":"2023-02-24T06:40:28Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"Our parallel process API takes several callbacks via function pointers\nin the run_process_paralell_opts struct. Not every callback needs every\nparameter; let's mark the unused ones to make -Wunused-parameter happy.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/fetch.c             |  6 ++++--\n builtin/submodule--helper.c |  4 ++--\n hook.c                      | 12 ++++++------\n submodule.c                 |  4 ++--\n t/helper/test-run-command.c | 14 +++++++-------\n 5 files changed, 21 insertions(+), 19 deletions(-)\n\ndiff --git a/builtin/fetch.c b/builtin/fetch.c\nindex a21ce89312..c6b1845429 100644\n--- a/builtin/fetch.c\n+++ b/builtin/fetch.c\n@@ -1890,7 +1890,8 @@ struct parallel_fetch_state {\n \tint next, result;\n };\n \n-static int fetch_next_remote(struct child_process *cp, struct strbuf *out,\n+static int fetch_next_remote(struct child_process *cp,\n+\t\t\t     struct strbuf *out UNUSED,\n \t\t\t     void *cb, void **task_cb)\n {\n \tstruct parallel_fetch_state *state = cb;\n@@ -1912,7 +1913,8 @@ static int fetch_next_remote(struct child_process *cp, struct strbuf *out,\n \treturn 1;\n }\n \n-static int fetch_failed_to_start(struct strbuf *out, void *cb, void *task_cb)\n+static int fetch_failed_to_start(struct strbuf *out UNUSED,\n+\t\t\t\t void *cb, void *task_cb)\n {\n \tstruct parallel_fetch_state *state = cb;\n \tconst char *remote = task_cb;\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 4c173d8b37..ad272a0d93 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -2132,9 +2132,9 @@ static int update_clone_get_next_task(struct child_process *child,\n \treturn 0;\n }\n \n-static int update_clone_start_failure(struct strbuf *err,\n+static int update_clone_start_failure(struct strbuf *err UNUSED,\n \t\t\t\t      void *suc_cb,\n-\t\t\t\t      void *idx_task_cb)\n+\t\t\t\t      void *idx_task_cb UNUSED)\n {\n \tstruct submodule_update_clone *suc = suc_cb;\n \ndiff --git a/hook.c b/hook.c\nindex 1a84831863..866ef0408b 100644\n--- a/hook.c\n+++ b/hook.c\n@@ -43,9 +43,9 @@ int hook_exists(const char *name)\n }\n \n static int pick_next_hook(struct child_process *cp,\n-\t\t\t  struct strbuf *out,\n+\t\t\t  struct strbuf *out UNUSED,\n \t\t\t  void *pp_cb,\n-\t\t\t  void **pp_task_cb)\n+\t\t\t  void **pp_task_cb UNUSED)\n {\n \tstruct hook_cb_data *hook_cb = pp_cb;\n \tconst char *hook_path = hook_cb->hook_path;\n@@ -77,9 +77,9 @@ static int pick_next_hook(struct child_process *cp,\n \treturn 1;\n }\n \n-static int notify_start_failure(struct strbuf *out,\n+static int notify_start_failure(struct strbuf *out UNUSED,\n \t\t\t\tvoid *pp_cb,\n-\t\t\t\tvoid *pp_task_cp)\n+\t\t\t\tvoid *pp_task_cp UNUSED)\n {\n \tstruct hook_cb_data *hook_cb = pp_cb;\n \n@@ -89,9 +89,9 @@ static int notify_start_failure(struct strbuf *out,\n }\n \n static int notify_hook_finished(int result,\n-\t\t\t\tstruct strbuf *out,\n+\t\t\t\tstruct strbuf *out UNUSED,\n \t\t\t\tvoid *pp_cb,\n-\t\t\t\tvoid *pp_task_cb)\n+\t\t\t\tvoid *pp_task_cb UNUSED)\n {\n \tstruct hook_cb_data *hook_cb = pp_cb;\n \tstruct run_hooks_opt *opt = hook_cb->options;\ndiff --git a/submodule.c b/submodule.c\nindex 3a0dfc417c..a24269db71 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1739,7 +1739,7 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,\n \treturn 0;\n }\n \n-static int fetch_start_failure(struct strbuf *err,\n+static int fetch_start_failure(struct strbuf *err UNUSED,\n \t\t\t       void *cb, void *task_cb)\n {\n \tstruct submodule_parallel_fetch *spf = cb;\n@@ -1760,7 +1760,7 @@ static int commit_missing_in_sub(const struct object_id *oid, void *data)\n \treturn type != OBJ_COMMIT;\n }\n \n-static int fetch_finish(int retvalue, struct strbuf *err,\n+static int fetch_finish(int retvalue, struct strbuf *err UNUSED,\n \t\t\tvoid *cb, void *task_cb)\n {\n \tstruct submodule_parallel_fetch *spf = cb;\ndiff --git a/t/helper/test-run-command.c b/t/helper/test-run-command.c\nindex 3ecb830f4a..98fa224640 100644\n--- a/t/helper/test-run-command.c\n+++ b/t/helper/test-run-command.c\n@@ -24,7 +24,7 @@ static int number_callbacks;\n static int parallel_next(struct child_process *cp,\n \t\t\t struct strbuf *err,\n \t\t\t void *cb,\n-\t\t\t void **task_cb)\n+\t\t\t void **task_cb UNUSED)\n {\n \tstruct child_process *d = cb;\n \tif (number_callbacks >= 4)\n@@ -40,10 +40,10 @@ static int parallel_next(struct child_process *cp,\n \treturn 1;\n }\n \n-static int no_job(struct child_process *cp,\n+static int no_job(struct child_process *cp UNUSED,\n \t\t  struct strbuf *err,\n-\t\t  void *cb,\n-\t\t  void **task_cb)\n+\t\t  void *cb UNUSED,\n+\t\t  void **task_cb UNUSED)\n {\n \tif (err)\n \t\tstrbuf_addstr(err, \"no further jobs available\\n\");\n@@ -52,10 +52,10 @@ static int no_job(struct child_process *cp,\n \treturn 0;\n }\n \n-static int task_finished(int result,\n+static int task_finished(int result UNUSED,\n \t\t\t struct strbuf *err,\n-\t\t\t void *pp_cb,\n-\t\t\t void *pp_task_cb)\n+\t\t\t void *pp_cb UNUSED,\n+\t\t\t void *pp_task_cb UNUSED)\n {\n \tif (err)\n \t\tstrbuf_addstr(err, \"asking for a quick stop\\n\");\n-- \n2.39.2.981.g6157336f25\n\n"},{"id":"472638","messageId":"Y/hbtJOLWjgMnGD7@coredump.intra.peff.net","threadId":"59301","inReplyTo":"Y/habYJxDRJQg/kJ@coredump.intra.peff.net","subject":"[PATCH 21/21] help: mark unused parameter in git_unknown_cmd_config()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2023-02-24T06:39:48Z","receivedAt":"2023-02-24T06:40:29Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The extra callback parameter became unused in 0918d08887 (help.c: fix\nautocorrect in work tree for bare repository, 2022-10-29), but we can't\nget rid of it because we must conform to the config callback interface.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n help.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/help.c b/help.c\nindex 812af4cdea..8393c25586 100644\n--- a/help.c\n+++ b/help.c\n@@ -540,7 +540,8 @@ static struct cmdnames aliases;\n #define AUTOCORRECT_NEVER (-2)\n #define AUTOCORRECT_IMMEDIATELY (-1)\n \n-static int git_unknown_cmd_config(const char *var, const char *value, void *cb)\n+static int git_unknown_cmd_config(const char *var, const char *value,\n+\t\t\t\t  void *cb UNUSED)\n {\n \tconst char *p;\n \n-- \n2.39.2.981.g6157336f25\n"},{"id":"472662","messageId":"xmqqmt530x2f.fsf@gitster.g","threadId":"59301","inReplyTo":"Y/hahKMhm4EYz3Pf@coredump.intra.peff.net","subject":"Re: [PATCH 01/21] ref-filter: drop unused atom parameter from get_worktree_path()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-02-24T17:53:28Z","receivedAt":"2023-02-24T17:53:33Z","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> The get_worktree_path() function is used to populate the %(worktreepath)\n> value, but it has never used its \"atom\" parameter since it was added in\n> 2582083fa1 (ref-filter: add worktreepath atom, 2019-04-28).\n>\n> Normally we'd use the atom struct to cache any work we do, but in this\n> case there's a global hashmap that does that caching already. So we can\n> just drop the unused parameter.\n\nIf this were part of a codepath that were more table-driven, we\nmight have needed to use uniform function signature across these\nhelper functions, but it is not the case, and this solution indeed\nis much nicer than marking it UNUSED.\n\n\n\n> diff --git a/ref-filter.c b/ref-filter.c\n> index f8203c6b05..434a28c830 100644\n> --- a/ref-filter.c\n> +++ b/ref-filter.c\n> @@ -1822,7 +1822,7 @@ static void lazy_init_worktree_map(void)\n>  \tpopulate_worktree_map(&(ref_to_worktree_map.map), ref_to_worktree_map.worktrees);\n>  }\n>  \n> -static char *get_worktree_path(const struct used_atom *atom, const struct ref_array_item *ref)\n> +static char *get_worktree_path(const struct ref_array_item *ref)\n>  {\n>  \tstruct hashmap_entry entry, *e;\n>  \tstruct ref_to_worktree_entry *lookup_result;\n> @@ -1881,7 +1881,7 @@ static int populate_value(struct ref_array_item *ref, struct strbuf *err)\n>  \t\t\trefname = get_refname(atom, ref);\n>  \t\telse if (atom_type == ATOM_WORKTREEPATH) {\n>  \t\t\tif (ref->kind == FILTER_REFS_BRANCHES)\n> -\t\t\t\tv->s = get_worktree_path(atom, ref);\n> +\t\t\t\tv->s = get_worktree_path(ref);\n>  \t\t\telse\n>  \t\t\t\tv->s = xstrdup(\"\");\n>  \t\t\tcontinue;\n"},{"id":"472663","messageId":"xmqqilfr0ws8.fsf@gitster.g","threadId":"59301","inReplyTo":"Y/hbUsGPVNAxTdmS@coredump.intra.peff.net","subject":"Re: [PATCH 03/21] serve: use repository pointer to get config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-02-24T17:59:35Z","receivedAt":"2023-02-24T17:59:40Z","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> A few of the v2 \"serve\" callbacks ignore their repository parameter and\n> read config using the_repository (either directly or implicitly by\n> calling wrapper functions). This isn't a bug since the server code only\n> handles a single main repository anyway (and indeed, if you look at the\n> callers, these repository parameters will always be the_repository). But\n> in the long run we want to get rid of the_repository, so let's take a\n> tiny step in that direction.\n>\n> As a bonus, this silences some -Wunused-parameter warnings.\n\n;-)\n"}]}