8196 captoinfo: misleading-indentation

Review Request #491 — Created May 10, 2017 and submitted

tsoome
illumos-gate
8196
ba0d0e8...
general
captoinfo.c: In function 'checktermcap':
captoinfo.c:227:4: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
    if (type != tbool && type != tcancel)
    ^~
captoinfo.c:232:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
     continue;
     ^~~~~~~~
captoinfo.c:237:4: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
    if (type != tnum && type != tcancel)
    ^~
captoinfo.c:242:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
     continue;
     ^~~~~~~~
captoinfo.c:247:4: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
    if (type != tstr && type != tcancel)
    ^~
captoinfo.c:252:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
     continue;
     ^~~~~~~~
captoinfo.c: In function 'search':
captoinfo.c:469:2: error: this 'for' clause does not guard... [-Werror=misleading-indentation]
  for (i = 0; names [i] != NULL; i++)
  ^~~
captoinfo.c:472:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'for'
   return (-1);
   ^~~~~~
captoinfo.c: In function 'fancycap':
captoinfo.c:1014:2: error: this 'while' clause does not guard... [-Werror=misleading-indentation]
  while (*string)
  ^~~~~
captoinfo.c:1040:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'while'
   return (0);
   ^~~~~~
captoinfo.c: In function 'initdirname':
captoinfo.c:1368:2: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
  if (verbose)
  ^~
captoinfo.c:1370:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
   environ = newenviron;
   ^~~~~~~
cc1: all warnings being treated as errors


marcel
  1. Ship It!
  2. 
      
rm
  1. I think this makes sense, but could you add some notes of analysis regarding how you determined to move the continues? I think it was just incorrectly scoped and it makes sense that the continue always applies as we're worried about failures.

    1. Did add update into issue description.

    2. Yes, the fix looks correct to me, but I'd rephrase the description a bit - the purpose of the checktermcap() is, well, to check termcap entries; we look for the name in bools, nums, and strings; if one is found, we should NOT fallthrough to the line 253, which reports invalid name -- we already know that the name is valid.

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

Status: Closed (submitted)

Loading...