9309 mdb: this statement may fall through

Review Request #972 — Created March 18, 2018 and submitted

tsoome
illumos-gate
9309
ea67737...
general
../../../common/mdb/mdb_io.c:906:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
   n = (ushort_t)VA_ARG(ap, uint_t);
     ^
../../../common/mdb/mdb_io.c:908:2: note: here
  default:
  ^~~~~~~

../../../common/mdb/mdb_main.c:232:5: error: this statement may fall through [-Werror=implicit-fallthrough=]
     terminate(1);
     ^~~~~~~~~~~~
../../../common/mdb/mdb_main.c:235:4: note: here
    case 'r':
    ^~~~

../../../common/modules/idm/idm.c:2671:4: error: this statement may fall through [-Werror=implicit-fallthrough=]
    mdb_printf("%s|%s (%d)\n\t%9s %s (%d)\n",
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        ts_string, state_name, sar->sar_state,
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        "New State", new_state_name, sar->sar_new_state);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../common/modules/idm/idm.c:2674:3: note: here
   default:
   ^~~~~~~

../../kmdb/kmdb_dpi_isadep.c:53:9: error: this statement may fall through [-Werr
or=implicit-fallthrough=]
   errno = EACCES;
../../kmdb/kmdb_dpi_isadep.c:54:2: note: here
  default:
  ^~~~~~~

cc1: all warnings being treated as errors


  • 0
  • 0
  • 3
  • 0
  • 3
Description From Last Updated
jlevon
  1. 
      
  2. usr/src/cmd/mdb/common/mdb/mdb_main.c (Diff revision 1)
     
     

    Nit: spurious space before ) ? But why not just add __NORETURN to :114

  3. 
      
seeemef@mac.com
  1. 
      
  2. Wondering if these assignments should be moved to the default: just above so that there's not a chance of uninitialized usage for the SAR_STATE_CHANGE mdb_printf().

    1. tes, that assignment is clearly in wrong place.

  3. 
      
jbk
  1. 
      
  2. Is this correct? You have a nested switch statement, the inner statement is setting state_name and new_state_name, then after the inner switch is complete, it is printing out the old + new state. WIth the fallthrough, it's then setting the state_name and new_state_name unconditionally. I suspect a break was meant to go there.

    1. yep, i think you are correct there, especially also considering the precious nested switch:)

  3. 
      
tsoome
seeemef@mac.com
  1. LGTM

  2. 
      
jbk
  1. Ship It!
  2. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...