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:
parent
f30da49564
commit
ed478ab7e3
73 changed files with 271 additions and 158 deletions
|
|
@ -216,13 +216,13 @@ int sh_argopts(int argc,register char *argv[], void *context)
|
|||
ap->kiafile = opt_info.arg;
|
||||
n = 'n';
|
||||
}
|
||||
/*FALLTHROUGH*/
|
||||
#endif /* SHOPT_KIA */
|
||||
#if SHOPT_REGRESS
|
||||
goto skip;
|
||||
case 'I':
|
||||
continue;
|
||||
#endif /* SHOPT_REGRESS */
|
||||
/* FALLTHROUGH */
|
||||
skip:
|
||||
default:
|
||||
if(cp=strchr(optksh,n))
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ int _fcmbget(short *len)
|
|||
{
|
||||
case -1:
|
||||
*len = 1;
|
||||
/* fall through */
|
||||
/* FALLTHROUGH */
|
||||
case 0:
|
||||
case 1:
|
||||
c=fcget();
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ int sh_lex(Lex_t* lp)
|
|||
return(lp->token=EOFSYM);
|
||||
n = S_NLTOK;
|
||||
shp->inlineno--;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case S_NLTOK:
|
||||
/* check for here-document */
|
||||
if(lp->heredoc)
|
||||
|
|
@ -491,7 +491,7 @@ int sh_lex(Lex_t* lp)
|
|||
}
|
||||
lp->lex.reservok = !lp->lex.intest;
|
||||
lp->lex.skipword = 0;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case S_NL:
|
||||
/* skip over new-lines */
|
||||
lp->lex.last_quote = 0;
|
||||
|
|
@ -502,6 +502,7 @@ int sh_lex(Lex_t* lp)
|
|||
lp->comp_assign = 0;
|
||||
return(lp->token='\n');
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case S_BLNK:
|
||||
if(lp->lex.incase<=TEST_RE)
|
||||
continue;
|
||||
|
|
@ -686,7 +687,7 @@ int sh_lex(Lex_t* lp)
|
|||
case S_NAME:
|
||||
if(!lp->lex.skipword)
|
||||
lp->lex.reservok *= 2;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case S_TILDE:
|
||||
if(c=='~' && mode==ST_NESTED)
|
||||
{
|
||||
|
|
@ -697,6 +698,7 @@ int sh_lex(Lex_t* lp)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case S_RES:
|
||||
if(!lp->lexd.dolparen)
|
||||
lp->lexd.first = fcseek(0)-LEN;
|
||||
|
|
@ -808,7 +810,7 @@ int sh_lex(Lex_t* lp)
|
|||
wordflags |=(ARG_MAC|ARG_EXP);
|
||||
if(mode==ST_QUOTE)
|
||||
ingrave = !ingrave;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case S_QUOTE:
|
||||
if(oldmode(lp)==ST_NONE && lp->lexd.arith) /* in ((...)) */
|
||||
{
|
||||
|
|
@ -914,10 +916,11 @@ int sh_lex(Lex_t* lp)
|
|||
setchar(lp,c);
|
||||
continue;
|
||||
}
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case S_ALP:
|
||||
if(c=='.' && endchar(lp)=='$')
|
||||
goto err;
|
||||
/* FALLTHROUGH */
|
||||
case S_SPC2:
|
||||
case S_DIG:
|
||||
wordflags |= ARG_MAC;
|
||||
|
|
@ -938,9 +941,11 @@ int sh_lex(Lex_t* lp)
|
|||
case '!':
|
||||
if(n!=S_ALP)
|
||||
goto dolerr;
|
||||
/* FALLTHROUGH */
|
||||
case '#':
|
||||
if(c=='#')
|
||||
n = S_ALP;
|
||||
/* FALLTHROUGH */
|
||||
case RBRACE:
|
||||
if(n==S_ALP)
|
||||
{
|
||||
|
|
@ -1150,7 +1155,7 @@ int sh_lex(Lex_t* lp)
|
|||
continue;
|
||||
case S_EQ:
|
||||
assignment = lp->assignok;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case S_COLON:
|
||||
if(assignment)
|
||||
{
|
||||
|
|
@ -1254,7 +1259,7 @@ int sh_lex(Lex_t* lp)
|
|||
}
|
||||
case S_PAT:
|
||||
wordflags |= ARG_EXP;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case S_EPAT:
|
||||
epat:
|
||||
if(fcgetc(n)==LPAREN && c!='[')
|
||||
|
|
@ -1419,7 +1424,7 @@ breakloop:
|
|||
case TEST_SEQ:
|
||||
if(lp->lexd.warn && state[1]==0)
|
||||
errormsg(SH_DICT,ERROR_warn(0),e_lexobsolete3,shp->inlineno);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
if(lp->lex.testop2)
|
||||
{
|
||||
|
|
@ -1434,7 +1439,7 @@ breakloop:
|
|||
lp->token = TESTBINOP;
|
||||
return(lp->token);
|
||||
}
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case TEST_OR: case TEST_AND:
|
||||
case 0:
|
||||
return(lp->token=0);
|
||||
|
|
@ -1649,7 +1654,7 @@ static int comsub(register Lex_t *lp, int endtok)
|
|||
goto rbrace;
|
||||
if(c>0)
|
||||
fcseek(-LEN);
|
||||
/* fall through */
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
lp->lex.reservok = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ void sh_machere(Shell_t *shp,Sfio_t *infile, Sfio_t *outfile, char *string)
|
|||
case S_EOF:
|
||||
if((c=fcfill()) > 0)
|
||||
goto again;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
regular:
|
||||
sfputc(outfile,'$');
|
||||
|
|
@ -464,6 +464,7 @@ static void copyto(register Mac_t *mp,int endch, int newquote)
|
|||
case -1: /* illegal multi-byte char */
|
||||
case 0:
|
||||
len = 1;
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
n = state[*(unsigned char*)cp++];
|
||||
break;
|
||||
|
|
@ -643,6 +644,7 @@ static void copyto(register Mac_t *mp,int endch, int newquote)
|
|||
goto pattern;
|
||||
continue;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case S_EOF:
|
||||
if(c)
|
||||
{
|
||||
|
|
@ -667,6 +669,7 @@ static void copyto(register Mac_t *mp,int endch, int newquote)
|
|||
case S_QUOTE:
|
||||
if(mp->lit || mp->arith)
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
case S_LIT:
|
||||
if(mp->arith)
|
||||
{
|
||||
|
|
@ -729,6 +732,7 @@ static void copyto(register Mac_t *mp,int endch, int newquote)
|
|||
cp = first = fcseek(0);
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case S_PAT:
|
||||
if(mp->pattern && !(mp->quote || mp->lit))
|
||||
{
|
||||
|
|
@ -1102,7 +1106,7 @@ retry1:
|
|||
/* This code handles ${#} */
|
||||
c = mode;
|
||||
mode = type = 0;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case S_SPC1:
|
||||
if(type==M_BRACE)
|
||||
{
|
||||
|
|
@ -1129,7 +1133,7 @@ retry1:
|
|||
goto retry1;
|
||||
}
|
||||
}
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case S_SPC2:
|
||||
var = 0;
|
||||
*id = c;
|
||||
|
|
|
|||
|
|
@ -769,10 +769,12 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp)
|
|||
sp = (char*)name+c;
|
||||
c = '.';
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
skip:
|
||||
case '+':
|
||||
case '=':
|
||||
*sp = 0;
|
||||
/* FALLTHROUGH */
|
||||
case 0:
|
||||
isref = 0;
|
||||
dp->last = cp;
|
||||
|
|
|
|||
|
|
@ -501,7 +501,7 @@ static Shnode_t *sh_cmd(Lex_t *lexp, register int sym, int flag)
|
|||
{
|
||||
case COOPSYM: /* set up a cooperating process */
|
||||
type |= (FPIN|FPOU|FPCL|FCOOP);
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case '&':
|
||||
if(left)
|
||||
{
|
||||
|
|
@ -510,7 +510,7 @@ static Shnode_t *sh_cmd(Lex_t *lexp, register int sym, int flag)
|
|||
left = left->par.partre;
|
||||
left = makeparent(lexp,TFORK|type, left);
|
||||
}
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case ';':
|
||||
if(!left)
|
||||
sh_syntax(lexp);
|
||||
|
|
@ -520,6 +520,7 @@ static Shnode_t *sh_cmd(Lex_t *lexp, register int sym, int flag)
|
|||
case EOFSYM:
|
||||
if(sym==NL)
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
if(sym && sym!=lexp->token)
|
||||
{
|
||||
|
|
@ -1304,7 +1305,7 @@ static Shnode_t *item(Lex_t *lexp,int flag)
|
|||
default:
|
||||
if(io==0)
|
||||
return(0);
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case ';':
|
||||
if(io==0)
|
||||
{
|
||||
|
|
@ -1314,6 +1315,7 @@ static Shnode_t *item(Lex_t *lexp,int flag)
|
|||
sh_syntax(lexp);
|
||||
showme = FSHOWME;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
/* simple command */
|
||||
case 0:
|
||||
t = (Shnode_t*)simple(lexp,flag,io);
|
||||
|
|
|
|||
|
|
@ -1218,11 +1218,12 @@ pid_t path_spawn(Shell_t *shp,const char *opath,register char **argv, char **env
|
|||
#endif
|
||||
}
|
||||
}
|
||||
/* FALL THROUGH */
|
||||
#ifdef ENAMETOOLONG
|
||||
/* FALLTHROUGH */
|
||||
case ENAMETOOLONG:
|
||||
#endif /* ENAMETOOLONG */
|
||||
#if !SHOPT_SUID_EXEC
|
||||
/* FALLTHROUGH */
|
||||
case EPERM:
|
||||
#endif
|
||||
shp->path_err = errno;
|
||||
|
|
@ -1242,6 +1243,7 @@ pid_t path_spawn(Shell_t *shp,const char *opath,register char **argv, char **env
|
|||
errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),"command -x: could not execute %s",path);
|
||||
return(pid);
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec,path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,6 +238,7 @@ Sfdouble_t arith_exec(Arith_t *ep)
|
|||
continue;
|
||||
case A_ASSIGNOP1:
|
||||
node.emode |= ARITH_ASSIGNOP;
|
||||
/* FALLTHROUGH */
|
||||
case A_PUSHV:
|
||||
cp = roundptr(ep,cp,Sfdouble_t*);
|
||||
dp = *((Sfdouble_t**)cp);
|
||||
|
|
@ -282,6 +283,7 @@ Sfdouble_t arith_exec(Arith_t *ep)
|
|||
continue;
|
||||
case A_ASSIGNOP:
|
||||
node.nosub = lastsub;
|
||||
/* FALLTHROUGH */
|
||||
case A_STORE:
|
||||
cp = roundptr(ep,cp,Sfdouble_t*);
|
||||
dp = *((Sfdouble_t**)cp);
|
||||
|
|
@ -532,7 +534,7 @@ static int gettok(register struct vars *vp)
|
|||
op = A_DIG;
|
||||
else
|
||||
op = A_REG;
|
||||
/*FALL THRU*/
|
||||
/* FALLTHROUGH */
|
||||
case A_DIG: case A_REG: case A_LIT:
|
||||
keep:
|
||||
ungetchr(vp);
|
||||
|
|
@ -551,10 +553,10 @@ static int gettok(register struct vars *vp)
|
|||
op -= 2;
|
||||
break;
|
||||
}
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case A_NOT: case A_COLON:
|
||||
c = '=';
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case A_ASSIGN:
|
||||
case A_TIMES:
|
||||
case A_PLUS: case A_MINUS:
|
||||
|
|
@ -608,7 +610,7 @@ again:
|
|||
case A_PLUSPLUS:
|
||||
c = A_LVALUE;
|
||||
op = A_INCR|T_NOFLOAT;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case A_TILDE:
|
||||
op |= T_NOFLOAT;
|
||||
common:
|
||||
|
|
@ -762,6 +764,7 @@ again:
|
|||
case A_MINUSMINUS:
|
||||
wasop=0;
|
||||
op |= T_NOFLOAT;
|
||||
/* FALLTHROUGH */
|
||||
case A_ASSIGN:
|
||||
if(!lvalue.value)
|
||||
ERROR(vp,e_notlvalue);
|
||||
|
|
@ -827,7 +830,7 @@ again:
|
|||
case A_AND: case A_OR: case A_XOR: case A_LSHIFT:
|
||||
case A_RSHIFT: case A_MOD:
|
||||
op |= T_NOFLOAT;
|
||||
/* FALL THRU */
|
||||
/* FALLTHROUGH */
|
||||
case A_PLUS: case A_MINUS: case A_TIMES: case A_DIV:
|
||||
case A_EQ: case A_NEQ: case A_LT: case A_LE:
|
||||
case A_GT: case A_GE: case A_POW:
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ static void out_pattern(Sfio_t *iop, register const char *cp, int n)
|
|||
case '\\':
|
||||
if (!(c = *++cp))
|
||||
c = '\\';
|
||||
/*FALLTHROUGH*/
|
||||
/* FALLTHROUGH */
|
||||
case ' ':
|
||||
case '<': case '>': case ';':
|
||||
case '$': case '`': case '\t':
|
||||
|
|
@ -1558,6 +1558,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
|||
break;
|
||||
}
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
case TFORK:
|
||||
{
|
||||
register pid_t parent;
|
||||
|
|
@ -1821,6 +1822,7 @@ int sh_exec(register const Shnode_t *t, int flags)
|
|||
sh_done(shp,0);
|
||||
}
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case TSETIO:
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue