aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/read-tree.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-08-31 17:21:28 -0400
committerJunio C Hamano <gitster@pobox.com>2023-09-05 14:48:17 -0700
commit34bf44f2d50e835a4824a07c139bdececccf4da1 (patch)
treeda25bba200bcb5a9ba3918713ac1d7b80b9bbd78 /builtin/read-tree.c
parentparse-options: prefer opt->value to globals in callbacks (diff)
downloadgit-34bf44f2d50e835a4824a07c139bdececccf4da1.tar.gz
git-34bf44f2d50e835a4824a07c139bdececccf4da1.zip
parse-options: mark unused "opt" parameter in callbacks
The previous commit argued that parse-options callbacks should try to use opt->value rather than touching globals directly. In some cases, however, that's awkward to do. Some callbacks touch multiple variables, or may even just call into an abstracted function that does so. In some of these cases we _could_ convert them by stuffing the multiple variables into a single struct and passing the struct pointer through opt->value. But that may make other parts of the code less readable, as the struct relationship has to be mentioned everywhere. Let's just accept that these cases are special and leave them as-is. But we do need to mark their "opt" parameters to satisfy -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/read-tree.c')
-rw-r--r--builtin/read-tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 1fec702a04..8196ca9dd8 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -49,7 +49,7 @@ static const char * const read_tree_usage[] = {
NULL
};
-static int index_output_cb(const struct option *opt, const char *arg,
+static int index_output_cb(const struct option *opt UNUSED, const char *arg,
int unset)
{
BUG_ON_OPT_NEG(unset);