From 6d58d80e78d9b6706bda502a9041351f4a619306 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 6 Jan 2008 03:16:08 +0000 Subject: 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 --- contrib/checkSpace.pl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'contrib') 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 () { ## 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"; -- cgit v1.2.3