Skip to content

Commit 126e3b3

Browse files
peffgitster
authored andcommitted
t/helper: mark unused argv/argc arguments
Many test helper programs do not bother to look at argc or argv, because they don't take any options. In a user-facing program, it's a good idea to check for unexpected arguments and complain. But for a test helper, it's not worth the trouble to enforce this. But we do want to tell the compiler we're OK with ignoring them, to silence -Wunused-parameter (and obviously we can't get rid of them, since we have to conform to the usual cmd__foo() interface). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6ba21fa commit 126e3b3

27 files changed

+33
-32
lines changed

t/helper/test-ctype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static int is_in(const char *s, int ch)
4747
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
4848
"\x7f"
4949

50-
int cmd__ctype(int argc, const char **argv)
50+
int cmd__ctype(int argc UNUSED, const char **argv UNUSED)
5151
{
5252
TEST_CLASS(isdigit, DIGIT);
5353
TEST_CLASS(isspace, " \n\r\t");

t/helper/test-date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static void getnanos(const char **argv)
104104
printf("%lf\n", seconds);
105105
}
106106

107-
int cmd__date(int argc, const char **argv)
107+
int cmd__date(int argc UNUSED, const char **argv)
108108
{
109109
const char *x;
110110

t/helper/test-drop-caches.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ static int cmd_dropcaches(void)
155155

156156
#endif
157157

158-
int cmd__drop_caches(int argc, const char **argv)
158+
int cmd__drop_caches(int argc UNUSED, const char **argv UNUSED)
159159
{
160160
cmd_sync();
161161
return cmd_dropcaches();

t/helper/test-dump-cache-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static int dump_cache_tree(struct cache_tree *it,
5757
return errs;
5858
}
5959

60-
int cmd__dump_cache_tree(int ac, const char **av)
60+
int cmd__dump_cache_tree(int ac UNUSED, const char **av UNUSED)
6161
{
6262
struct index_state istate;
6363
struct cache_tree *another = cache_tree();

t/helper/test-dump-fsmonitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "test-tool.h"
22
#include "cache.h"
33

4-
int cmd__dump_fsmonitor(int ac, const char **av)
4+
int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED)
55
{
66
struct index_state *istate = the_repository->index;
77
int i;

t/helper/test-dump-split-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ static void show_bit(size_t pos, void *data)
1010
printf(" %d", (int)pos);
1111
}
1212

13-
int cmd__dump_split_index(int ac, const char **av)
13+
int cmd__dump_split_index(int ac UNUSED, const char **av)
1414
{
1515
struct split_index *si;
1616
int i;

t/helper/test-dump-untracked-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
4141
strbuf_setlen(base, len);
4242
}
4343

44-
int cmd__dump_untracked_cache(int ac, const char **av)
44+
int cmd__dump_untracked_cache(int ac UNUSED, const char **av UNUSED)
4545
{
4646
struct untracked_cache *uc;
4747
struct strbuf base = STRBUF_INIT;

t/helper/test-example-decorate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "object.h"
44
#include "decorate.h"
55

6-
int cmd__example_decorate(int argc, const char **argv)
6+
int cmd__example_decorate(int argc UNUSED, const char **argv UNUSED)
77
{
88
struct decoration n;
99
struct object_id one_oid = { {1} };

t/helper/test-fsmonitor-client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "trace2.h"
1212

1313
#ifndef HAVE_FSMONITOR_DAEMON_BACKEND
14-
int cmd__fsmonitor_client(int argc, const char **argv)
14+
int cmd__fsmonitor_client(int argc UNUSED, const char **argv UNUSED)
1515
{
1616
die("fsmonitor--daemon not available on this platform");
1717
}

t/helper/test-hexdump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/*
55
* Read stdin and print a hexdump to stdout.
66
*/
7-
int cmd__hexdump(int argc, const char **argv)
7+
int cmd__hexdump(int argc UNUSED, const char **argv UNUSED)
88
{
99
char buf[1024];
1010
ssize_t i, len;

0 commit comments

Comments
 (0)