run_processes_parallel: mark unused callback parameters

Our parallel process API takes several callbacks via function pointers in the run_process_paralell_opts struct. Not every callback needs every parameter; let's mark the unused ones to make -Wunused-parameter happy. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Feb 24, 2023 at 01:39 UTC a5c76b3698f3672afecd65eed233b095123ae1d6
5 files changed +21 -19
builtin/fetch.c
+4 -2
@@ -1890,7 +1890,8 @@ struct parallel_fetch_state {
1890 int next, result;
1891 };
1892
1893 -static int fetch_next_remote(struct child_process *cp, struct strbuf *out,
1893 +static int fetch_next_remote(struct child_process *cp,
1894 + struct strbuf *out UNUSED,
1895 void *cb, void **task_cb)
1896 {
1897 struct parallel_fetch_state *state = cb;
@@ -1912,7 +1913,8 @@ static int fetch_next_remote(struct child_process *cp, struct strbuf *out,
1913 return 1;
1914 }
1915
1915 -static int fetch_failed_to_start(struct strbuf *out, void *cb, void *task_cb)
1916 +static int fetch_failed_to_start(struct strbuf *out UNUSED,
1917 + void *cb, void *task_cb)
1918 {
1919 struct parallel_fetch_state *state = cb;
1920 const char *remote = task_cb;
builtin/submodule--helper.c
+2 -2
@@ -2132,9 +2132,9 @@ static int update_clone_get_next_task(struct child_process *child,
2132 return 0;
2133 }
2134
2135 -static int update_clone_start_failure(struct strbuf *err,
2135 +static int update_clone_start_failure(struct strbuf *err UNUSED,
2136 void *suc_cb,
2137 - void *idx_task_cb)
2137 + void *idx_task_cb UNUSED)
2138 {
2139 struct submodule_update_clone *suc = suc_cb;
2140
hook.c
+6 -6
@@ -43,9 +43,9 @@ int hook_exists(const char *name)
43 }
44
45 static int pick_next_hook(struct child_process *cp,
46 - struct strbuf *out,
46 + struct strbuf *out UNUSED,
47 void *pp_cb,
48 - void **pp_task_cb)
48 + void **pp_task_cb UNUSED)
49 {
50 struct hook_cb_data *hook_cb = pp_cb;
51 const char *hook_path = hook_cb->hook_path;
@@ -77,9 +77,9 @@ static int pick_next_hook(struct child_process *cp,
77 return 1;
78 }
79
80 -static int notify_start_failure(struct strbuf *out,
80 +static int notify_start_failure(struct strbuf *out UNUSED,
81 void *pp_cb,
82 - void *pp_task_cp)
82 + void *pp_task_cp UNUSED)
83 {
84 struct hook_cb_data *hook_cb = pp_cb;
85
@@ -89,9 +89,9 @@ static int notify_start_failure(struct strbuf *out,
89 }
90
91 static int notify_hook_finished(int result,
92 - struct strbuf *out,
92 + struct strbuf *out UNUSED,
93 void *pp_cb,
94 - void *pp_task_cb)
94 + void *pp_task_cb UNUSED)
95 {
96 struct hook_cb_data *hook_cb = pp_cb;
97 struct run_hooks_opt *opt = hook_cb->options;
submodule.c
+2 -2
@@ -1739,7 +1739,7 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
1739 return 0;
1740 }
1741
1742 -static int fetch_start_failure(struct strbuf *err,
1742 +static int fetch_start_failure(struct strbuf *err UNUSED,
1743 void *cb, void *task_cb)
1744 {
1745 struct submodule_parallel_fetch *spf = cb;
@@ -1760,7 +1760,7 @@ static int commit_missing_in_sub(const struct object_id *oid, void *data)
1760 return type != OBJ_COMMIT;
1761 }
1762
1763 -static int fetch_finish(int retvalue, struct strbuf *err,
1763 +static int fetch_finish(int retvalue, struct strbuf *err UNUSED,
1764 void *cb, void *task_cb)
1765 {
1766 struct submodule_parallel_fetch *spf = cb;
t/helper/test-run-command.c
+7 -7
@@ -24,7 +24,7 @@ static int number_callbacks;
24 static int parallel_next(struct child_process *cp,
25 struct strbuf *err,
26 void *cb,
27 - void **task_cb)
27 + void **task_cb UNUSED)
28 {
29 struct child_process *d = cb;
30 if (number_callbacks >= 4)
@@ -40,10 +40,10 @@ static int parallel_next(struct child_process *cp,
40 return 1;
41 }
42
43 -static int no_job(struct child_process *cp,
43 +static int no_job(struct child_process *cp UNUSED,
44 struct strbuf *err,
45 - void *cb,
46 - void **task_cb)
45 + void *cb UNUSED,
46 + void **task_cb UNUSED)
47 {
48 if (err)
49 strbuf_addstr(err, "no further jobs available\n");
@@ -52,10 +52,10 @@ static int no_job(struct child_process *cp,
52 return 0;
53 }
54
55 -static int task_finished(int result,
55 +static int task_finished(int result UNUSED,
56 struct strbuf *err,
57 - void *pp_cb,
58 - void *pp_task_cb)
57 + void *pp_cb UNUSED,
58 + void *pp_task_cb UNUSED)
59 {
60 if (err)
61 strbuf_addstr(err, "asking for a quick stop\n");