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

@ -128,7 +128,7 @@ int b_getopts(int argc,char *argv[],Shbltin_t *context)
if(mode==0)
errormsg(SH_DICT,ERROR_usage(2), "%s", opt_info.arg);
opt_info.option[1] = '?';
/* FALL THRU */
/* FALLTHROUGH */
case ':':
key[0] = opt_info.option[1];
if(strmatch(opt_info.arg,"*unknown*"))

View file

@ -89,6 +89,7 @@ int b_hist(int argc,char *argv[], Shbltin_t *context)
range[++indx] = flag;
break;
}
/* FALLTHROUGH */
case ':':
errormsg(SH_DICT,2, "%s", opt_info.arg);
break;

View file

@ -716,7 +716,7 @@ static int extend(Sfio_t* sp, void* v, Sffmt_t* fe)
break;
case 'q':
format = 's';
/* FALL THROUGH */
/* FALLTHROUGH */
case 's':
case 'H':
case 'B':
@ -798,6 +798,7 @@ static int extend(Sfio_t* sp, void* v, Sffmt_t* fe)
fe->flags |=SFFMT_ALTER;
}
}
/* FALLTHROUGH */
case 'b':
case 's':
case 'B':
@ -837,12 +838,14 @@ static int extend(Sfio_t* sp, void* v, Sffmt_t* fe)
case 'u':
case 'U':
longmax = LDBL_ULLONG_MAX;
/* FALLTHROUGH */
case '.':
if(fe->size==2 && strchr("bcsqHPRQTZ",*fe->form))
{
value->ll = ((unsigned char*)argp)[0];
break;
}
/* FALLTHROUGH */
case 'd':
case 'D':
case 'i':
@ -1096,6 +1099,7 @@ static int fmtvecho(const char *string, struct printf *pp)
c <<= 3;
c |= (*cp-'0');
}
/* FALLTHROUGH */
default:
cp--;
}

View file

@ -599,6 +599,7 @@ int sh_readline(register Shell_t *shp,char **names, volatile int fd, int flags,s
case S_ERR:
cp++;
/* FALLTHROUGH */
case S_EOF:
/* check for end of buffer */
if(val && *val)
@ -660,7 +661,7 @@ int sh_readline(register Shell_t *shp,char **names, volatile int fd, int flags,s
#endif /* SHOPT_MULTIBYTE */
if(c!=S_DELIM)
break;
/* FALL THRU */
/* FALLTHROUGH */
case S_DELIM:
if(!del)
@ -671,7 +672,7 @@ int sh_readline(register Shell_t *shp,char **names, volatile int fd, int flags,s
while((c=shp->ifstable[*cp++])==S_SPACE);
break;
}
/* FALL THRU */
/* FALLTHROUGH */
case 0:
if(val==0 || was_escape)

View file

@ -166,7 +166,7 @@ int b_test(int argc, char *argv[],Shbltin_t *context)
if(!not)
break;
argv++;
/* fall through */
/* FALLTHROUGH */
case 4:
{
register int op = sh_lookup(cp=argv[2],shtab_testops);
@ -434,6 +434,7 @@ int test_unop(Shell_t *shp,register int op,register const char *arg)
return(*arg == 0);
case 's':
sfsync(sfstdout);
/* FALLTHROUGH */
case 'O':
case 'G':
if(*arg==0 || test_stat(arg,&statb)<0)

View file

@ -211,6 +211,7 @@ int b_kill(int argc,char *argv[],Shbltin_t *context)
goto endopts;
case 'L':
usemenu = -1;
/* FALLTHROUGH */
case 'l':
flag |= L_FLAG;
break;

View file

@ -256,6 +256,7 @@ int b_typeset(int argc,register char *argv[],Shbltin_t *context)
tdata.argnum = (int)opt_info.num;
break;
}
/* FALLTHROUGH */
case 'F':
case 'X':
if(!opt_info.arg || (tdata.argnum = opt_info.num) <0)
@ -1230,6 +1231,7 @@ static int unall(int argc, char **argv, register Dt_t *troot, Shell_t* shp)
break;
case 'n':
nflag = NV_NOREF;
/* FALLTHROUGH */
case 'v':
troot = shp->var_tree;
break;

View file

@ -109,7 +109,7 @@ int b_whence(int argc,char *argv[],Shbltin_t *context)
{
case 'a':
flags |= A_FLAG;
/* FALL THRU */
/* FALLTHROUGH */
case 'v':
flags |= V_FLAG;
break;