commit-graph: mark unused data parameters in generation callbacks

The compute_generation_info code uses function pointers to abstract the get/set generation operations. Some callers don't need the extra void data pointer, which should be annotated to appease -Wunused-parameter. Note that we can drop the assignment of the "data" parameter in compute_generation_numbers(), as we've just shown that neither of the callbacks it uses will access it. This matches the caller in ensure_generations_valid(), which already does not bother to set "data". Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 29, 2023 at 19:45 UTC e1cba404dbe54f2bf0511b3bd480c0e05fb65360
1 file changed +5 -4
commit-graph.c
+5 -4
@@ -1568,12 +1568,14 @@ static void compute_topological_levels(struct write_commit_graph_context *ctx)
1568 stop_progress(&ctx->progress);
1569 }
1570
1571 -static timestamp_t get_generation_from_graph_data(struct commit *c, void *data)
1571 +static timestamp_t get_generation_from_graph_data(struct commit *c,
1572 + void *data UNUSED)
1573 {
1574 return commit_graph_data_at(c)->generation;
1575 }
1576
1576 -static void set_generation_v2(struct commit *c, timestamp_t t, void *data)
1577 +static void set_generation_v2(struct commit *c, timestamp_t t,
1578 + void *data UNUSED)
1579 {
1580 struct commit_graph_data *g = commit_graph_data_at(c);
1581 g->generation = t;
@@ -1587,7 +1589,6 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)
1589 .commits = &ctx->commits,
1590 .get_generation = get_generation_from_graph_data,
1591 .set_generation = set_generation_v2,
1590 - .data = ctx,
1592 };
1593
1594 if (ctx->report_progress)
@@ -1616,7 +1617,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx)
1617 }
1618
1619 static void set_generation_in_graph_data(struct commit *c, timestamp_t t,
1619 - void *data)
1620 + void *data UNUSED)
1621 {
1622 commit_graph_data_at(c)->generation = t;
1623 }