From ae3cf817f43c327ae71e0400c8e270ef99daad48 Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Thu, 4 Jan 2018 07:21:37 +0000 Subject: [PATCH] Cleanup implicit-fallthrough warnings. Found by GCC 7.2.0 Signed-off-by: Andreas Mohr Signed-off-by: Andrew Borodin --- src/editor/edit.c | 11 +++++++++++ src/editor/editwidget.c | 2 ++ src/filemanager/info.c | 28 +++++++++++++++++----------- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/editor/edit.c b/src/editor/edit.c index b584400f2..3167fc5e9 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -3456,6 +3456,7 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) case CK_MarkColumnDown: if (edit->mark2 == -1) break; /*marking is following the cursor: may need to highlight a whole line */ + MC_FALLTHROUGH; case CK_Left: case CK_Right: case CK_MarkLeft: @@ -3551,18 +3552,21 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) case CK_MarkColumnPageUp: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_PageUp: case CK_MarkPageUp: edit_move_up (edit, w->lines - 1, TRUE); break; case CK_MarkColumnPageDown: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_PageDown: case CK_MarkPageDown: edit_move_down (edit, w->lines - 1, TRUE); break; case CK_MarkColumnLeft: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_Left: case CK_MarkLeft: if (option_fake_half_tabs && is_in_indent (&edit->buffer) && right_of_four_spaces (edit)) @@ -3578,6 +3582,7 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) break; case CK_MarkColumnRight: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_Right: case CK_MarkRight: if (option_fake_half_tabs && is_in_indent (&edit->buffer) && left_of_four_spaces (edit)) @@ -3608,36 +3613,42 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) break; case CK_MarkColumnUp: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_Up: case CK_MarkUp: edit_move_up (edit, 1, FALSE); break; case CK_MarkColumnDown: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_Down: case CK_MarkDown: edit_move_down (edit, 1, FALSE); break; case CK_MarkColumnParagraphUp: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_ParagraphUp: case CK_MarkParagraphUp: edit_move_up_paragraph (edit, FALSE); break; case CK_MarkColumnParagraphDown: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_ParagraphDown: case CK_MarkParagraphDown: edit_move_down_paragraph (edit, FALSE); break; case CK_MarkColumnScrollUp: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_ScrollUp: case CK_MarkScrollUp: edit_move_up (edit, 1, TRUE); break; case CK_MarkColumnScrollDown: edit->column_highlight = 1; + MC_FALLTHROUGH; case CK_ScrollDown: case CK_MarkScrollDown: edit_move_down (edit, 1, TRUE); diff --git a/src/editor/editwidget.c b/src/editor/editwidget.c index 553897e26..eb0c349b2 100644 --- a/src/editor/editwidget.c +++ b/src/editor/editwidget.c @@ -1435,6 +1435,7 @@ edit_handle_move_resize (WEdit * edit, long command) case CK_WindowMove: edit->drag_state = MCEDIT_DRAG_NONE; edit_status (edit, TRUE); /* redraw frame and status */ + MC_FALLTHROUGH; default: ret = TRUE; break; @@ -1459,6 +1460,7 @@ edit_handle_move_resize (WEdit * edit, long command) case CK_WindowResize: edit->drag_state = MCEDIT_DRAG_NONE; edit_status (edit, TRUE); /* redraw frame and status */ + MC_FALLTHROUGH; default: ret = TRUE; break; diff --git a/src/filemanager/info.c b/src/filemanager/info.c index fab943822..1bfc7e593 100644 --- a/src/filemanager/info.c +++ b/src/filemanager/info.c @@ -153,7 +153,7 @@ info_show_info (WInfo * info) /* Note: all cases are fall-throughs */ default: - + MC_FALLTHROUGH; case 16: widget_move (w, 16, 3); if ((myfs_stats.nfree == 0 && myfs_stats.nodes == 0) || @@ -169,7 +169,7 @@ info_show_info (WInfo * info) myfs_stats.nfree, myfs_stats.nodes, myfs_stats.nodes == 0 ? 0 : (int) (100 * (long double) myfs_stats.nfree / myfs_stats.nodes)); - + MC_FALLTHROUGH; case 15: widget_move (w, 15, 3); if (myfs_stats.avail == 0 && myfs_stats.total == 0) @@ -184,36 +184,40 @@ info_show_info (WInfo * info) myfs_stats.total == 0 ? 0 : (int) (100 * (long double) myfs_stats.avail / myfs_stats.total)); } - + MC_FALLTHROUGH; case 14: widget_move (w, 14, 3); tty_printf (_("Type: %s"), myfs_stats.typename ? myfs_stats.typename : _("non-local vfs")); if (myfs_stats.type != 0xffff && myfs_stats.type != -1) tty_printf (" (%Xh)", (unsigned int) myfs_stats.type); - + MC_FALLTHROUGH; case 13: widget_move (w, 13, 3); str_printf (buff, _("Device: %s"), str_trunc (myfs_stats.device, w->cols - i18n_adjust)); tty_print_string (buff->str); g_string_set_size (buff, 0); + MC_FALLTHROUGH; case 12: widget_move (w, 12, 3); str_printf (buff, _("Filesystem: %s"), str_trunc (myfs_stats.mpoint, w->cols - i18n_adjust)); tty_print_string (buff->str); g_string_set_size (buff, 0); + MC_FALLTHROUGH; case 11: widget_move (w, 11, 3); str_printf (buff, _("Accessed: %s"), file_date (st.st_atime)); tty_print_string (buff->str); g_string_set_size (buff, 0); + MC_FALLTHROUGH; case 10: widget_move (w, 10, 3); str_printf (buff, _("Modified: %s"), file_date (st.st_mtime)); tty_print_string (buff->str); g_string_set_size (buff, 0); + MC_FALLTHROUGH; case 9: widget_move (w, 9, 3); /* The field st_ctime is changed by writing or by setting inode @@ -222,7 +226,7 @@ info_show_info (WInfo * info) str_printf (buff, _("Changed: %s"), file_date (st.st_ctime)); tty_print_string (buff->str); g_string_set_size (buff, 0); - + MC_FALLTHROUGH; case 8: widget_move (w, 8, 3); #ifdef HAVE_STRUCT_STAT_ST_RDEV @@ -240,24 +244,24 @@ info_show_info (WInfo * info) (unsigned long) st.st_blocks), (unsigned long) st.st_blocks); #endif } - + MC_FALLTHROUGH; case 7: widget_move (w, 7, 3); tty_printf (_("Owner: %s/%s"), get_owner (st.st_uid), get_group (st.st_gid)); - + MC_FALLTHROUGH; case 6: widget_move (w, 6, 3); tty_printf (_("Links: %d"), (int) st.st_nlink); - + MC_FALLTHROUGH; case 5: widget_move (w, 5, 3); tty_printf (_("Mode: %s (%04o)"), string_perm (st.st_mode), (unsigned) st.st_mode & 07777); - + MC_FALLTHROUGH; case 4: widget_move (w, 4, 3); tty_printf (_("Location: %Xh:%Xh"), (unsigned int) st.st_dev, (unsigned int) st.st_ino); - + MC_FALLTHROUGH; case 3: { const char *fname; @@ -267,9 +271,11 @@ info_show_info (WInfo * info) str_printf (buff, file_label, str_trunc (fname, w->cols - i18n_adjust)); tty_print_string (buff->str); } - + MC_FALLTHROUGH; case 2: + MC_FALLTHROUGH; case 1: + MC_FALLTHROUGH; case 0: ; } /* switch */