Project

General

Profile

Bug #9165

libshell: this statement may fall through

Added by Toomas Soome almost 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
2018-02-21
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

Issue found by gcc 7 build:

    ../common/sh/macro.c:460:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
          len = 1;
          ~~~~^~~
    ../common/sh/macro.c:461:9: note: here
             case 1:
             ^~~~
    ../common/sh/macro.c:601:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(endch==RBRACE && *cp==LPAREN && mp->pattern && brace)
          ^
    ../common/sh/macro.c:603:7: note: here
           case S_EOF:
           ^~~~
    ../common/sh/macro.c:617:15: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(mp->lit || mp->arith)
           ~~~~~~~~^~~~~~~~~~~~
    ../common/sh/macro.c:619:7: note: here
           case S_LIT:
           ^~~~
    ../common/sh/macro.c:650:37: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(mp->arith || (((mp->assign&1) || endch==RBRACT) &&
                         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
    ../common/sh/macro.c:682:7: note: here
           case S_PAT:
           ^~~~

    ../common/sh/name.c: In function 'nv_create':
    ../common/sh/name.c:724:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(!copy && !(flags&NV_NOREF))
          ^
    ../common/sh/name.c:734:3: note: here
       skip:
       ^~~~

    ../common/sh/lex.c:902:9: error: this statement may fall through [-Werror=implicit-fallthrough=]
           if(n!=S_ALP)
             ^
    ../common/sh/lex.c:904:6: note: here
          case '#':
          ^~~~
    ../common/sh/lex.c:486:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
         if(n==S_NLTOK)
           ^
    ../common/sh/lex.c:491:4: note: here
        case S_BLNK:
        ^~~~
    ../common/sh/lex.c:882:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
         if(c=='.' && endchar(lp)=='$')
           ^
    ../common/sh/lex.c:884:4: note: here
        case S_SPC2:
        ^~~~
    ../common/sh/lex.c:1384:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(lp->lex.testop2)
          ^
    ../common/sh/lex.c:1398:3: note: here
       case TEST_OR: case TEST_AND:
       ^~~~
    ../common/sh/lex.c: In function 'comsub':
    ../common/sh/lex.c:1565:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
         sh_syntax(lp);
         ^~~~~~~~~~~~~
    ../common/sh/lex.c:1566:8: note: here
            case IOSEEKSYM:
            ^~~~

    ../common/sh/parse.c:510:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
       if(sym==NL)
         ^
    ../common/sh/parse.c:512:6: note: here
          default:
          ^~~~~~~
    ../common/sh/parse.c: In function 'item':
    ../common/sh/parse.c:1226:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
       if(io==0)
         ^
    ../common/sh/parse.c:1229:6: note: here
          case ';':
          ^~~~
    ../common/sh/parse.c:1230:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
       if(io==0)
         ^
    ../common/sh/parse.c:1239:6: note: here
          case 0:
          ^~~~

    ../common/sh/path.c:1174:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
       exscript(shp,path,argv,envp);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../common/sh/path.c:1176:6: note: here
          case EACCES:
          ^~~~
    ../common/sh/path.c:1177:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
          {
          ^
    ../common/sh/path.c:1192:6: note: here
          case ENAMETOOLONG:
          ^~~~
    ../common/sh/path.c:1207:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
       if(sh.xargmin)
         ^
    ../common/sh/path.c:1214:6: note: here
          default:
          ^~~~~~~

    ../common/edit/vi.c:1478:14: error: this statement may fall through [-Werror=implicit-fallthrough=]
        vp->addnl = 0;
        ~~~~~~~~~~^~~
    ../common/edit/vi.c:1480:3: note: here
       case '\n':  /** newline or return **/
       ^~~~
    ../common/edit/vi.c: In function 'cntlmode':
    ../common/edit/vi.c:844:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
          ed_ringbell();
          ^~~~~~~~~~~~~
    ../common/edit/vi.c:846:4: note: here
        default:
        ^~~~~~~
    ../common/edit/vi.c:931:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(vp->repeat_set==0)
          ^
    ../common/edit/vi.c:935:3: note: here
       case 'G':  /** goto command repeat **/
       ^~~~
    ../common/edit/vi.c:959:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if( cur_virt != INVALID )
          ^
    ../common/edit/vi.c:993:3: note: here
       case '\n':  /** send to shell **/
       ^~~~
    ../common/edit/vi.c:1004:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(lookahead)
          ^
    ../common/edit/vi.c:1013:3: note: here
       default:
       ^~~~~~~
    ../common/edit/vi.c: In function 'mvcursor':
    ../common/edit/vi.c:1677:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
       incr = 1;
       ~~~~~^~~
    ../common/edit/vi.c:1679:2: note: here
      case 'T':  /** find up to new char backward **/
      ^~~~
    ../common/edit/vi.c: In function 'textmod':
    ../common/edit/vi.c:2323:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
       c = '=';
       ~~^~~~~
    ../common/edit/vi.c:2324:2: note: here
      case '*':  /** do file name expansion in place **/
      ^~~~
    ../common/edit/vi.c:2326:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
       if( cur_virt == INVALID )
         ^
    ../common/edit/vi.c:2328:2: note: here
      case '=':  /** list file name expansions **/
      ^~~~
    ../common/edit/vi.c:2409:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
       sync_cursor(vp);
       ^~~~~~~~~~~~~~~
    ../common/edit/vi.c:2411:2: note: here
      case 'a':  /** append **/
      ^~~~
    ../common/edit/vi.c:2428:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
       sync_cursor(vp);
       ^~~~~~~~~~~~~~~
    ../common/edit/vi.c:2430:2: note: here
      case 'i':  /** insert **/
      ^~~~
    ../common/edit/vi.c:2498:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
       if( cur_virt != INVALID )
         ^
    ../common/edit/vi.c:2506:2: note: here
      case 'p':  /** print **/
      ^~~~

    ../common/sh/xec.c:703:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
           {
           ^
    ../common/sh/xec.c:1163:7: note: here
           case TFORK:
           ^~~~
    ../common/sh/xec.c:1164:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
           {
           ^
    ../common/sh/xec.c:1377:7: note: here
           case TSETIO:
           ^~~~
    ../common/sh/xec.c: In function 'sh_ntfork':
    ../common/sh/xec.c:3225:4: error: this statement may fall through [-Werror=implicit-fallthrough=]
        errormsg(SH_DICT,ERROR_system(ERROR_NOENT),e_found+4);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../common/sh/xec.c:3226:7: note: here
           default:
           ^~~~~~~

    ../common/bltins/typeset.c:243:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
         if(opt_info.offset && !strchr(argv[opt_info.index],'E'))
           ^
    ../common/bltins/typeset.c:248:4: note: here
        case 'F':
        ^~~~
    ../common/bltins/typeset.c: In function 'b_unall':
    ../common/bltins/typeset.c:967:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
        nflag = NV_NOREF;
    ../common/bltins/typeset.c:968:3: note: here
       case 'v':
       ^~~~

    ../common/sh/streval.c:259:15: error: this statement may fall through [-Werror=implicit-fallthrough=]
        node.nosub = 1;
        ~~~~~~~~~~~^~~
    ../common/sh/streval.c:260:7: note: here
           case A_STORE:
           ^~~~
    ../common/sh/streval.c: In function 'expr':
    ../common/sh/streval.c:672:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
        op |= T_NOFLOAT;
           ^
    ../common/sh/streval.c:673:3: note: here
       case A_ASSIGN:
       ^~~~

    ../common/edit/emacs.c:343:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(cur>0  && ep->ed->sh->nextprompt)
          ^
    ../common/edit/emacs.c:358:3: note: here
       do_default_processing:
       ^~~~~~~~~~~~~~~~~~~~~
    ../common/edit/emacs.c:552:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
        oadjust = -1;
        ~~~~~~~~^~~~
    ../common/edit/emacs.c:553:3: note: here
       case cntl('K') :
       ^~~~
    ../common/edit/emacs.c: In function 'escape':
    ../common/edit/emacs.c:938:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        i = '\\';
        ~~^~~~~~
    ../common/edit/emacs.c:939:3: note: here
       case '*':  /* filename expansion */
       ^~~~
    ../common/edit/emacs.c:1055:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        i = '_';
        ~~^~~~~
    ../common/edit/emacs.c:1057:3: note: here
       default:
       ^~~~~~~

    ../common/sh/args.c:260:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(setflag)
          ^
    ../common/sh/args.c:274:7: note: here
           skip:
           ^~~~

    ../common/bltins/print.c:748:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
        longmax = LDBL_ULLONG_MAX;
    ../common/bltins/print.c:749:3: note: here
       case '.':
       ^~~~
    ../common/bltins/print.c:750:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        if(fe->size==2 && strchr("bcsqHPRQTZ",*fe->form))
          ^
    ../common/bltins/print.c:755:3: note: here
       case 'd':
       ^~~~
    ../common/bltins/print.c: In function 'fmtvecho':
    ../common/bltins/print.c:1008:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
         while(++cp<cpmax && *cp>='0' && *cp<='7')
              ^
    ../common/bltins/print.c:1013:4: note: here
        default:
        ^~~~~~~

    ../common/edit/hexpand.c:252:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
        cp++;
        ~~^~
    ../common/edit/hexpand.c:253:3: note: here
       case '0': /* reference by number */
       ^~~~
    ../common/edit/hexpand.c:275:9: error: this statement may fall through [-Werror=implicit-fallthrough=]
        flag |= HIST_QUESTION;
    ../common/edit/hexpand.c:276:3: note: here
       string_event:
       ^~~~~~~~~~~~
    ../common/edit/hexpand.c:363:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
         if(n == 0)
           ^
    ../common/edit/hexpand.c:379:4: note: here
        default:
        ^~~~~~~

    ../common/bltins/hist.c:85:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
       if(indx<=0)
         ^
    ../common/bltins/hist.c:92:6: note: here
          case ':':
          ^~~~

    ../common/bltins/test.c:324:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
          {
          ^
    ../common/bltins/test.c:339:6: note: here
          case 'd':
          ^~~~
    ../common/bltins/test.c:400:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
       sfsync(sfstdout);
       ^~~~~~~~~~~~~~~~
    ../common/bltins/test.c:401:6: note: here
          case 'O':
          ^~~~

    cc1: all warnings being treated as errors
       ^~~~~~~~~~~~~~~~
    ../common/bltins/test.c:401:6: note: here
          case 'O':
          ^~~~

    cc1: all warnings being treated as errors

History

#1

Updated by Electric Monk almost 2 years ago

  • % Done changed from 90 to 100
  • Status changed from In Progress to Closed

git commit 5ae8bd5389562e74de30aac044ab33ec90e930a5

commit  5ae8bd5389562e74de30aac044ab33ec90e930a5
Author: Toomas Soome <tsoome@me.com>
Date:   2018-02-27T01:42:03.000Z

    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>

Also available in: Atom PDF