diff options
author | Jeff King <peff@peff.net> | 2020-09-30 08:29:02 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-30 12:53:47 -0700 |
commit | 8d2aa8dfac4048c964453a8983f1dc12ecdfe1c3 (patch) | |
tree | 7fcfc22925c483d85e519390335a23ea866a6315 /builtin/env--helper.c | |
parent | env--helper: write to opt->value in parseopt helper (diff) | |
download | tgif-8d2aa8dfac4048c964453a8983f1dc12ecdfe1c3.tar.xz |
assert PARSE_OPT_NONEG in parse-options callbacks
In the spirit of 517fe807d6 (assert NOARG/NONEG behavior of
parse-options callbacks, 2018-11-05), let's cover some parse-options
callbacks which expect to be used with PARSE_OPT_NONEG but don't
explicitly assert that this is the case. These callbacks are all used
correctly in the current code, but this will help document their
expectations and future-proof the code.
As a bonus, it also silences -Wunused-parameters (these were added since
the initial sweep of 517fe807d6, and we can't yet turn on
-Wunused-parameters to remind people because it has too many existing
false positives).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/env--helper.c')
-rw-r--r-- | builtin/env--helper.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/env--helper.c b/builtin/env--helper.c index 3aa4282114..27349098b0 100644 --- a/builtin/env--helper.c +++ b/builtin/env--helper.c @@ -17,6 +17,8 @@ static int option_parse_type(const struct option *opt, const char *arg, { enum cmdmode *cmdmode = opt->value; + BUG_ON_OPT_NEG(unset); + if (!strcmp(arg, "bool")) *cmdmode = ENV_HELPER_TYPE_BOOL; else if (!strcmp(arg, "ulong")) |