1
0
forked from aniani/vim

patch 8.0.1215: newer gcc warns for implicit fallthrough

Problem:    Newer gcc warns for implicit fallthrough.
Solution:   Consistently use a FALLTHROUGH comment. (Christian Brabandt)
This commit is contained in:
Bram Moolenaar 2017-10-24 21:49:36 +02:00
parent 4f1982800f
commit 2f40d129bf
14 changed files with 39 additions and 29 deletions

View File

@ -4325,6 +4325,7 @@ build_stl_str_hl(
case STL_OFFSET_X: case STL_OFFSET_X:
base = 'X'; base = 'X';
/* FALLTHROUGH */
case STL_OFFSET: case STL_OFFSET:
#ifdef FEAT_BYTEOFF #ifdef FEAT_BYTEOFF
l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL); l = ml_find_line_or_offset(wp->w_buffer, wp->w_cursor.lnum, NULL);
@ -4336,6 +4337,7 @@ build_stl_str_hl(
case STL_BYTEVAL_X: case STL_BYTEVAL_X:
base = 'X'; base = 'X';
/* FALLTHROUGH */
case STL_BYTEVAL: case STL_BYTEVAL:
num = byteval; num = byteval;
if (num == NL) if (num == NL)

View File

@ -984,7 +984,7 @@ edit(
case ESC: /* End input mode */ case ESC: /* End input mode */
if (echeck_abbr(ESC + ABBR_OFF)) if (echeck_abbr(ESC + ABBR_OFF))
break; break;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case Ctrl_C: /* End input mode */ case Ctrl_C: /* End input mode */
#ifdef FEAT_CMDWIN #ifdef FEAT_CMDWIN
@ -5774,13 +5774,16 @@ quote_meta(char_u *dest, char_u *src, int len)
if (ctrl_x_mode == CTRL_X_DICTIONARY if (ctrl_x_mode == CTRL_X_DICTIONARY
|| ctrl_x_mode == CTRL_X_THESAURUS) || ctrl_x_mode == CTRL_X_THESAURUS)
break; break;
/* FALLTHROUGH */
case '~': case '~':
if (!p_magic) /* quote these only if magic is set */ if (!p_magic) /* quote these only if magic is set */
break; break;
/* FALLTHROUGH */
case '\\': case '\\':
if (ctrl_x_mode == CTRL_X_DICTIONARY if (ctrl_x_mode == CTRL_X_DICTIONARY
|| ctrl_x_mode == CTRL_X_THESAURUS) || ctrl_x_mode == CTRL_X_THESAURUS)
break; break;
/* FALLTHROUGH */
case '^': /* currently it's not needed. */ case '^': /* currently it's not needed. */
case '$': case '$':
m++; m++;

View File

@ -6995,7 +6995,7 @@ free_tv(typval_T *varp)
{ {
case VAR_FUNC: case VAR_FUNC:
func_unref(varp->vval.v_string); func_unref(varp->vval.v_string);
/*FALLTHROUGH*/ /* FALLTHROUGH */
case VAR_STRING: case VAR_STRING:
vim_free(varp->vval.v_string); vim_free(varp->vval.v_string);
break; break;
@ -7040,7 +7040,7 @@ clear_tv(typval_T *varp)
{ {
case VAR_FUNC: case VAR_FUNC:
func_unref(varp->vval.v_string); func_unref(varp->vval.v_string);
/*FALLTHROUGH*/ /* FALLTHROUGH */
case VAR_STRING: case VAR_STRING:
vim_free(varp->vval.v_string); vim_free(varp->vval.v_string);
varp->vval.v_string = NULL; varp->vval.v_string = NULL;

View File

@ -4115,7 +4115,7 @@ set_one_cmd_context(
case CMD_bunload: case CMD_bunload:
while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL)
arg = xp->xp_pattern + 1; arg = xp->xp_pattern + 1;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case CMD_buffer: case CMD_buffer:
case CMD_sbuffer: case CMD_sbuffer:
case CMD_checktime: case CMD_checktime:

View File

@ -1563,9 +1563,8 @@ getcmdline(
break; break;
goto cmdline_not_changed; goto cmdline_not_changed;
} }
/* FALLTHROUGH */
#ifdef FEAT_CMDHIST #ifdef FEAT_CMDHIST
/* FALLTHROUGH */
case K_UP: case K_UP:
case K_DOWN: case K_DOWN:
case K_S_UP: case K_S_UP:

View File

@ -1101,6 +1101,7 @@ perl_to_vim(SV *sv, typval_T *rettv)
rettv->vval.v_number = SvIV(sv); rettv->vval.v_number = SvIV(sv);
break; break;
} }
/* FALLTHROUGH */
case SVt_PV: /* string */ case SVt_PV: /* string */
{ {
size_t len = 0; size_t len = 0;

View File

@ -2228,7 +2228,7 @@ command_line_scan(mparm_T *parmp)
argv_idx = -1; argv_idx = -1;
break; break;
} }
/*FALLTHROUGH*/ /* FALLTHROUGH */
case 'S': /* "-S {file}" execute Vim script */ case 'S': /* "-S {file}" execute Vim script */
case 'i': /* "-i {viminfo}" use for viminfo */ case 'i': /* "-i {viminfo}" use for viminfo */
#ifndef FEAT_DIFF #ifndef FEAT_DIFF
@ -2386,7 +2386,7 @@ scripterror:
argv_idx = -1; argv_idx = -1;
break; break;
} }
/*FALLTHROUGH*/ /* FALLTHROUGH */
case 'W': /* "-W {scriptout}" overwrite script file */ case 'W': /* "-W {scriptout}" overwrite script file */
if (scriptout != NULL) if (scriptout != NULL)
goto scripterror; goto scripterror;

View File

@ -670,7 +670,8 @@ emsg(char_u *s)
ex_exitval = 1; ex_exitval = 1;
/* Reset msg_silent, an error causes messages to be switched back on. */ /* Reset msg_silent, an error causes messages to be switched back on.
*/
msg_silent = 0; msg_silent = 0;
cmd_silent = FALSE; cmd_silent = FALSE;
@ -2837,7 +2838,7 @@ do_more_prompt(int typed_char)
skip_redraw = TRUE; /* skip redraw once */ skip_redraw = TRUE; /* skip redraw once */
need_wait_return = FALSE; /* don't wait in main() */ need_wait_return = FALSE; /* don't wait in main() */
} }
/*FALLTHROUGH*/ /* FALLTHROUGH */
case 'q': /* quit */ case 'q': /* quit */
case Ctrl_C: case Ctrl_C:
case ESC: case ESC:

View File

@ -1945,6 +1945,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
AppendToRedobuff((char_u *)"!\r"); /* use any last used !cmd */ AppendToRedobuff((char_u *)"!\r"); /* use any last used !cmd */
else else
bangredo = TRUE; /* do_bang() will put cmd in redo buffer */ bangredo = TRUE; /* do_bang() will put cmd in redo buffer */
/* FALLTHROUGH */
case OP_INDENT: case OP_INDENT:
case OP_COLON: case OP_COLON:
@ -5150,7 +5151,7 @@ dozet:
break; break;
} }
undo = TRUE; undo = TRUE;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case 'g': /* "zg": add good word to word list */ case 'g': /* "zg": add good word to word list */
case 'w': /* "zw": add wrong word to word list */ case 'w': /* "zw": add wrong word to word list */
@ -8267,7 +8268,7 @@ nv_g_cmd(cmdarg_T *cap)
/* "g'm" and "g`m": jump to mark without setting pcmark */ /* "g'm" and "g`m": jump to mark without setting pcmark */
case '\'': case '\'':
cap->arg = TRUE; cap->arg = TRUE;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case '`': case '`':
nv_gomark(cap); nv_gomark(cap);
break; break;
@ -8328,7 +8329,7 @@ nv_g_cmd(cmdarg_T *cap)
case 'q': case 'q':
case 'w': case 'w':
oap->cursor_start = curwin->w_cursor; oap->cursor_start = curwin->w_cursor;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case '~': case '~':
case 'u': case 'u':
case 'U': case 'U':
@ -9117,7 +9118,7 @@ nv_edit(cmdarg_T *cap)
* the first column, then it inserts. */ * the first column, then it inserts. */
if (curwin->w_cursor.col == 0) if (curwin->w_cursor.col == 0)
break; break;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case 'a': /* "a"ppend is like "i"nsert on the next character. */ case 'a': /* "a"ppend is like "i"nsert on the next character. */
#ifdef FEAT_VIRTUALEDIT #ifdef FEAT_VIRTUALEDIT

View File

@ -1997,7 +1997,7 @@ regatom(int *flagp)
goto collection; goto collection;
/* "\_x" is character class plus newline */ /* "\_x" is character class plus newline */
/*FALLTHROUGH*/ /* FALLTHROUGH */
/* /*
* Character classes. * Character classes.
@ -5847,7 +5847,7 @@ regrepeat(
case IDENT: case IDENT:
case IDENT + ADD_NL: case IDENT + ADD_NL:
testval = TRUE; testval = TRUE;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case SIDENT: case SIDENT:
case SIDENT + ADD_NL: case SIDENT + ADD_NL:
while (count < maxcount) while (count < maxcount)
@ -5877,7 +5877,7 @@ regrepeat(
case KWORD: case KWORD:
case KWORD + ADD_NL: case KWORD + ADD_NL:
testval = TRUE; testval = TRUE;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case SKWORD: case SKWORD:
case SKWORD + ADD_NL: case SKWORD + ADD_NL:
while (count < maxcount) while (count < maxcount)
@ -5908,7 +5908,7 @@ regrepeat(
case FNAME: case FNAME:
case FNAME + ADD_NL: case FNAME + ADD_NL:
testval = TRUE; testval = TRUE;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case SFNAME: case SFNAME:
case SFNAME + ADD_NL: case SFNAME + ADD_NL:
while (count < maxcount) while (count < maxcount)
@ -5938,7 +5938,7 @@ regrepeat(
case PRINT: case PRINT:
case PRINT + ADD_NL: case PRINT + ADD_NL:
testval = TRUE; testval = TRUE;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case SPRINT: case SPRINT:
case SPRINT + ADD_NL: case SPRINT + ADD_NL:
while (count < maxcount) while (count < maxcount)
@ -6131,7 +6131,7 @@ do_class:
case ANYOF: case ANYOF:
case ANYOF + ADD_NL: case ANYOF + ADD_NL:
testval = TRUE; testval = TRUE;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case ANYBUT: case ANYBUT:
case ANYBUT + ADD_NL: case ANYBUT + ADD_NL:

View File

@ -1320,7 +1320,7 @@ nfa_regatom(void)
goto collection; goto collection;
/* "\_x" is character class plus newline */ /* "\_x" is character class plus newline */
/*FALLTHROUGH*/ /* FALLTHROUGH */
/* /*
* Character classes. * Character classes.
@ -4698,6 +4698,7 @@ skip_add:
subs = addstate(l, state->out, subs, pim, off_arg); subs = addstate(l, state->out, subs, pim, off_arg);
break; break;
} }
/* FALLTHROUGH */
case NFA_MCLOSE1: case NFA_MCLOSE1:
case NFA_MCLOSE2: case NFA_MCLOSE2:
case NFA_MCLOSE3: case NFA_MCLOSE3:

View File

@ -5019,7 +5019,7 @@ suggest_trie_walk(
} }
PROF_STORE(sp->ts_state) PROF_STORE(sp->ts_state)
sp->ts_state = STATE_PLAIN; sp->ts_state = STATE_PLAIN;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case STATE_PLAIN: case STATE_PLAIN:
/* /*
@ -5243,7 +5243,7 @@ suggest_trie_walk(
} }
break; break;
} }
/*FALLTHROUGH*/ /* FALLTHROUGH */
case STATE_INS_PREP: case STATE_INS_PREP:
if (sp->ts_flags & TSF_DIDDEL) if (sp->ts_flags & TSF_DIDDEL)
@ -5277,7 +5277,7 @@ suggest_trie_walk(
} }
break; break;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case STATE_INS: case STATE_INS:
/* Insert one byte. Repeat this for each possible byte at this /* Insert one byte. Repeat this for each possible byte at this
@ -5464,7 +5464,7 @@ suggest_trie_walk(
*p = p[1]; *p = p[1];
p[1] = c; p[1] = c;
} }
/*FALLTHROUGH*/ /* FALLTHROUGH */
case STATE_SWAP3: case STATE_SWAP3:
/* Swap two bytes, skipping one: "123" -> "321". We change /* Swap two bytes, skipping one: "123" -> "321". We change
@ -5703,7 +5703,7 @@ suggest_trie_walk(
p[1] = p[2]; p[1] = p[2];
p[2] = c; p[2] = c;
} }
/*FALLTHROUGH*/ /* FALLTHROUGH */
case STATE_REP_INI: case STATE_REP_INI:
/* Check if matching with REP items from the .aff file would work. /* Check if matching with REP items from the .aff file would work.
@ -5736,7 +5736,7 @@ suggest_trie_walk(
PROF_STORE(sp->ts_state) PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP; sp->ts_state = STATE_REP;
/*FALLTHROUGH*/ /* FALLTHROUGH */
case STATE_REP: case STATE_REP:
/* Try matching with REP items from the .aff file. For each match /* Try matching with REP items from the .aff file. For each match

View File

@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1215,
/**/ /**/
1214, 1214,
/**/ /**/

View File

@ -433,8 +433,8 @@ newwindow:
g_do_tagpreview = Prenum; g_do_tagpreview = Prenum;
else else
g_do_tagpreview = p_pvh; g_do_tagpreview = p_pvh;
/*FALLTHROUGH*/
#endif #endif
/* FALLTHROUGH */
case ']': case ']':
case Ctrl_RSB: case Ctrl_RSB:
CHECK_CMDWIN CHECK_CMDWIN
@ -557,8 +557,8 @@ wingotofile:
g_do_tagpreview = Prenum; g_do_tagpreview = Prenum;
else else
g_do_tagpreview = p_pvh; g_do_tagpreview = p_pvh;
/*FALLTHROUGH*/
#endif #endif
/* FALLTHROUGH */
case ']': case ']':
case Ctrl_RSB: case Ctrl_RSB:
/* keep Visual mode, can select words to use as a tag */ /* keep Visual mode, can select words to use as a tag */