From a92ec7efe0ad25f1c2047230c0324dcb54ce1cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Tue, 11 Dec 2018 16:35:01 +0100 Subject: parse-options: fix SunCC compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 We could shut the compiler up. But instead let's not bury exit() too deep. Do the same as internal -h handling, return a special error code and handle the exit() in parse_options() (and other parse_options_step() callers) instead. Reported-by: Ævar Arnfjörð Bjarmason Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/blame.c | 2 ++ builtin/shortlog.c | 2 ++ builtin/update-index.c | 2 ++ 3 files changed, 6 insertions(+) (limited to 'builtin') diff --git a/builtin/blame.c b/builtin/blame.c index 5a0388aaef..7e880392a6 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -844,6 +844,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix) case PARSE_OPT_HELP: case PARSE_OPT_ERROR: exit(129); + case PARSE_OPT_COMPLETE: + exit(0); case PARSE_OPT_DONE: if (ctx.argv[0]) dashdash_pos = ctx.cpidx; diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 608d6ba77b..e9c12bd392 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -286,6 +286,8 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix) case PARSE_OPT_HELP: case PARSE_OPT_ERROR: exit(129); + case PARSE_OPT_COMPLETE: + exit(0); case PARSE_OPT_DONE: goto parse_done; } diff --git a/builtin/update-index.c b/builtin/update-index.c index a8709a26ec..9d41ba0ad4 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -1071,6 +1071,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix) case PARSE_OPT_HELP: case PARSE_OPT_ERROR: exit(129); + case PARSE_OPT_COMPLETE: + exit(0); case PARSE_OPT_NON_OPTION: case PARSE_OPT_DONE: { -- cgit v1.2.3