8733 cxgbe: variable 'execute' set but not used

Review Request #684 — Created Oct. 27, 2017 and submitted

tsoome
illumos-gate
8733
cbc2317...
general
../../../common/io/cxgbe/common/t4_hw.c:351:6: error: variable 'execute' set but not used [-Werror=unused-but-set-variable]
  u16 execute = 0;
      ^~~~~~~
cc1: all warnings being treated as errors


  • 0
  • 0
  • 0
  • 1
  • 1
Description From Last Updated
seeemef@mac.com
  1. 
      
  2. Is this warning actually that the 0 is unused, since `execute' is reassigned later before its use as a function arg? Would it be more terse to just remove the assignment?
    1. Chris is right. Remove the "= 0" and you should be good (and with less invasive changes).

    2. nop. with debug mode:
      ../../../common/io/cxgbe/common/t4_hw.c: In function 't4_wr_mbox_meat_timeout':
      ../../../common/io/cxgbe/common/t4_hw.c:351:6: error: variable 'execute' set but not used [-Werror=unused-but-set-variable]
      u16 execute;
      ^~~

      And yea, well, we do not need to move out assignments; at the time I did want to check if it will improve the readability.

    3. Further down there's an "execute = i + 1" in a for loop. That's the set. Why isn't it used, though?!

    4. It's used by the CH_MSG macro, which elides the statement in non-debug builds, and generates the warning.

  3. 
      
seeemef@mac.com
  1. OK, I see. LGTM

  2. 
      
jbk
  1. Ship It!
  2. 
      
yuripv
  1. Ship It!
  2. 
      
andy_js
  1. -1.

    Replace "execute" with "i + 1". That's what we did.

    1. fixed, yep, thats exactly what has to be done there.

  2. 
      
tsoome
yuripv
  1. Ship It!
  2. 
      
andy_js
  1. Ship It!
  2. 
      
jbk
  1. Ship It!
  2. 
      
seeemef@mac.com
  1. Ship It!
  2. 
      
tsoome
Review request changed

Status: Closed (submitted)

Loading...