Replace fallthrough comments with __attribute__((fallthrough))

This has recently been endorsed by the linux kernel, it should be good
enough for us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2021-07-22 15:00:32 +10:00
parent 492f6817d3
commit 234eeabe2f
8 changed files with 194 additions and 192 deletions

View file

@ -121,7 +121,7 @@ post_trackpoint_scroll(struct evdev_device *device,
return true;
case BUTTONSCROLL_READY:
device->scroll.button_scroll_state = BUTTONSCROLL_SCROLLING;
/* fallthrough */
_fallthrough_;
case BUTTONSCROLL_SCROLLING:
evdev_post_scroll(device, time,
LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS,

View file

@ -1249,19 +1249,19 @@ tp_post_clickpadbutton_buttons(struct tp_dispatch *tp, uint64_t time)
break;
case BUTTON_EVENT_IN_TOP_L:
is_top = 1;
/* fallthrough */
_fallthrough_;
case BUTTON_EVENT_IN_BOTTOM_L:
area |= LEFT;
break;
case BUTTON_EVENT_IN_TOP_M:
is_top = 1;
/* fallthrough */
_fallthrough_;
case BUTTON_EVENT_IN_BOTTOM_M:
area |= MIDDLE;
break;
case BUTTON_EVENT_IN_TOP_R:
is_top = 1;
/* fallthrough */
_fallthrough_;
case BUTTON_EVENT_IN_BOTTOM_R:
area |= RIGHT;
break;

View file

@ -404,7 +404,7 @@ tp_edge_scroll_handle_state(struct tp_dispatch *tp, uint64_t time)
"touch %d: unexpected state %d\n",
t->index,
t->state);
/* fallthrough */
_fallthrough_;
case TOUCH_END:
tp_edge_scroll_handle_event(tp,
t,

View file

@ -57,3 +57,5 @@
#define CASE_RETURN_STRING(a) case a: return #a
#define _fallthrough_ __attribute__((fallthrough))

View file

@ -823,13 +823,13 @@ test_gesture_hold(int nfingers)
switch (nfingers) {
case 4:
litest_touch_down(dev, 3, 70, 30);
/* fallthrough */
_fallthrough_;
case 3:
litest_touch_down(dev, 2, 60, 30);
/* fallthrough */
_fallthrough_;
case 2:
litest_touch_down(dev, 1, 50, 30);
/* fallthrough */
_fallthrough_;
case 1:
litest_touch_down(dev, 0, 40, 30);
break;
@ -850,13 +850,13 @@ test_gesture_hold(int nfingers)
switch (nfingers) {
case 4:
litest_touch_up(dev, 3);
/* fallthrough */
_fallthrough_;
case 3:
litest_touch_up(dev, 2);
/* fallthrough */
_fallthrough_;
case 2:
litest_touch_up(dev, 1);
/* fallthrough */
_fallthrough_;
case 1:
litest_touch_up(dev, 0);
break;
@ -888,13 +888,13 @@ test_gesture_hold_cancel(int nfingers)
switch (nfingers) {
case 4:
litest_touch_down(dev, 3, 70, 30);
/* fallthrough */
_fallthrough_;
case 3:
litest_touch_down(dev, 2, 60, 30);
/* fallthrough */
_fallthrough_;
case 2:
litest_touch_down(dev, 1, 50, 30);
/* fallthrough */
_fallthrough_;
case 1:
litest_touch_down(dev, 0, 40, 30);
break;
@ -1655,10 +1655,10 @@ START_TEST(gestures_hold_once_tap_n_drag)
switch (nfingers) {
case 3:
litest_touch_down(dev, 2, 60, 30);
/* fallthrough */
_fallthrough_;
case 2:
litest_touch_down(dev, 1, 50, 30);
/* fallthrough */
_fallthrough_;
case 1:
litest_touch_down(dev, 0, 40, 30);
break;
@ -1669,10 +1669,10 @@ START_TEST(gestures_hold_once_tap_n_drag)
switch (nfingers) {
case 3:
litest_touch_up(dev, 2);
/* fallthrough */
_fallthrough_;
case 2:
litest_touch_up(dev, 1);
/* fallthrough */
_fallthrough_;
case 1:
litest_touch_up(dev, 0);
break;

View file

@ -963,11 +963,11 @@ START_TEST(touchpad_clickfinger_click_drag)
case 3:
if (nslots >= nfingers)
litest_touch_move(dev, 2, 60, 50 + i);
/* fallthrough */
_fallthrough_;
case 2:
if (nslots >= nfingers)
litest_touch_move(dev, 1, 50, 50 + i);
/* fallthrough */
_fallthrough_;
case 1:
litest_touch_move(dev, 0, 40, 50 + i);
break;

File diff suppressed because it is too large Load diff

View file

@ -1407,7 +1407,7 @@ handle_event_tablet(struct libinput_event *ev, struct window *w)
w->tool.y_up = y;
w->tool.is_down = false;
}
/* fallthrough */
_fallthrough_;
case LIBINPUT_EVENT_TABLET_TOOL_AXIS:
w->tool.x = x;
w->tool.y = y;