Skip to content

Commit d2bff22

Browse files
pcloudsgitster
authored andcommitted
connect.c: mark die_initial_contact() NORETURN
There is a series running in parallel with this one that adds code like this switch (...) { case ...: die_initial_contact(); case ...: There is nothing wrong with this. There is no actual falling through. But since gcc is not that smart and gcc 7.x introduces -Wimplicit-fallthrough, it raises a false alarm in this case. This class of warnings may be useful elsewhere, so instead of suppressing the whole class, let's try to fix just this code. gcc is smart enough to realize that no execution can continue after a NORETURN function call and no longer raises the warning. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d32eb83 commit d2bff22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

connect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int check_ref_type(const struct ref *ref, int flags)
4646
return check_ref(ref->name, flags);
4747
}
4848

49-
static void die_initial_contact(int unexpected)
49+
static NORETURN void die_initial_contact(int unexpected)
5050
{
5151
if (unexpected)
5252
die(_("The remote end hung up upon initial contact"));

0 commit comments

Comments
 (0)