Fix -Wreturn-type warnings

When calling assert(0) instead of returning a value, -Wreturn-type
warnings are triggered because assertions can be disabled. Replace these
assertions with abort().
This commit is contained in:
Simon Ser 2020-05-19 12:23:23 +02:00 committed by Drew DeVault
parent 666498db01
commit 781ed1ff02
4 changed files with 4 additions and 9 deletions

View File

@ -118,8 +118,7 @@ static enum wlr_tablet_tool_type wlr_type_from_libinput_type(
return WLR_TABLET_TOOL_TYPE_TOTEM; return WLR_TABLET_TOOL_TYPE_TOTEM;
#endif #endif
} }
abort(); // unreachable
assert(false && "UNREACHABLE");
} }
static struct wlr_libinput_tablet_tool *get_wlr_tablet_tool( static struct wlr_libinput_tablet_tool *get_wlr_tablet_tool(

View File

@ -466,7 +466,6 @@ static void handle_tablet_tool_done(void *data,
} }
static enum wlr_tablet_tool_type tablet_type_to_wlr_type(enum zwp_tablet_tool_v2_type type) { static enum wlr_tablet_tool_type tablet_type_to_wlr_type(enum zwp_tablet_tool_v2_type type) {
switch (type) { switch (type) {
case ZWP_TABLET_TOOL_V2_TYPE_PEN: case ZWP_TABLET_TOOL_V2_TYPE_PEN:
return WLR_TABLET_TOOL_TYPE_PEN; return WLR_TABLET_TOOL_TYPE_PEN;
@ -485,8 +484,7 @@ static enum wlr_tablet_tool_type tablet_type_to_wlr_type(enum zwp_tablet_tool_v2
default: default:
break; break;
} }
abort(); // unreachable
assert(false && "Unreachable");
} }
static void handle_tablet_tool_type(void *data, static void handle_tablet_tool_type(void *data,

View File

@ -75,10 +75,8 @@ static enum zwp_tablet_tool_v2_type tablet_type_from_wlr_type(
return ZWP_TABLET_TOOL_V2_TYPE_LENS; return ZWP_TABLET_TOOL_V2_TYPE_LENS;
default: default:
/* We skip these devices earlier on */ /* We skip these devices earlier on */
assert(false && "Unreachable"); abort(); // unreachable
} }
assert(false && "Unreachable");
} }
void destroy_tablet_tool_v2(struct wl_resource *resource) { void destroy_tablet_tool_v2(struct wl_resource *resource) {

View File

@ -176,7 +176,7 @@ static bool positioner_anchor_has_edge(enum xdg_positioner_anchor anchor,
anchor == XDG_POSITIONER_ANCHOR_TOP_RIGHT || anchor == XDG_POSITIONER_ANCHOR_TOP_RIGHT ||
anchor == XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT; anchor == XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT;
default: default:
assert(false); // not reached abort(); // unreachable
} }
} }