unit-tests: ignore unused argc/argv

All of the unit test programs have their own cmd_main() function, but none of them actually look at the argc/argv that is passed in. In the long run we may want them to handle options for the test harness. But we'd probably do that with a shared harness cmd_main(), dispatching to the individual tests. In the meantime, let's annotate the unused parameters to avoid triggering -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 17, 2024 at 04:23 UTC df9d638c24562707d18f0ac1836abc99c8541176
13 files changed +13 -13
t/unit-tests/t-ctype.c
+1 -1
@@ -33,7 +33,7 @@
33 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
34 "\x7f"
35
36 -int cmd_main(int argc, const char **argv) {
36 +int cmd_main(int argc UNUSED, const char **argv UNUSED) {
37 TEST_CHAR_CLASS(isspace, " \n\r\t");
38 TEST_CHAR_CLASS(isdigit, DIGIT);
39 TEST_CHAR_CLASS(isalpha, LOWER UPPER);
t/unit-tests/t-hash.c
+1 -1
@@ -38,7 +38,7 @@ static void check_hash_data(const void *data, size_t data_length,
38 "SHA1 and SHA256 (%s) works", #literal); \
39 } while (0)
40
41 -int cmd_main(int argc, const char **argv)
41 +int cmd_main(int argc UNUSED, const char **argv UNUSED)
42 {
43 struct strbuf aaaaaaaaaa_100000 = STRBUF_INIT;
44 struct strbuf alphabet_100000 = STRBUF_INIT;
t/unit-tests/t-mem-pool.c
+1 -1
@@ -20,7 +20,7 @@ static void t_calloc_100(struct mem_pool *pool)
20 check(pool->mp_block->end != NULL);
21 }
22
23 -int cmd_main(int argc, const char **argv)
23 +int cmd_main(int argc UNUSED, const char **argv UNUSED)
24 {
25 TEST(setup_static(t_calloc_100, 1024 * 1024),
26 "mem_pool_calloc returns 100 zeroed bytes with big block");
t/unit-tests/t-prio-queue.c
+1 -1
@@ -69,7 +69,7 @@ static void test_prio_queue(int *input, size_t input_size,
69 #define TEST_INPUT(input, result) \
70 test_prio_queue(input, ARRAY_SIZE(input), result, ARRAY_SIZE(result))
71
72 -int cmd_main(int argc, const char **argv)
72 +int cmd_main(int argc UNUSED, const char **argv UNUSED)
73 {
74 TEST(TEST_INPUT(((int []){ 2, 6, 3, 10, 9, 5, 7, 4, 5, 8, 1, DUMP }),
75 ((int []){ 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10 })),
t/unit-tests/t-reftable-basics.c
+1 -1
@@ -145,7 +145,7 @@ static void test_u16_roundtrip(void)
145 check_int(in, ==, out);
146 }
147
148 -int cmd_main(int argc, const char *argv[])
148 +int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
149 {
150 TEST(test_common_prefix(), "common_prefix_size works");
151 TEST(test_parse_names_normal(), "parse_names works for basic input");
t/unit-tests/t-reftable-merged.c
+1 -1
@@ -452,7 +452,7 @@ static void t_default_write_opts(void)
452 }
453
454
455 -int cmd_main(int argc, const char *argv[])
455 +int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
456 {
457 TEST(t_default_write_opts(), "merged table with default write opts");
458 TEST(t_merged_logs(), "merged table with multiple log updates for same ref");
t/unit-tests/t-reftable-pq.c
+1 -1
@@ -142,7 +142,7 @@ static void t_merged_iter_pqueue_top(void)
142 merged_iter_pqueue_release(&pq);
143 }
144
145 -int cmd_main(int argc, const char *argv[])
145 +int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
146 {
147 TEST(t_pq_record(), "pq works with record-based comparison");
148 TEST(t_pq_index(), "pq works with index-based comparison");
t/unit-tests/t-reftable-record.c
+1 -1
@@ -532,7 +532,7 @@ static void t_reftable_index_record_roundtrip(void)
532 strbuf_release(&in.u.idx.last_key);
533 }
534
535 -int cmd_main(int argc, const char *argv[])
535 +int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
536 {
537 TEST(t_reftable_ref_record_comparison(), "comparison operations work on ref record");
538 TEST(t_reftable_log_record_comparison(), "comparison operations work on log record");
t/unit-tests/t-reftable-tree.c
+1 -1
@@ -75,7 +75,7 @@ static void t_infix_walk(void)
75 tree_free(root);
76 }
77
78 -int cmd_main(int argc, const char *argv[])
78 +int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
79 {
80 TEST(t_tree_search(), "tree_search works");
81 TEST(t_infix_walk(), "infix_walk works");
t/unit-tests/t-strbuf.c
+1 -1
@@ -105,7 +105,7 @@ static void t_addstr(struct strbuf *buf, const void *data)
105 check_str(buf->buf + orig_len, text);
106 }
107
108 -int cmd_main(int argc, const char **argv)
108 +int cmd_main(int argc UNUSED, const char **argv UNUSED)
109 {
110 if (!TEST(t_static_init(), "static initialization works"))
111 test_skip_all("STRBUF_INIT is broken");
t/unit-tests/t-strcmp-offset.c
+1 -1
@@ -24,7 +24,7 @@ static void check_strcmp_offset(const char *string1, const char *string2,
24 expect_offset), \
25 "strcmp_offset(%s, %s) works", #string1, #string2)
26
27 -int cmd_main(int argc, const char **argv)
27 +int cmd_main(int argc UNUSED, const char **argv UNUSED)
28 {
29 TEST_STRCMP_OFFSET("abc", "abc", 0, 3);
30 TEST_STRCMP_OFFSET("abc", "def", -1, 0);
t/unit-tests/t-strvec.c
+1 -1
@@ -227,7 +227,7 @@ static void t_detach(void)
227 free(detached);
228 }
229
230 -int cmd_main(int argc, const char **argv)
230 +int cmd_main(int argc UNUSED, const char **argv UNUSED)
231 {
232 TEST(t_static_init(), "static initialization");
233 TEST(t_dynamic_init(), "dynamic initialization");
t/unit-tests/t-trailer.c
+1 -1
@@ -308,7 +308,7 @@ static void run_t_trailer_iterator(void)
308 }
309 }
310
311 -int cmd_main(int argc, const char **argv)
311 +int cmd_main(int argc UNUSED, const char **argv UNUSED)
312 {
313 run_t_trailer_iterator();
314 return test_done();