10194 iscsi: this statement may fall through

Review Request #1353 — Created Jan. 9, 2019 and submitted

tsoome
illumos-gate
10194
7ce7988...
general
../../common/io/scsi/adapters/iscsi/iscsi_login.c:2069:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
   switch (status_detail) {
   ^~~~~~
../../common/io/scsi/adapters/iscsi/iscsi_login.c:2075:2: note: here
  case 0x01:
  ^~~~
../../common/io/scsi/adapters/iscsi/iscsi_login.c:2076:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
   switch (status_detail) {
   ^~~~~~
../../common/io/scsi/adapters/iscsi/iscsi_login.c:2086:2: note: here
  case 0x02:
  ^~~~
../../common/io/scsi/adapters/iscsi/iscsi_login.c:2087:3: error: this statement may fall through [-Werror=implicit-fallthrough=]
   switch (status_detail) {
   ^~~~~~
../../common/io/scsi/adapters/iscsi/iscsi_login.c:2125:2: note: here
  case 0x03:
  ^~~~
cc1: all warnings being treated as errors


  • 0
  • 0
  • 0
  • 1
  • 1
Description From Last Updated
jlevon
  1. Ship It!
  2. 
      
vgusev
  1. 
      
  2. What if remove this 'default: break' ?

    1. We can not do that:

      ../../common/io/scsi/adapters/iscsi/iscsi_login.c: In function 'iscsi_login_failure_str':
      ../../common/io/scsi/adapters/iscsi/iscsi_login.c:2066:3: error: label at end of compound statement
         default:
         ^~~~~~~
      cc1: all warnings being treated as errors
      

      Anyhow, it does not really change any behavior.

    2. I mean this change:

      @@ -2063,9 +2063,8 @@ iscsi_login_failure_str(uchar_t status_class, uchar_t status_detail)
                      switch (status_detail) {
                      case 0x00:
                              return ("Login is proceeding okay.");
      -               default:
      -                       break;
                      }
      +               break;
      
    3. Yes, but removing default can rise other questions... well, I do know what you mean - in such case the empty default is ugly, this specific switch would be much better to be replaced by if statement. But then again, I am not too keen about such replacement because then I should dig into iscsi specs to see if there are some responses missed or not, and I do not have time for this:D Which is why I would just let the compiler do its job optimize the proper asm:)

    4. then I should dig into iscsi specs to see if there are some responses missed

      I expect that you shouldn't dig, due to removing "default: break" doesn't change behaviour.

      Having "default: break;" has the same behaviour as without one and introduces difficulties. Anyway, I mark this a Approved :)

  3. 
      
andy_js
  1. Ship It!
  2. 
      
vgusev
  1. Ship It!
  2. 
      
domag02
  1. Ship It!
  2. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...