diff options
| author | Jeff King <peff@peff.net> | 2023-03-28 16:57:04 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-03-28 14:11:24 -0700 |
| commit | 6ba21fa65cbdf97aac337a2857f8ffb072dda29c (patch) | |
| tree | cf75d2ed9b36e47644eb561fff47b00303a4147a /builtin/get-tar-commit-id.c | |
| parent | builtins: mark unused prefix parameters (diff) | |
| download | git-6ba21fa65cbdf97aac337a2857f8ffb072dda29c.tar.gz git-6ba21fa65cbdf97aac337a2857f8ffb072dda29c.zip | |
mark "argv" as unused when we check argc
A few commands don't take any options at all, and confirm this by
checking argc. After that they have no need to look at argv, but we're
still stuck with it by convention. Let's annotate these cases so that
the compiler doesn't complain with -Wunused-parameter.
Note that in scalar and get-tar-commit-id, we're forced to keep argv by
calling convention (the functions must match cmd_main() and builtin
cmd_foo() conventions, respectively). In diff, these are subcommand
modes that we call individually, so we _could_ just drop the argv
parameters entirely. But it's weird to pass argc without argv, and it
implies that the caller knows that the subcommands aren't interested in
further arguments. It's less confusing to just keep them and silence the
compiler warning.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/get-tar-commit-id.c')
| -rw-r--r-- | builtin/get-tar-commit-id.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/get-tar-commit-id.c b/builtin/get-tar-commit-id.c index 8f8f2ac3e6..4324d39fb4 100644 --- a/builtin/get-tar-commit-id.c +++ b/builtin/get-tar-commit-id.c @@ -14,7 +14,7 @@ static const char builtin_get_tar_commit_id_usage[] = #define RECORDSIZE (512) #define HEADERSIZE (2 * RECORDSIZE) -int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix) +int cmd_get_tar_commit_id(int argc, const char **argv UNUSED, const char *prefix) { char buffer[HEADERSIZE]; struct ustar_header *header = (struct ustar_header *)buffer; |
