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

[PATCH 1/2] gc: drop MAYBE_UNUSED annotation from used parameter

From
Jeff King <peff@peff.net>
Date
Aug 29, 2024, 20:08 UTC
Message-ID
<20240829200833.GA432235@coredump.intra.peff.net>
In-Reply-To
<20240829200807.GA430283@coredump.intra.peff.net>

The "opts" parameter is always used, so marking it with MAYBE_UNUSED is just confusing.

This annotation goes back to 41abfe15d9 (maintenance: add pack-refs task, 2021-02-09), when it really was unused. Back then we did not have the UNUSED macro that would complain if the code changed to use the parameter. So when we started using it in bfc2f9eb8e (builtin/gc: forward git-gc(1)'s `--auto` flag when packing refs, 2024-03-25), nobody noticed.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/gc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index 0e361253e3..7dac971405 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -260,7 +260,7 @@ static int pack_refs_condition(UNUSED struct gc_config *cfg)
 	return 1;
 }
 
-static int maintenance_task_pack_refs(MAYBE_UNUSED struct maintenance_run_opts *opts,
+static int maintenance_task_pack_refs(struct maintenance_run_opts *opts,
 				      UNUSED struct gc_config *cfg)
 {
 	struct child_process cmd = CHILD_PROCESS_INIT;
-- 
2.46.0.761.g18aface1ae
Previous: Jeff KingNext: Jeff King
Message 2 of 7 in “clean up some MAYBE_UNUSED cases”
  1. 0/2 clean up some MAYBE_UNUSED casesJeff King, Aug 29, 2024
  2. 1/2 gc: drop MAYBE_UNUSED annotation from used parameterJeff King, Aug 29, 2024
  3. 2/2 grep: prefer UNUSED to MAYBE_UNUSED for pcre allocatorsJeff King, Aug 29, 2024
  4. Eric SunshineAug 29, 2024
  5. Patrick SteinhardtAug 30, 2024
  6. Junio C HamanoAug 30, 2024
  7. Junio C HamanoAug 29, 2024

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.