Thread (115 messages) 115 messages, 4 authors, 2018-12-11
STALE2848d

[PATCH] parse-options: fix SunCC compiler warning

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2018-12-09 10:27:34
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help