]> git.ipfire.org Git - thirdparty/git.git/commitdiff
unit-tests: ignore unused argc/argv
authorJeff King <peff@peff.net>
Sat, 17 Aug 2024 08:23:09 +0000 (04:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sat, 17 Aug 2024 16:46:12 +0000 (09:46 -0700)
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>
13 files changed:
t/unit-tests/t-ctype.c
t/unit-tests/t-hash.c
t/unit-tests/t-mem-pool.c
t/unit-tests/t-prio-queue.c
t/unit-tests/t-reftable-basics.c
t/unit-tests/t-reftable-merged.c
t/unit-tests/t-reftable-pq.c
t/unit-tests/t-reftable-record.c
t/unit-tests/t-reftable-tree.c
t/unit-tests/t-strbuf.c
t/unit-tests/t-strcmp-offset.c
t/unit-tests/t-strvec.c
t/unit-tests/t-trailer.c

index d6ac1fe678dc73c6e126c6d1357c21d0af267a56..24cc566cfe9716f633cccbcc3d5a2d685592f94a 100644 (file)
@@ -33,7 +33,7 @@
        "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
        "\x7f"
 
-int cmd_main(int argc, const char **argv) {
+int cmd_main(int argc UNUSED, const char **argv UNUSED) {
        TEST_CHAR_CLASS(isspace, " \n\r\t");
        TEST_CHAR_CLASS(isdigit, DIGIT);
        TEST_CHAR_CLASS(isalpha, LOWER UPPER);
index e9a78bf2c0a755ca703a7196680838f124561702..e62647019bcd479c4c0aef5bf2c5bc191352121e 100644 (file)
@@ -38,7 +38,7 @@ static void check_hash_data(const void *data, size_t data_length,
                     "SHA1 and SHA256 (%s) works", #literal); \
        } while (0)
 
-int cmd_main(int argc, const char **argv)
+int cmd_main(int argc UNUSED, const char **argv UNUSED)
 {
        struct strbuf aaaaaaaaaa_100000 = STRBUF_INIT;
        struct strbuf alphabet_100000 = STRBUF_INIT;
index a0d57df7616fb658175cc6892d01da38c04171ad..fe500c704b3c8a75c6eab8713c84cd27f60e84a9 100644 (file)
@@ -20,7 +20,7 @@ static void t_calloc_100(struct mem_pool *pool)
        check(pool->mp_block->end != NULL);
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd_main(int argc UNUSED, const char **argv UNUSED)
 {
        TEST(setup_static(t_calloc_100, 1024 * 1024),
             "mem_pool_calloc returns 100 zeroed bytes with big block");
index 7a4e5780e1c7095239867e026d424395032c671a..fe6ae37935b8a8de9f4446dda7598b0c2b8bfc76 100644 (file)
@@ -69,7 +69,7 @@ static void test_prio_queue(int *input, size_t input_size,
 #define TEST_INPUT(input, result) \
        test_prio_queue(input, ARRAY_SIZE(input), result, ARRAY_SIZE(result))
 
-int cmd_main(int argc, const char **argv)
+int cmd_main(int argc UNUSED, const char **argv UNUSED)
 {
        TEST(TEST_INPUT(((int []){ 2, 6, 3, 10, 9, 5, 7, 4, 5, 8, 1, DUMP }),
                        ((int []){ 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10 })),
index 4e80bdf16df0deb46d48ce01e548fb75ef466a79..7ffee74dca87f61a56a3f7dbfe105d58e691cac2 100644 (file)
@@ -145,7 +145,7 @@ static void test_u16_roundtrip(void)
        check_int(in, ==, out);
 }
 
-int cmd_main(int argc, const char *argv[])
+int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
 {
        TEST(test_common_prefix(), "common_prefix_size works");
        TEST(test_parse_names_normal(), "parse_names works for basic input");
index b6263ee8b5a1f667e357a426a0b6e09a74748403..2d65d5c3cbcdbfec9c8db6303a5eb2b78a5e2f70 100644 (file)
@@ -452,7 +452,7 @@ static void t_default_write_opts(void)
 }
 
 
-int cmd_main(int argc, const char *argv[])
+int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
 {
        TEST(t_default_write_opts(), "merged table with default write opts");
        TEST(t_merged_logs(), "merged table with multiple log updates for same ref");
index 039bd0f1f9893f1a869024ca79324c8c7dd56ef4..ada4c19f18afe7ad98d4bd7f6171ac1e4991c8da 100644 (file)
@@ -142,7 +142,7 @@ static void t_merged_iter_pqueue_top(void)
        merged_iter_pqueue_release(&pq);
 }
 
-int cmd_main(int argc, const char *argv[])
+int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
 {
        TEST(t_pq_record(), "pq works with record-based comparison");
        TEST(t_pq_index(), "pq works with index-based comparison");
index cb649ee419a015ea9583c3be232b964df2e75f67..a7f67d4d9f26015571dba312a4353c763cf6aab5 100644 (file)
@@ -532,7 +532,7 @@ static void t_reftable_index_record_roundtrip(void)
        strbuf_release(&in.u.idx.last_key);
 }
 
-int cmd_main(int argc, const char *argv[])
+int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
 {
        TEST(t_reftable_ref_record_comparison(), "comparison operations work on ref record");
        TEST(t_reftable_log_record_comparison(), "comparison operations work on log record");
index e7d774d7743c95bfce1a924832790e3e060ff8d9..700479d34b109683177b9d98dacb32ad63f9e945 100644 (file)
@@ -75,7 +75,7 @@ static void t_infix_walk(void)
        tree_free(root);
 }
 
-int cmd_main(int argc, const char *argv[])
+int cmd_main(int argc UNUSED, const char *argv[] UNUSED)
 {
        TEST(t_tree_search(), "tree_search works");
        TEST(t_infix_walk(), "infix_walk works");
index 6027dafef70867b10fb12e395868c4829a9a1082..3f4044d69797cbcc65b73338395bd284c1018628 100644 (file)
@@ -105,7 +105,7 @@ static void t_addstr(struct strbuf *buf, const void *data)
        check_str(buf->buf + orig_len, text);
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd_main(int argc UNUSED, const char **argv UNUSED)
 {
        if (!TEST(t_static_init(), "static initialization works"))
                test_skip_all("STRBUF_INIT is broken");
index fe4c2706b1665b392e43ec9c493d5838c13afc64..6880f21161e6a8de7b1815688619aeb30a2fbd66 100644 (file)
@@ -24,7 +24,7 @@ static void check_strcmp_offset(const char *string1, const char *string2,
                                 expect_offset),                           \
             "strcmp_offset(%s, %s) works", #string1, #string2)
 
-int cmd_main(int argc, const char **argv)
+int cmd_main(int argc UNUSED, const char **argv UNUSED)
 {
        TEST_STRCMP_OFFSET("abc", "abc", 0, 3);
        TEST_STRCMP_OFFSET("abc", "def", -1, 0);
index fa1a04146997c73f74b04a4e6f041f4059185761..c3b610dda7a8b2d920724e79d486fdce6414f12a 100644 (file)
@@ -227,7 +227,7 @@ static void t_detach(void)
        free(detached);
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd_main(int argc UNUSED, const char **argv UNUSED)
 {
        TEST(t_static_init(), "static initialization");
        TEST(t_dynamic_init(), "dynamic initialization");
index 2ecca359d963346a13a38d113a65a550d885b990..e1c6ad7461ed2ebe1e0671f27342d415b96ec19b 100644 (file)
@@ -308,7 +308,7 @@ static void run_t_trailer_iterator(void)
        }
 }
 
-int cmd_main(int argc, const char **argv)
+int cmd_main(int argc UNUSED, const char **argv UNUSED)
 {
        run_t_trailer_iterator();
        return test_done();