diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-03-20 09:16:08 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-20 09:16:08 +0300 |
commit | 0c45fa32ec87b15fd828bcbfc41d0d2349b4e7ad (patch) | |
tree | d5b89f725b7eea211471cab1fae3a8a63e868e05 /parse-options.h | |
parent | f6c75e392e2d8426b622408ae74f0e2b545609a7 (diff) | |
parent | cbdeab98e871bfbb45cf5095cc804ebb07054eba (diff) |
Merge branch 'br/commit-tree-parseopt'
The command line parser of "git commit-tree" has been rewritten to
use the parse-options API.
* br/commit-tree-parseopt:
commit-tree: utilize parse-options api
Diffstat (limited to 'parse-options.h')
-rw-r--r-- | parse-options.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/parse-options.h b/parse-options.h index 7d83e2971d..74cce4e7fc 100644 --- a/parse-options.h +++ b/parse-options.h @@ -222,6 +222,17 @@ const char *optname(const struct option *opt, int flags); BUG("option callback does not expect an argument"); \ } while (0) +/* + * Similar to the assertions above, but checks that "arg" is always non-NULL. + * This assertion also implies BUG_ON_OPT_NEG(), letting you declare both + * assertions in a single line. + */ +#define BUG_ON_OPT_NEG_NOARG(unset, arg) do { \ + BUG_ON_OPT_NEG(unset); \ + if(!(arg)) \ + BUG("option callback expects an argument"); \ +} while(0) + /*----- incremental advanced APIs -----*/ enum parse_opt_result { |