travis-ci: build with the right compiler
[gitweb.git] / parse-options.h
index c3f2d2eceb5ade24afc642167a635f52ea56a37c..a650a7d220bd972b10b7e4a30119e9de3b8ba23a 100644 (file)
@@ -191,9 +191,24 @@ extern int opterror(const struct option *opt, const char *reason, int flags);
 #define opterror(o,r,f) (opterror((o),(r),(f)), const_error())
 #endif
 
+/*
+ * Use these assertions for callbacks that expect to be called with NONEG and
+ * NOARG respectively, and do not otherwise handle the "unset" and "arg"
+ * parameters.
+ */
+#define BUG_ON_OPT_NEG(unset) do { \
+       if ((unset)) \
+               BUG("option callback does not expect negation"); \
+} while (0)
+#define BUG_ON_OPT_ARG(arg) do { \
+       if ((arg)) \
+               BUG("option callback does not expect an argument"); \
+} while (0)
+
 /*----- incremental advanced APIs -----*/
 
 enum {
+       PARSE_OPT_COMPLETE = -2,
        PARSE_OPT_HELP = -1,
        PARSE_OPT_DONE,
        PARSE_OPT_NON_OPTION,