On Fri, Oct 23, 2009 at 3:09 PM, Parrot <[email protected]> wrote:
> #1137: [PATCH] fix codingstd/c_indent.t wrt switch/case labels
> ------------------------------+---------------------------------------------
>  Reporter:  plobsing          |       Owner:  jkeenan
>     Type:  patch             |      Status:  assigned
>  Priority:  minor             |   Milestone:
> Component:  coding_standards  |     Version:  1.6.0
>  Severity:  low               |    Keywords:
>     Lang:                    |       Patch:
>  Platform:                    |
> ------------------------------+---------------------------------------------
> Changes (by jkeenan):
>
>  * status:  new => assigned
>
>
> Comment:
>
>  I tried this patch out in trunk and ran `prove`.  The output is attached.
>
>  As it stands, I think the patch creates more problems than it solves.  It
>  flags as errors many code chunks that we probably don't think of as bad C
>  code formatting.  For example, it flags 3 errors in this code from
>  ''src/io/sockets_unix.c'':
>  {{{
>  171             case EINPROGRESS:
>  172                 goto AGAIN;
>  173             case EISCONN:
>  174                 return 0;
>  175             default:
>  176                 return -1;
>  177         }
>  }}}
>  Here we have 3 lines ending in a colon outdented by 4 characters rather
>  than 2.  They pass the trunk version of ''c_indent.t'' but not the patched
>  version.  I suspect that the problem is that, intuitively, we only want
>  '''LABELs''' to be outdented by 2; we want all other indentation to be by
>  4.  I think this was what plobsing was trying to get at.  However, it's
>  very difficult to embody this precisely in code because it's difficult to
>  say that one line ending in a colon is a LABEL whereas another, as in a
>  switch statement, is not.
>
>  Other thoughts/opinions?
>
>  Thank you very much.
>
>  kid51

Looks like making

if ($line =~ /:$/) {

slightly smarter would be sufficient; say, optional leading whitespace
followed by valid label characters ending with a colon - that should
be enough to stop it from catching 'case FOO:'.

-- 
Will "Coke" Coleda
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to