From 21f91dcb505fbfedd13be5942055f8591605e5c7 Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Sat, 20 Feb 2010 13:44:15 -0800 Subject: Patch from karsten to detect unnecessary \n's. Also fix a spacing issue. --- contrib/checkSpace.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'contrib/checkSpace.pl') diff --git a/contrib/checkSpace.pl b/contrib/checkSpace.pl index db061a0828..b694abff64 100755 --- a/contrib/checkSpace.pl +++ b/contrib/checkSpace.pl @@ -28,11 +28,15 @@ 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/)) { + ## Warn about #else #if instead of #elif. + if (($lastline =~ /^\# *else/) and ($_ =~ /^\# *if/)) { print " #else#if:$fn:$.\n"; - } - $lastline = $_; + } + $lastline = $_; + ## Warn about unnecessary empty lines. + if ($lastnil && /^\s*}\n/) { + print " UnnecNL:$fn:$.\n"; + } ## Warn about multiple empty lines. if ($lastnil && /^$/) { print " DoubleNL:$fn:$.\n"; -- cgit v1.2.3-54-g00ecf