Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
parseopt: move definition of enum parse_opt_result up
author
René Scharfe
<l.s.r@web.de>
Tue, 20 Aug 2019 18:49:07 +0000
(20:49 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 20 Aug 2019 19:37:30 +0000
(12:37 -0700)
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>
parse-options.h
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
f7e68a0
)
diff --git
a/parse-options.h
b/parse-options.h
index 7d83e2971d9afa11b11d6187bd96afb88cbb6118..c4713a06c6fec30293d3de13f0ecdb2c93961d98 100644
(file)
--- a/
parse-options.h
+++ b/
parse-options.h
@@
-45,6
+45,15
@@
enum parse_opt_option_flags {
PARSE_OPT_COMP_ARG = 1024
};
PARSE_OPT_COMP_ARG = 1024
};
+enum parse_opt_result {
+ PARSE_OPT_COMPLETE = -3,
+ PARSE_OPT_HELP = -2,
+ PARSE_OPT_ERROR = -1, /* must be the same as error() */
+ PARSE_OPT_DONE = 0, /* fixed so that "return 0" works */
+ PARSE_OPT_NON_OPTION,
+ PARSE_OPT_UNKNOWN
+};
+
struct option;
typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
struct option;
typedef int parse_opt_cb(const struct option *, const char *arg, int unset);
@@
-224,15
+233,6
@@
const char *optname(const struct option *opt, int flags);
/*----- incremental advanced APIs -----*/
/*----- incremental advanced APIs -----*/
-enum parse_opt_result {
- PARSE_OPT_COMPLETE = -3,
- PARSE_OPT_HELP = -2,
- PARSE_OPT_ERROR = -1, /* must be the same as error() */
- PARSE_OPT_DONE = 0, /* fixed so that "return 0" works */
- PARSE_OPT_NON_OPTION,
- PARSE_OPT_UNKNOWN
-};
-
/*
* It's okay for the caller to consume argv/argc in the usual way.
* Other fields of that structure are private to parse-options and should not
/*
* It's okay for the caller to consume argv/argc in the usual way.
* Other fields of that structure are private to parse-options and should not