From 56f56ac50b932310c629832fad256e624ca451e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Wed, 16 Dec 2020 00:50:27 +0100 Subject: style: do not "break" in switch() after "return" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove this unreachable code. It was found by SunCC, it's found by a non-fatal warning emitted by SunCC. It's one of the things it's more vehement about than GCC & Clang. It complains about a lot of other similarly unreachable code, e.g. a BUG(...) without a "return", and a "return 0" after a long if/else, both of whom have "return" statements. Those are also genuine redundancies to a compiler, but arguably make the code a bit easier to read & less fragile to maintain. These return/break cases are just unnecessary however, and as seen here the surrounding code just did a plain "return" without a "break" already. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- apply.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'apply.c') diff --git a/apply.c b/apply.c index 76dba93c97..66cf94393e 100644 --- a/apply.c +++ b/apply.c @@ -3948,10 +3948,8 @@ static int check_patch(struct apply_state *state, struct patch *patch) break; /* happy */ case EXISTS_IN_INDEX: return error(_("%s: already exists in index"), new_name); - break; case EXISTS_IN_INDEX_AS_ITA: return error(_("%s: does not match index"), new_name); - break; case EXISTS_IN_WORKTREE: return error(_("%s: already exists in working directory"), new_name); -- cgit v1.2.3