1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Fix many GCC -Wimplicit-fallthrough warnings (#243)

This commit adds '/* FALLTHROUGH */' comments to fix many
GCC warnings when compiling with -Wimplicit-fallthrough.
Additionally, the existing fallthrough comments have been
changed for consistency.
This commit is contained in:
Johnothan King 2021-03-30 13:49:20 -07:00 committed by GitHub
parent f30da49564
commit ed478ab7e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 271 additions and 158 deletions

View file

@ -190,7 +190,7 @@ static char *find_begin(char outbuff[], char *last, int endchar, int *type)
case '~':
if(*cp=='(')
break;
/* fall through */
/* FALLTHROUGH */
default:
if(c && c==endchar)
return(xp);

View file

@ -692,7 +692,7 @@ void ed_setup(register Edit_t *ep, int fd, int reedit)
case '\r':
if(pp == (ep->e_prompt+2)) /* quote char */
myquote = *(pp-1);
/*FALLTHROUGH*/
/* FALLTHROUGH */
case '\n':
/* start again */

View file

@ -566,6 +566,7 @@ update:
case KILLCHAR :
cur = 0;
oadjust = -1;
/* FALLTHROUGH */
case cntl('K') :
if(oadjust >= 0)
{
@ -983,6 +984,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
if(ch=='\n')
ed_ungetchar(ep->ed,'\n');
#endif /* SHOPT_EDPREDICT */
/* FALLTHROUGH */
/* file name expansion */
case ESC :
#if SHOPT_EDPREDICT
@ -1001,6 +1003,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
}
#endif /* SHOPT_EDPREDICT */
i = '\\'; /* filename completion */
/* FALLTHROUGH */
case '*': /* filename expansion */
case '=': /* escape = - list all matching file names */
ep->mark = cur;
@ -1144,6 +1147,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
ed_ungetchar(ep->ed,i);
}
i = '_';
/* FALLTHROUGH */
default:
/* look for user defined macro definitions */

View file

@ -250,6 +250,7 @@ int hist_expand(const char *ln, char **xp)
if(!isdigit(*(cp+1)))
goto string_event;
cp++;
/* FALLTHROUGH */
case '0': /* reference by number */
case '1':
case '2':
@ -273,6 +274,7 @@ int hist_expand(const char *ln, char **xp)
case '?':
cp++;
flag |= HIST_QUESTION;
/* FALLTHROUGH */
string_event:
default:
/* read until end of string or word designator/modifier */
@ -376,6 +378,7 @@ getline:
sfseek(wm, 0, SEEK_SET);
goto skip;
}
/* FALLTHROUGH */
default:
skip2:
cp--;

View file

@ -836,6 +836,7 @@ static int cntlmode(Vi_t *vp)
case BAD:
/*** no match ***/
ed_ringbell();
/* FALLTHROUGH */
default:
if( vp->u_column == INVALID )
@ -956,6 +957,7 @@ static int cntlmode(Vi_t *vp)
if(vp->repeat_set==0)
goto vcommand;
#endif /* KSHELL */
/* FALLTHROUGH */
case 'G': /** goto command repeat **/
if(vp->repeat_set==0)
@ -1014,11 +1016,13 @@ static int cntlmode(Vi_t *vp)
}
refresh(vp,INPUT);
}
/* FALLTHROUGH */
case '\n': /** send to shell **/
#if SHOPT_EDPREDICT
if(!vp->ed->hlist)
return(ENTER);
return(ENTER);
/* FALLTHROUGH */
case '\t': /** bring choice to edit **/
if(vp->ed->hlist)
{
@ -1045,6 +1049,7 @@ static int cntlmode(Vi_t *vp)
if(c=='[')
continue;
}
/* FALLTHROUGH */
default:
ringbell:
ed_ringbell();
@ -1519,6 +1524,7 @@ static void getline(register Vi_t* vp,register int mode)
if( cur_virt != INVALID )
continue;
vp->addnl = 0;
/* FALLTHROUGH */
case '\n': /** newline or return **/
if( mode != SEARCH )
@ -1552,7 +1558,7 @@ static void getline(register Vi_t* vp,register int mode)
}
vp->ed->e_tabcount = 0;
}
/* FALL THRU*/
/* FALLTHROUGH */
default:
if( mode == REPLACE )
{
@ -1610,7 +1616,7 @@ static int mvcursor(register Vi_t* vp,register int motion)
tcur_virt = vp->repeat-1;
if(tcur_virt <= last_virt)
break;
/* fall through */
/* FALLTHROUGH */
case '$': /** End of line **/
tcur_virt = last_virt;
@ -1748,6 +1754,7 @@ static int mvcursor(register Vi_t* vp,register int motion)
case 'f': /** find new char forward **/
bound = last_virt;
incr = 1;
/* FALLTHROUGH */
case 'T': /** find up to new char backward **/
case 'F': /** find new char backward **/
@ -2444,10 +2451,12 @@ addin:
if(vp->ed->e_tabcount!=1)
return(BAD);
c = '=';
/* FALLTHROUGH */
case '*': /** do file name expansion in place **/
case '\\': /** do file name completion in place **/
if( cur_virt == INVALID )
return(BAD);
/* FALLTHROUGH */
case '=': /** list file name expansions **/
save_v(vp);
i = last_virt;
@ -2528,10 +2537,12 @@ addin:
while(i = *p++);
return(APPEND);
}
/* FALLTHROUGH */
case 'A': /** append to end of line **/
cur_virt = last_virt;
sync_cursor(vp);
/* FALLTHROUGH */
case 'a': /** append **/
if( fold(mode) == 'A' )
@ -2551,6 +2562,7 @@ addin:
case 'I': /** insert at beginning of line **/
cur_virt = first_virt;
sync_cursor(vp);
/* FALLTHROUGH */
case 'i': /** insert **/
if( fold(mode) == 'I' )
@ -2627,6 +2639,7 @@ deleol:
vp->ocur_virt = INVALID;
--cur_virt;
}
/* FALLTHROUGH */
case 'p': /** print **/
if( p[0] == '\0' )