From c53e6cc20ca0c41a47f834306f453a55b7c117c4 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 12 Jun 2017 07:47:44 +0200 Subject: [PATCH] Make the compiler STFU about desired fallthroughs. * https://dzone.com/articles/implicit-fallthrough-in-gcc-7 --- source/view.c | 7 +++++++ source/widgets/listview.c | 1 + 2 files changed, 8 insertions(+) diff --git a/source/view.c b/source/view.c index 21782f1d..a6c9ac41 100644 --- a/source/view.c +++ b/source/view.c @@ -288,25 +288,30 @@ static void rofi_view_calculate_window_position ( RofiViewState *state ) { case WL_NORTH_WEST: state->x = CacheState.mon.x; + __attribute__ ((fallthrough)); case WL_NORTH: state->y = CacheState.mon.y; break; case WL_NORTH_EAST: state->y = CacheState.mon.y; + __attribute__ ((fallthrough)); case WL_EAST: state->x = CacheState.mon.x + CacheState.mon.w; break; case WL_SOUTH_EAST: state->x = CacheState.mon.x + CacheState.mon.w; + __attribute__ ((fallthrough)); case WL_SOUTH: state->y = CacheState.mon.y + CacheState.mon.h; break; case WL_SOUTH_WEST: state->y = CacheState.mon.y + CacheState.mon.h; + __attribute__ ((fallthrough)); case WL_WEST: state->x = CacheState.mon.x; break; case WL_CENTER: + __attribute__ ((fallthrough)); default: break; } @@ -1337,8 +1342,10 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, BindingsScope scope, g return FALSE; case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_END: target = NULL; + __attribute__ ((fallthrough)); case WIDGET_TRIGGER_ACTION_RESULT_GRAB_MOTION_BEGIN: state->mouse.motion_target = target; + __attribute__ ((fallthrough)); case WIDGET_TRIGGER_ACTION_RESULT_HANDLED: return TRUE; } diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 927c7788..c2bb2992 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -504,6 +504,7 @@ static WidgetTriggerActionResult listview_element_trigger_action ( widget *wid, break; case ACCEPT_HOVERED_CUSTOM: custom = TRUE; + __attribute__ ((fallthrough)); case ACCEPT_HOVERED_ENTRY: listview_set_selected ( lv, lv->last_offset + i ); lv->mouse_activated ( lv, custom, lv->mouse_activated_data );