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

[PATCH 14/14] t/helper: mark unused callback void data parameters

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

Many callback interfaces have an extra void data parameter, but we don't always need it (especially for dumping functions like the ones in test helpers). Mark them as unused to avoid -Wunused-parameter warnings.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/helper/test-dump-split-index.c | 2 +-
 t/helper/test-oid-array.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index 5cf0b26dca..f29d18ef94 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -7,7 +7,7 @@
 #include "split-index.h"
 #include "ewah/ewok.h"
 
-static void show_bit(size_t pos, void *data)
+static void show_bit(size_t pos, void *data UNUSED)
 {
 	printf(" %d", (int)pos);
 }
diff --git a/t/helper/test-oid-array.c b/t/helper/test-oid-array.c
index eef68833b7..aafe398ef0 100644
--- a/t/helper/test-oid-array.c
+++ b/t/helper/test-oid-array.c
@@ -4,7 +4,7 @@
 #include "setup.h"
 #include "strbuf.h"
 
-static int print_oid(const struct object_id *oid, void *data)
+static int print_oid(const struct object_id *oid, void *data UNUSED)
 {
 	puts(oid_to_hex(oid));
 	return 0;
-- 
2.41.0.586.g3c0cc15bc7
Previous: Jeff King
Message 15 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.