parseopt: move definition of enum parse_opt_result up
Define enum parse_opt_result before using it in a typedef. This avoids the following compiler warning: ./parse-options.h:53:14: error: ISO C forbids forward references to 'enum' types [-Werror,-Wpedantic] typedef enum parse_opt_result parse_opt_ll_cb(struct parse_opt_ctx_t *ctx, ^ While GCC and Clang both accept such a forward reference by default, other compilers might be less forgiving. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Aug 20, 2019 at 20:49 UTC
19800bdc3f35fd0d0ab1bcef4dfa9ac69968288f
1 file changed
+9
-9
parse-options.h
+9
-9
@@ -45,6 +45,15 @@ enum parse_opt_option_flags {
45
PARSE_OPT_COMP_ARG = 1024
46
};
47
48
+enum parse_opt_result {
49
+ PARSE_OPT_COMPLETE = -3,
50
+ PARSE_OPT_HELP = -2,
51
+ PARSE_OPT_ERROR = -1, /* must be the same as error() */
52
+ PARSE_OPT_DONE = 0, /* fixed so that "return 0" works */
53
+ PARSE_OPT_NON_OPTION,
54
+ PARSE_OPT_UNKNOWN
55
+};
56
+
57
struct option;
58
typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
59
@@ -224,15 +233,6 @@ const char *optname(const struct option *opt, int flags);
233
234
/*----- incremental advanced APIs -----*/
235
227
-enum parse_opt_result {
228
- PARSE_OPT_COMPLETE = -3,
229
- PARSE_OPT_HELP = -2,
230
- PARSE_OPT_ERROR = -1, /* must be the same as error() */
231
- PARSE_OPT_DONE = 0, /* fixed so that "return 0" works */
232
- PARSE_OPT_NON_OPTION,
233
- PARSE_OPT_UNKNOWN
234
-};
235
-
236
/*
237
* It's okay for the caller to consume argv/argc in the usual way.
238
* Other fields of that structure are private to parse-options and should not