Ticket #4103: mc-4103-fix-fallthrough-warnings.patch

File mc-4103-fix-fallthrough-warnings.patch, 4.7 KB (added by and, 3 years ago)
  • lib/strutil/xstrtol.c

    From 3e950664aa8297e56983bbf1b94d765dc5ce3bc0 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 5 Dec 2020 11:51:30 +0000
    Subject: [PATCH] fix missing fallthrough label warnings
    
    Clang 11 is more ruthless against missing fallthrough label
    
    xstrtol.c:179:9: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    util.c:786:21: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    achown.c:495:9: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    hotlist.c:291:9: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    fish.c:942:9: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    datasource.c:357:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    edit.c:3429:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    edit.c:3457:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    edit.c:4001:9: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     lib/strutil/xstrtol.c     | 1 +
     lib/util.c                | 1 +
     src/editor/edit.c         | 3 +++
     src/filemanager/achown.c  | 1 +
     src/filemanager/hotlist.c | 1 +
     src/vfs/fish/fish.c       | 1 +
     src/viewer/datasource.c   | 1 +
     7 files changed, 9 insertions(+)
    
    diff --git a/lib/strutil/xstrtol.c b/lib/strutil/xstrtol.c
    index 070b3e6bb..4772c9a97 100644
    a b xstrtoumax (const char *s, char **ptr, int base, uintmax_t * val, const char *va 
    176176                    break; 
    177177                } 
    178178            } 
     179            MC_FALLTHROUGH; 
    179180        default: 
    180181            break; 
    181182        } 
  • lib/util.c

    diff --git a/lib/util.c b/lib/util.c
    index 9f71d9a20..64963a7fe 100644
    a b strip_ctrl_codes (char *s) 
    783783                            r = new_r + 1; 
    784784                            goto osc_out; 
    785785                        } 
     786                        MC_FALLTHROUGH; 
    786787                    default: 
    787788                        break; 
    788789                    } 
  • src/editor/edit.c

    diff --git a/src/editor/edit.c b/src/editor/edit.c
    index e13be389a..7d6c29424 100644
    a b edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) 
    34263426            edit->column_highlight = 0; 
    34273427            edit_mark_cmd (edit, TRUE); 
    34283428        } 
     3429        MC_FALLTHROUGH; 
    34293430    default: 
    34303431        break; 
    34313432    } 
    edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) 
    34543455    case CK_MarkLeft: 
    34553456    case CK_MarkRight: 
    34563457        edit->force |= REDRAW_CHAR_ONLY; 
     3458        MC_FALLTHROUGH; 
    34573459    default: 
    34583460        break; 
    34593461    } 
    edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) 
    39984000        case CK_DeleteToEnd: 
    39994001            format_paragraph (edit, FALSE); 
    40004002            edit->force |= REDRAW_PAGE; 
     4003        MC_FALLTHROUGH; 
    40014004        default: 
    40024005            break; 
    40034006        } 
  • src/filemanager/achown.c

    diff --git a/src/filemanager/achown.c b/src/filemanager/achown.c
    index 315d4103f..9fa82d737 100644
    a b chl_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *dat 
    492492                h->ret_value = parm; 
    493493                dlg_stop (h); 
    494494            } 
     495            MC_FALLTHROUGH; 
    495496        default: 
    496497            break; 
    497498        } 
  • src/filemanager/hotlist.c

    diff --git a/src/filemanager/hotlist.c b/src/filemanager/hotlist.c
    index f0fe44486..e5d4d63fb 100644
    a b fill_listbox (WListbox * list) 
    288288        case HL_TYPE_DOTDOT: 
    289289        case HL_TYPE_ENTRY: 
    290290            listbox_add_item (list, LISTBOX_APPEND_AT_END, 0, current->label, current, FALSE); 
     291            MC_FALLTHROUGH; 
    291292        default: 
    292293            break; 
    293294        } 
  • src/vfs/fish/fish.c

    diff --git a/src/vfs/fish/fish.c b/src/vfs/fish/fish.c
    index 5cd279f95..ad0ad85ef 100644
    a b fish_dir_load (struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path) 
    939939                ST.st_rdev = makedev (maj, min); 
    940940#endif 
    941941            } 
     942            MC_FALLTHROUGH; 
    942943        default: 
    943944            break; 
    944945        } 
  • src/viewer/datasource.c

    diff --git a/src/viewer/datasource.c b/src/viewer/datasource.c
    index 1f97e8dd1..b88b07b01 100644
    a b mcview_close_datasource (WView * view) 
    354354        break; 
    355355    case DS_STRING: 
    356356        MC_PTR_FREE (view->ds_string_data); 
     357        MC_FALLTHROUGH; 
    357358    default: 
    358359        break; 
    359360    }