git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 09/14] merge-tree: mark unused parameter in traverse callback

From
Jeff King <peff@peff.net>
Date
Jul 3, 2023, 06:44 UTC
Message-ID
<20230703064421.GI3537614@coredump.intra.peff.net>
In-Reply-To
<20230703064347.GA3524892@coredump.intra.peff.net>

Our threeway_callback() does not bother to look at its "n" parameter. It is static in this file and used only by trivial_merge_trees(), which always passes 3 trees (hence the name "threeway"). It also does not look at "dirmask". This is OK, as it handles directories specifically by looking at the mode bits.

Other traverse_info callbacks need these, so we can't get drop them from the interface. But let's annotate these ones to avoid complaints from -Wunused-parameter.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/merge-tree.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index 6f7db436d2..0de42aecf4 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -324,7 +324,9 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])
  * The successful merge rules are the same as for the three-way merge
  * in git-read-tree.
  */
-static int threeway_callback(int n, unsigned long mask, unsigned long dirmask, struct name_entry *entry, struct traverse_info *info)
+static int threeway_callback(int n UNUSED, unsigned long mask,
+			     unsigned long dirmask UNUSED,
+			     struct name_entry *entry, struct traverse_info *info)
 {
 	/* Same in both? */
 	if (same_entry(entry+1, entry+2) || both_empty(entry+1, entry+2)) {
-- 
2.41.0.586.g3c0cc15bc7
Previous: Jeff KingNext: Jeff King
Message 10 of 15 in “more -Wunused-parameter annotations”
  1. 0/14 more -Wunused-parameter annotationsJeff King, Jul 3, 2023
  2. 01/14 test-ref-store: drop unimplemented reflog-expire commandJeff King, Jul 3, 2023
  3. 02/14 do_for_each_ref_helper(): mark unused repository parameterJeff King, Jul 3, 2023
  4. 03/14 http: mark unused parameters in curl callbacksJeff King, Jul 3, 2023
  5. 04/14 http-push: mark unused parameter in xml callbackJeff King, Jul 3, 2023
  6. 05/14 am: mark unused keep_cr parametersJeff King, Jul 3, 2023
  7. 06/14 count-objects: mark unused parameter in alternates callbackJeff King, Jul 3, 2023
  8. 07/14 revisions: drop unused "opt" parameter in "tweak" callbacksJeff King, Jul 3, 2023
  9. 08/14 fsck: mark unused parameters in various fsck callbacksJeff King, Jul 3, 2023
  10. 09/14 merge-tree: mark unused parameter in traverse callbackJeff King, Jul 3, 2023
  11. 10/14 replace: mark unused parameter in ref callbackJeff King, Jul 3, 2023
  12. 11/14 replace: mark unused parameter in each_mergetag_fn callbackJeff King, Jul 3, 2023
  13. 12/14 rev-parse: mark unused parameter in for_each_abbrev callbackJeff King, Jul 3, 2023
  14. 13/14 tag: mark unused parameters in each_tag_name_fn callbacksJeff King, Jul 3, 2023
  15. 14/14 t/helper: mark unused callback void data parametersJeff King, Jul 3, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.