| 1 | Index: t/codingstd/c_indent.t |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- t/codingstd/c_indent.t (revision 42801) |
|---|
| 4 | +++ t/codingstd/c_indent.t (working copy) |
|---|
| 5 | @@ -123,10 +123,10 @@ |
|---|
| 6 | pop @{ $state{stack} }; |
|---|
| 7 | next; |
|---|
| 8 | } |
|---|
| 9 | - next unless @{ $state{stack} }; |
|---|
| 10 | |
|---|
| 11 | if ( $line =~ m/^\s*\#(\s*)(.*)/) |
|---|
| 12 | { |
|---|
| 13 | + next unless @{ $state{stack} }; |
|---|
| 14 | my ($prespace, $condition) = ($1,$2); |
|---|
| 15 | next if ($line =~ m/ASSERT_ARGS_/); # autogenerated by headerizer |
|---|
| 16 | my $indent = q{ } x (@{ $state{stack} }); |
|---|
| 17 | @@ -145,12 +145,14 @@ |
|---|
| 18 | # probably overkill for this task. For now we just check the |
|---|
| 19 | # first line of a function, and assume that more likely than not |
|---|
| 20 | # indenting is consistent within a func body. |
|---|
| 21 | - if ($line =~ /^(\s*).*\{\s*$/) { |
|---|
| 22 | + if ($line =~ /^(\s*)(.*)\{\s*$/) { |
|---|
| 23 | |
|---|
| 24 | - my $prespace = $1; |
|---|
| 25 | - # note the beginning of a block, and its indent depth. |
|---|
| 26 | - $state{bif} = length($prespace); |
|---|
| 27 | - next; |
|---|
| 28 | + if ($2 ne '%') { # ignore yacc/lex blocks |
|---|
| 29 | + my $prespace = $1; |
|---|
| 30 | + # note the beginning of a block, and its indent depth. |
|---|
| 31 | + $state{bif} = length($prespace); |
|---|
| 32 | + next; |
|---|
| 33 | + } |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | if ($line =~ /^\s*([\#\}])/) { |
|---|
| 37 | @@ -161,7 +163,7 @@ |
|---|
| 38 | next; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | - if ( defined($state{bif}) ) { |
|---|
| 42 | + if ( defined($state{bif}) and $line !~ m{^\s*/\*} ) { |
|---|
| 43 | |
|---|
| 44 | # first line of a block |
|---|
| 45 | if ( $state{bif} == 0 ) { |
|---|