aboutsummaryrefslogtreecommitdiff
path: root/contrib/checkSpace.pl
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-01-06 03:16:08 +0000
committerNick Mathewson <nickm@torproject.org>2008-01-06 03:16:08 +0000
commit6d58d80e78d9b6706bda502a9041351f4a619306 (patch)
treef5b0a15ed1e1f212de955e360b06661e47ac0c50 /contrib/checkSpace.pl
parent864d83059823bbd89c94dcff258f99977b17bcd6 (diff)
downloadtor-6d58d80e78d9b6706bda502a9041351f4a619306.tar
tor-6d58d80e78d9b6706bda502a9041351f4a619306.tar.gz
r17472@catbus: nickm | 2008-01-05 22:10:19 -0500
Another test for the increasingly bad check-spaces style checker to check: #else\n#if is almost a sure sign of a failure to use #elif. Fortunately, we only did that 3 times. svn:r13039
Diffstat (limited to 'contrib/checkSpace.pl')
-rwxr-xr-xcontrib/checkSpace.pl6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/checkSpace.pl b/contrib/checkSpace.pl
index 686427f73..fb0c9861b 100755
--- a/contrib/checkSpace.pl
+++ b/contrib/checkSpace.pl
@@ -9,6 +9,7 @@ if ($ARGV[0] =~ /^-/) {
for $fn (@ARGV) {
open(F, "$fn");
$lastnil = 0;
+ $lastline = "";
$incomment = 0;
while (<F>) {
## Warn about windows-style newlines.
@@ -27,6 +28,11 @@ for $fn (@ARGV) {
if ($C && /\s(?:if|while|for|switch)\(/) {
print " KW(:$fn:$.\n";
}
+ ## Warn about #else #if instead of #elif.
+ if (($lastline =~ /^\# *else/) and ($_ =~ /^\# *if/)) {
+ print " #else#if:$fn:$.\n";
+ }
+ $lastline = $_;
## Warn about multiple empty lines.
if ($lastnil && /^$/) {
print " DoubleNL:$fn:$.\n";