aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-06-23 15:54:33 -0400
committerNick Mathewson <nickm@torproject.org>2012-06-23 15:54:33 -0400
commit8e5d3cab2636aa7a41fd14a09e027cee9fe42df2 (patch)
tree316b3db48a808144c4f3244e357c5a0f44652b74 /contrib
parent95ad59fa79cba73a6916b5deccee12b541d5f756 (diff)
parenta6688c574e569a2a018038414198ab440344ba95 (diff)
downloadtor-8e5d3cab2636aa7a41fd14a09e027cee9fe42df2.tar
tor-8e5d3cab2636aa7a41fd14a09e027cee9fe42df2.tar.gz
Merge remote-tracking branch 'origin/maint-0.2.3'
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/checkSpace.pl10
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/checkSpace.pl b/contrib/checkSpace.pl
index a18df99b1..682dbced0 100755
--- a/contrib/checkSpace.pl
+++ b/contrib/checkSpace.pl
@@ -32,10 +32,18 @@ for $fn (@ARGV) {
if ($C && /\s(?:if|while|for|switch)\(/) {
print " KW(:$fn:$.\n";
}
- ## Warn about #else #if instead of #elif.
+ ## Warn about #else #if instead of #elif.
if (($lastline =~ /^\# *else/) and ($_ =~ /^\# *if/)) {
print " #else#if:$fn:$.\n";
}
+ ## Warn about some K&R violations
+ if (/^\s+\{/ and $lastline =~ /^\s*(if|while|for|else if)/ and
+ $lastline !~ /\{$/) {
+ print "non-K&R {:$fn:$.\n";
+ }
+ if (/^\s*else/ and $lastline =~ /\}$/) {
+ print " }\\nelse:$fn:$.\n";
+ }
$lastline = $_;
## Warn about unnecessary empty lines.
if ($lastnil && /^\s*}\n/) {