Skip to content

Commit df9d638

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7046c85 commit df9d638

13 files changed

+13
-13
lines changed

t/unit-tests/t-ctype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
3434
"\x7f"
3535

36-
int cmd_main(int argc, const char **argv) {
36+
int cmd_main(int argc UNUSED, const char **argv UNUSED) {
3737
TEST_CHAR_CLASS(isspace, " \n\r\t");
3838
TEST_CHAR_CLASS(isdigit, DIGIT);
3939
TEST_CHAR_CLASS(isalpha, LOWER UPPER);

t/unit-tests/t-hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static void check_hash_data(const void *data, size_t data_length,
3838
"SHA1 and SHA256 (%s) works", #literal); \
3939
} while (0)
4040

41-
int cmd_main(int argc, const char **argv)
41+
int cmd_main(int argc UNUSED, const char **argv UNUSED)
4242
{
4343
struct strbuf aaaaaaaaaa_100000 = STRBUF_INIT;
4444
struct strbuf alphabet_100000 = STRBUF_INIT;

t/unit-tests/t-mem-pool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static void t_calloc_100(struct mem_pool *pool)
2020
check(pool->mp_block->end != NULL);
2121
}
2222

23-
int cmd_main(int argc, const char **argv)
23+
int cmd_main(int argc UNUSED, const char **argv UNUSED)
2424
{
2525
TEST(setup_static(t_calloc_100, 1024 * 1024),
2626
"mem_pool_calloc returns 100 zeroed bytes with big block");

t/unit-tests/t-prio-queue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void test_prio_queue(int *input, size_t input_size,
6969
#define TEST_INPUT(input, result) \
7070
test_prio_queue(input, ARRAY_SIZE(input), result, ARRAY_SIZE(result))
7171

72-
int cmd_main(int argc, const char **argv)
72+
int cmd_main(int argc UNUSED, const char **argv UNUSED)
7373
{
7474
TEST(TEST_INPUT(((int []){ 2, 6, 3, 10, 9, 5, 7, 4, 5, 8, 1, DUMP }),
7575
((int []){ 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10 })),

t/unit-tests/t-reftable-basics.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static void test_u16_roundtrip(void)
145145
check_int(in, ==, out);
146146
}
147147

148-
int cmd_main(int argc, const char *argv[])
148+
int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
149149
{
150150
TEST(test_common_prefix(), "common_prefix_size works");
151151
TEST(test_parse_names_normal(), "parse_names works for basic input");

t/unit-tests/t-reftable-merged.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ static void t_default_write_opts(void)
452452
}
453453

454454

455-
int cmd_main(int argc, const char *argv[])
455+
int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
456456
{
457457
TEST(t_default_write_opts(), "merged table with default write opts");
458458
TEST(t_merged_logs(), "merged table with multiple log updates for same ref");

t/unit-tests/t-reftable-pq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void t_merged_iter_pqueue_top(void)
142142
merged_iter_pqueue_release(&pq);
143143
}
144144

145-
int cmd_main(int argc, const char *argv[])
145+
int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
146146
{
147147
TEST(t_pq_record(), "pq works with record-based comparison");
148148
TEST(t_pq_index(), "pq works with index-based comparison");

t/unit-tests/t-reftable-record.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ static void t_reftable_index_record_roundtrip(void)
532532
strbuf_release(&in.u.idx.last_key);
533533
}
534534

535-
int cmd_main(int argc, const char *argv[])
535+
int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
536536
{
537537
TEST(t_reftable_ref_record_comparison(), "comparison operations work on ref record");
538538
TEST(t_reftable_log_record_comparison(), "comparison operations work on log record");

t/unit-tests/t-reftable-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static void t_infix_walk(void)
7575
tree_free(root);
7676
}
7777

78-
int cmd_main(int argc, const char *argv[])
78+
int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
7979
{
8080
TEST(t_tree_search(), "tree_search works");
8181
TEST(t_infix_walk(), "infix_walk works");

t/unit-tests/t-strbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static void t_addstr(struct strbuf *buf, const void *data)
105105
check_str(buf->buf + orig_len, text);
106106
}
107107

108-
int cmd_main(int argc, const char **argv)
108+
int cmd_main(int argc UNUSED, const char **argv UNUSED)
109109
{
110110
if (!TEST(t_static_init(), "static initialization works"))
111111
test_skip_all("STRBUF_INIT is broken");

0 commit comments

Comments
 (0)