The compiler reports this because show_gitcomp() never actually
returns a value:
"parse-options.c", line 520: warning: Function has no return
statement : show_gitcomp
The function calls exit() and will never return. Update and mark it
NORETURN.
Reported-by: Ævar Arnfjörð Bjarmason <[email protected]>
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]>
---
parse-options.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/parse-options.c b/parse-options.c
index 3b874a83a0..6577e52f63 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -474,8 +474,8 @@ static void show_negated_gitcomp(const struct option *opts,
int nr_noopts)
}
}
-static int show_gitcomp(struct parse_opt_ctx_t *ctx,
- const struct option *opts)
+static void NORETURN show_gitcomp(struct parse_opt_ctx_t *ctx,
+ const struct option *opts)
{
const struct option *original_opts = opts;
int nr_noopts = 0;
@@ -550,7 +550,7 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
/* lone --git-completion-helper is asked by git-completion.bash
*/
if (ctx->total == 1 && !strcmp(arg + 1,
"-git-completion-helper"))
- return show_gitcomp(ctx, options);
+ show_gitcomp(ctx, options);
if (arg[1] != '-') {
ctx->opt = arg + 1;
--
2.20.0.rc2.486.g9832c05c3d