Ticket #3876: mc-3876-info.c-Cleanup-implicit-fallthrough-warnings.patch

File mc-3876-info.c-Cleanup-implicit-fallthrough-warnings.patch, 4.3 KB (added by and, 6 years ago)
  • src/filemanager/info.c

    From f1424e7a0dd7149d0a5836c1ac593067ad463172 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Wed, 3 Jan 2018 22:46:59 +0000
    Subject: [PATCH] (utilunix.c): Cleanup implicit-fallthrough warnings
    
    Found by GCC 7.2.0
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/info.c | 28 +++++++++++++++++-----------
     1 file changed, 17 insertions(+), 11 deletions(-)
    
    diff --git a/src/filemanager/info.c b/src/filemanager/info.c
    index fab943822..1bfc7e593 100644
    a b info_show_info (WInfo * info) 
    153153        /* Note: all cases are fall-throughs */ 
    154154 
    155155    default: 
    156  
     156        MC_FALLTHROUGH; 
    157157    case 16: 
    158158        widget_move (w, 16, 3); 
    159159        if ((myfs_stats.nfree == 0 && myfs_stats.nodes == 0) || 
    info_show_info (WInfo * info) 
    169169                        myfs_stats.nfree, myfs_stats.nodes, 
    170170                        myfs_stats.nodes == 0 ? 0 : 
    171171                        (int) (100 * (long double) myfs_stats.nfree / myfs_stats.nodes)); 
    172  
     172        MC_FALLTHROUGH; 
    173173    case 15: 
    174174        widget_move (w, 15, 3); 
    175175        if (myfs_stats.avail == 0 && myfs_stats.total == 0) 
    info_show_info (WInfo * info) 
    184184                        myfs_stats.total == 0 ? 0 : 
    185185                        (int) (100 * (long double) myfs_stats.avail / myfs_stats.total)); 
    186186        } 
    187  
     187        MC_FALLTHROUGH; 
    188188    case 14: 
    189189        widget_move (w, 14, 3); 
    190190        tty_printf (_("Type:       %s"), 
    191191                    myfs_stats.typename ? myfs_stats.typename : _("non-local vfs")); 
    192192        if (myfs_stats.type != 0xffff && myfs_stats.type != -1) 
    193193            tty_printf (" (%Xh)", (unsigned int) myfs_stats.type); 
    194  
     194        MC_FALLTHROUGH; 
    195195    case 13: 
    196196        widget_move (w, 13, 3); 
    197197        str_printf (buff, _("Device:     %s"), 
    198198                    str_trunc (myfs_stats.device, w->cols - i18n_adjust)); 
    199199        tty_print_string (buff->str); 
    200200        g_string_set_size (buff, 0); 
     201        MC_FALLTHROUGH; 
    201202    case 12: 
    202203        widget_move (w, 12, 3); 
    203204        str_printf (buff, _("Filesystem: %s"), 
    204205                    str_trunc (myfs_stats.mpoint, w->cols - i18n_adjust)); 
    205206        tty_print_string (buff->str); 
    206207        g_string_set_size (buff, 0); 
     208        MC_FALLTHROUGH; 
    207209    case 11: 
    208210        widget_move (w, 11, 3); 
    209211        str_printf (buff, _("Accessed:   %s"), file_date (st.st_atime)); 
    210212        tty_print_string (buff->str); 
    211213        g_string_set_size (buff, 0); 
     214        MC_FALLTHROUGH; 
    212215    case 10: 
    213216        widget_move (w, 10, 3); 
    214217        str_printf (buff, _("Modified:   %s"), file_date (st.st_mtime)); 
    215218        tty_print_string (buff->str); 
    216219        g_string_set_size (buff, 0); 
     220        MC_FALLTHROUGH; 
    217221    case 9: 
    218222        widget_move (w, 9, 3); 
    219223        /* The field st_ctime is changed by writing or by setting inode 
    info_show_info (WInfo * info) 
    222226        str_printf (buff, _("Changed:    %s"), file_date (st.st_ctime)); 
    223227        tty_print_string (buff->str); 
    224228        g_string_set_size (buff, 0); 
    225  
     229        MC_FALLTHROUGH; 
    226230    case 8: 
    227231        widget_move (w, 8, 3); 
    228232#ifdef HAVE_STRUCT_STAT_ST_RDEV 
    info_show_info (WInfo * info) 
    240244                                  (unsigned long) st.st_blocks), (unsigned long) st.st_blocks); 
    241245#endif 
    242246        } 
    243  
     247        MC_FALLTHROUGH; 
    244248    case 7: 
    245249        widget_move (w, 7, 3); 
    246250        tty_printf (_("Owner:      %s/%s"), get_owner (st.st_uid), get_group (st.st_gid)); 
    247  
     251        MC_FALLTHROUGH; 
    248252    case 6: 
    249253        widget_move (w, 6, 3); 
    250254        tty_printf (_("Links:      %d"), (int) st.st_nlink); 
    251  
     255        MC_FALLTHROUGH; 
    252256    case 5: 
    253257        widget_move (w, 5, 3); 
    254258        tty_printf (_("Mode:       %s (%04o)"), 
    255259                    string_perm (st.st_mode), (unsigned) st.st_mode & 07777); 
    256  
     260        MC_FALLTHROUGH; 
    257261    case 4: 
    258262        widget_move (w, 4, 3); 
    259263        tty_printf (_("Location:   %Xh:%Xh"), (unsigned int) st.st_dev, (unsigned int) st.st_ino); 
    260  
     264        MC_FALLTHROUGH; 
    261265    case 3: 
    262266        { 
    263267            const char *fname; 
    info_show_info (WInfo * info) 
    267271            str_printf (buff, file_label, str_trunc (fname, w->cols - i18n_adjust)); 
    268272            tty_print_string (buff->str); 
    269273        } 
    270  
     274        MC_FALLTHROUGH; 
    271275    case 2: 
     276        MC_FALLTHROUGH; 
    272277    case 1: 
     278        MC_FALLTHROUGH; 
    273279    case 0: 
    274280        ; 
    275281    }                           /* switch */