mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-01-05 12:30:15 +01:00
test: move the unhandled event type assertion out of the switch
All the switch cases return early, moving it here means we can drop the default case and have the compiler warn us about missing cases. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
5ae3b78689
commit
ae6dbbe61c
3 changed files with 14 additions and 9 deletions
|
|
@ -134,6 +134,8 @@ log_wire_message(struct ei *ei, const ClientMessage *msg, int error)
|
|||
case CLIENT_MESSAGE__MSG_##_name: message = #_name; break;
|
||||
|
||||
switch (msg->msg_case) {
|
||||
case _CLIENT_MESSAGE__MSG_IS_INT_SIZE: /* protobuf-internal thing */
|
||||
return;
|
||||
case CLIENT_MESSAGE__MSG__NOT_SET:
|
||||
abort();
|
||||
MSG_STRING_CASE(CONNECT);
|
||||
|
|
@ -152,10 +154,10 @@ log_wire_message(struct ei *ei, const ClientMessage *msg, int error)
|
|||
MSG_STRING_CASE(TOUCH_UP);
|
||||
MSG_STRING_CASE(CONFIGURE_NAME);
|
||||
MSG_STRING_CASE(CONFIGURE_CAPS);
|
||||
default:
|
||||
assert(!"Unimplemented message type");
|
||||
break;
|
||||
}
|
||||
if (message == NULL)
|
||||
assert(!"Unimplemented message type");
|
||||
|
||||
log_debug(ei, "sending wire message %s (%s)\n", message,
|
||||
strerror(-error));
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@
|
|||
static void
|
||||
eis_event_destroy(struct eis_event *event)
|
||||
{
|
||||
bool handled = false;
|
||||
|
||||
switch (event->type) {
|
||||
case EIS_EVENT_CLIENT_CONNECT:
|
||||
case EIS_EVENT_CLIENT_DISCONNECT:
|
||||
|
|
@ -49,10 +51,13 @@ eis_event_destroy(struct eis_event *event)
|
|||
case EIS_EVENT_TOUCH_DOWN:
|
||||
case EIS_EVENT_TOUCH_MOTION:
|
||||
case EIS_EVENT_TOUCH_UP:
|
||||
handled = true;
|
||||
break;
|
||||
default:
|
||||
abort(); /* not yet implemented */
|
||||
}
|
||||
|
||||
if (!handled)
|
||||
abort(); /* not yet implemented */
|
||||
|
||||
event->device = eis_device_unref(event->device);
|
||||
event->seat = eis_seat_unref(event->seat);
|
||||
event->client = eis_client_unref(event->client);
|
||||
|
|
|
|||
|
|
@ -943,10 +943,9 @@ peck_ei_event_type_name(enum ei_event_type type)
|
|||
CASE_STRING(DEVICE_REMOVED);
|
||||
CASE_STRING(DEVICE_PAUSED);
|
||||
CASE_STRING(DEVICE_RESUMED);
|
||||
default:
|
||||
assert(!"Unhandled ei event type");
|
||||
}
|
||||
#undef CASE_STRING
|
||||
assert(!"Unhandled ei event type");
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
@ -974,8 +973,7 @@ peck_eis_event_type_name(enum eis_event_type type)
|
|||
CASE_STRING(TOUCH_DOWN);
|
||||
CASE_STRING(TOUCH_UP);
|
||||
CASE_STRING(TOUCH_MOTION);
|
||||
default:
|
||||
assert(!"Unhandled EIS event type");
|
||||
}
|
||||
#undef CASE_STRING
|
||||
assert(!"Unhandled EIS event type");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue