diff options
author | Toomas Soome <tsoome@me.com> | 2017-07-11 00:49:25 +0300 |
---|---|---|
committer | Gordon Ross <gwr@nexenta.com> | 2018-02-26 20:42:03 -0500 |
commit | 5ae8bd5389562e74de30aac044ab33ec90e930a5 (patch) | |
tree | f43fdcf10c56fd4bc49ca33625a6c580587047f8 /usr/src/lib/libshell | |
parent | 2a898b17c54fe53254413d8d4cac0de440289b59 (diff) | |
download | illumos-gate-5ae8bd5389562e74de30aac044ab33ec90e930a5.tar.gz |
9165 libshell: this statement may fall through
Reviewed by: C Fraire <cfraire@me.com>
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
Approved by: Gordon Ross <gwr@nexenta.com>
Diffstat (limited to 'usr/src/lib/libshell')
-rw-r--r-- | usr/src/lib/libshell/common/bltins/hist.c | 1 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/bltins/print.c | 3 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/bltins/test.c | 3 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/bltins/typeset.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/edit/emacs.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/edit/hexpand.c | 3 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/edit/vi.c | 11 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/sh/args.c | 1 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/sh/lex.c | 10 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/sh/macro.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/sh/name.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/sh/parse.c | 8 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/sh/path.c | 4 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/sh/streval.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libshell/common/sh/xec.c | 3 |
15 files changed, 54 insertions, 7 deletions
diff --git a/usr/src/lib/libshell/common/bltins/hist.c b/usr/src/lib/libshell/common/bltins/hist.c index 25e98d61cf..ccc60ab44d 100644 --- a/usr/src/lib/libshell/common/bltins/hist.c +++ b/usr/src/lib/libshell/common/bltins/hist.c @@ -89,6 +89,7 @@ int b_hist(int argc,char *argv[], void *extra) range[++indx] = flag; break; } + /* FALLTHROUGH */ case ':': errormsg(SH_DICT,2, "%s", opt_info.arg); break; diff --git a/usr/src/lib/libshell/common/bltins/print.c b/usr/src/lib/libshell/common/bltins/print.c index 41db7b3e46..8ac34de498 100644 --- a/usr/src/lib/libshell/common/bltins/print.c +++ b/usr/src/lib/libshell/common/bltins/print.c @@ -746,12 +746,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': @@ -1010,6 +1012,7 @@ static int fmtvecho(const char *string, struct printf *pp) c <<= 3; c |= (*cp-'0'); } + /* FALLTHROUGH */ default: cp--; } diff --git a/usr/src/lib/libshell/common/bltins/test.c b/usr/src/lib/libshell/common/bltins/test.c index 2cffd57134..9329f8a538 100644 --- a/usr/src/lib/libshell/common/bltins/test.c +++ b/usr/src/lib/libshell/common/bltins/test.c @@ -331,11 +331,11 @@ int test_unop(register int op,register const char *arg) stakputc(0); arg = (const char*)stakptr(offset); stakseek(offset); - /* FALL THRU */ } #else return(0); #endif /* SHOPT_FS_3D */ + /* FALLTHROUGH */ case 'd': return(test_stat(arg,&statb)>=0 && S_ISDIR(statb.st_mode)); case 'c': @@ -398,6 +398,7 @@ int test_unop(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) diff --git a/usr/src/lib/libshell/common/bltins/typeset.c b/usr/src/lib/libshell/common/bltins/typeset.c index f93bcf3d54..f9beba7ed3 100644 --- a/usr/src/lib/libshell/common/bltins/typeset.c +++ b/usr/src/lib/libshell/common/bltins/typeset.c @@ -245,6 +245,7 @@ int b_typeset(int argc,register char *argv[],void *extra) tdata.argnum = (int)opt_info.num; break; } + /* FALLTHROUGH */ case 'F': case 'X': if(!opt_info.arg || (tdata.argnum = opt_info.num) <0) @@ -965,6 +966,7 @@ static int b_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; diff --git a/usr/src/lib/libshell/common/edit/emacs.c b/usr/src/lib/libshell/common/edit/emacs.c index 7a3c39e951..be96eb1af4 100644 --- a/usr/src/lib/libshell/common/edit/emacs.c +++ b/usr/src/lib/libshell/common/edit/emacs.c @@ -355,6 +355,7 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit) } ep->ed->e_tabcount = 0; } + /* FALLTHROUGH */ do_default_processing: default: @@ -550,6 +551,7 @@ update: case KILLCHAR : cur = 0; oadjust = -1; + /* FALLTHROUGH */ case cntl('K') : if(oadjust >= 0) { @@ -936,6 +938,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count) /* file name expansion */ case cntl('[') : /* filename completion */ i = '\\'; + /* FALLTHROUGH */ case '*': /* filename expansion */ case '=': /* escape = - list all matching file names */ ep->mark = cur; @@ -1053,6 +1056,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 */ diff --git a/usr/src/lib/libshell/common/edit/hexpand.c b/usr/src/lib/libshell/common/edit/hexpand.c index c796334ec6..9d434ae673 100644 --- a/usr/src/lib/libshell/common/edit/hexpand.c +++ b/usr/src/lib/libshell/common/edit/hexpand.c @@ -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--; diff --git a/usr/src/lib/libshell/common/edit/vi.c b/usr/src/lib/libshell/common/edit/vi.c index 2365c16ff5..2abcbd53e4 100644 --- a/usr/src/lib/libshell/common/edit/vi.c +++ b/usr/src/lib/libshell/common/edit/vi.c @@ -842,6 +842,7 @@ static int cntlmode(Vi_t *vp) case BAD: /*** no match ***/ ed_ringbell(); + /* FALLTHROUGH */ default: if( vp->u_column == INVALID ) @@ -931,6 +932,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) @@ -989,6 +991,7 @@ static int cntlmode(Vi_t *vp) } refresh(vp,INPUT); } + /* FALLTHROUGH */ case '\n': /** send to shell **/ return(ENTER); @@ -1010,6 +1013,7 @@ static int cntlmode(Vi_t *vp) continue; } } + /* FALLTHROUGH */ default: ringbell: ed_ringbell(); @@ -1476,6 +1480,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 ) @@ -1675,6 +1680,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 **/ @@ -2321,10 +2327,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; @@ -2407,6 +2415,7 @@ addin: case 'A': /** append to end of line **/ cur_virt = last_virt; sync_cursor(vp); + /* FALLTHROUGH */ case 'a': /** append **/ if( fold(mode) == 'A' ) @@ -2426,6 +2435,7 @@ addin: case 'I': /** insert at beginning of line **/ cur_virt = first_virt; sync_cursor(vp); + /* FALLTHROUGH */ case 'i': /** insert **/ if( fold(mode) == 'I' ) @@ -2502,6 +2512,7 @@ deleol: vp->ocur_virt = INVALID; --cur_virt; } + /* FALLTHROUGH */ case 'p': /** print **/ if( p[0] == '\0' ) diff --git a/usr/src/lib/libshell/common/sh/args.c b/usr/src/lib/libshell/common/sh/args.c index 32afeefa9e..b70649cdb4 100644 --- a/usr/src/lib/libshell/common/sh/args.c +++ b/usr/src/lib/libshell/common/sh/args.c @@ -271,6 +271,7 @@ int sh_argopts(int argc,register char *argv[], void *context) case 'I': continue; #endif /* SHOPT_REGRESS */ + /*FALLTHROUGH*/ skip: default: if(cp=strchr(optksh,n)) diff --git a/usr/src/lib/libshell/common/sh/lex.c b/usr/src/lib/libshell/common/sh/lex.c index b6fbbc1779..29886857fa 100644 --- a/usr/src/lib/libshell/common/sh/lex.c +++ b/usr/src/lib/libshell/common/sh/lex.c @@ -477,7 +477,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; @@ -488,6 +488,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; @@ -881,6 +882,7 @@ int sh_lex(Lex_t* lp) case S_ALP: if(c=='.' && endchar(lp)=='$') goto err; + /* FALLTHROUGH */ case S_SPC2: case S_DIG: wordflags |= ARG_MAC; @@ -895,12 +897,14 @@ int sh_lex(Lex_t* lp) poplevel(lp); } break; + /* FALLTHROUGH */ #if SHOPT_TYPEDEF case '@': #endif /* SHOPT_TYPEDEF */ case '!': if(n!=S_ALP) goto dolerr; + /* FALLTHROUGH */ case '#': case RBRACE: if(n==S_ALP) @@ -1379,7 +1383,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) { @@ -1395,6 +1399,7 @@ breakloop: return(lp->token); } + /* FALLTHROUGH */ case TEST_OR: case TEST_AND: case 0: return(lp->token=0); @@ -1563,6 +1568,7 @@ static int comsub(register Lex_t *lp, int endtok) lp->lastline = line; lp->lasttok = endtok; sh_syntax(lp); + /* FALLTHROUGH */ case IOSEEKSYM: if(fcgetc(c)!='#' && c>0) fcseek(-1); diff --git a/usr/src/lib/libshell/common/sh/macro.c b/usr/src/lib/libshell/common/sh/macro.c index 2af54f88f7..8e6d37fbb1 100644 --- a/usr/src/lib/libshell/common/sh/macro.c +++ b/usr/src/lib/libshell/common/sh/macro.c @@ -458,6 +458,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; @@ -600,6 +601,7 @@ static void copyto(register Mac_t *mp,int endch, int newquote) goto pattern; if(endch==RBRACE && *cp==LPAREN && mp->pattern && brace) goto pattern; + /* FALLTHROUGH */ case S_EOF: if(c) { @@ -616,6 +618,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) { @@ -679,6 +682,7 @@ e_badsubscript,*cp); cp = first = fcseek(0); break; } + /* FALLTHROUGH */ case S_PAT: if(mp->pattern && !(mp->quote || mp->lit)) { diff --git a/usr/src/lib/libshell/common/sh/name.c b/usr/src/lib/libshell/common/sh/name.c index 84e9cced11..52857a151c 100644 --- a/usr/src/lib/libshell/common/sh/name.c +++ b/usr/src/lib/libshell/common/sh/name.c @@ -731,10 +731,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; diff --git a/usr/src/lib/libshell/common/sh/parse.c b/usr/src/lib/libshell/common/sh/parse.c index 35aca3f496..277224e176 100644 --- a/usr/src/lib/libshell/common/sh/parse.c +++ b/usr/src/lib/libshell/common/sh/parse.c @@ -490,7 +490,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) { @@ -499,7 +499,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); @@ -509,6 +509,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) { @@ -1225,6 +1226,7 @@ static Shnode_t *item(Lex_t *lexp,int flag) default: if(io==0) return(0); + /* FALLTHROUGH */ case ';': if(io==0) @@ -1235,7 +1237,7 @@ static Shnode_t *item(Lex_t *lexp,int flag) sh_syntax(lexp); showme = FSHOWME; } - /* simple command */ + /* FALLTHROUGH */ case 0: t = (Shnode_t*)simple(lexp,flag,io); if(t->com.comarg && lexp->intypeset && (lexp->sh->shcomp || sh_isoption(SH_NOEXEC) || sh.dot_depth)) diff --git a/usr/src/lib/libshell/common/sh/path.c b/usr/src/lib/libshell/common/sh/path.c index c6f691aef4..be90dd7b8f 100644 --- a/usr/src/lib/libshell/common/sh/path.c +++ b/usr/src/lib/libshell/common/sh/path.c @@ -1173,6 +1173,7 @@ retry: } exscript(shp,path,argv,envp); #ifndef apollo + /* FALLTHROUGH */ case EACCES: { struct stat statb; @@ -1186,9 +1187,9 @@ retry: #endif } } - /* FALL THROUGH */ #endif /* !apollo */ #ifdef ENAMETOOLONG + /* FALLTHROUGH */ case ENAMETOOLONG: #endif /* ENAMETOOLONG */ #if !SHOPT_SUID_EXEC @@ -1211,6 +1212,7 @@ retry: goto retry; return(pid); } + /* FALLTHROUGH */ default: errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec,path); } diff --git a/usr/src/lib/libshell/common/sh/streval.c b/usr/src/lib/libshell/common/sh/streval.c index 7053831da0..2b7a677f68 100644 --- a/usr/src/lib/libshell/common/sh/streval.c +++ b/usr/src/lib/libshell/common/sh/streval.c @@ -257,6 +257,7 @@ Sfdouble_t arith_exec(Arith_t *ep) break; case A_ASSIGNOP: node.nosub = 1; + /* FALLTHROUGH */ case A_STORE: cp = roundptr(ep,cp,Sfdouble_t*); dp = *((Sfdouble_t**)cp); @@ -670,6 +671,7 @@ again: case A_MINUSMINUS: wasop=0; op |= T_NOFLOAT; + /* FALLTHROUGH */ case A_ASSIGN: if(!lvalue.value) ERROR(vp,e_notlvalue); diff --git a/usr/src/lib/libshell/common/sh/xec.c b/usr/src/lib/libshell/common/sh/xec.c index afceb6a355..3975060421 100644 --- a/usr/src/lib/libshell/common/sh/xec.c +++ b/usr/src/lib/libshell/common/sh/xec.c @@ -1160,6 +1160,7 @@ int sh_exec(register const Shnode_t *t, int flags) break; } } + /* FALLTHROUGH */ case TFORK: { register pid_t parent; @@ -1373,6 +1374,7 @@ int sh_exec(register const Shnode_t *t, int flags) sh_done(shp,0); } } + /* FALLTHROUGH */ case TSETIO: { @@ -3223,6 +3225,7 @@ static pid_t sh_ntfork(Shell_t *shp,const Shnode_t *t,char *argv[],int *jobid,in { case ENOENT: errormsg(SH_DICT,ERROR_system(ERROR_NOENT),e_found+4); + /* FALLTHROUGH */ default: errormsg(SH_DICT,ERROR_system(ERROR_NOEXEC),e_exec+4); } |