diff options
Diffstat (limited to 'lib/checksrc.pl')
| -rwxr-xr-x | lib/checksrc.pl | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl index c86222b2..c90e245e 100755 --- a/lib/checksrc.pl +++ b/lib/checksrc.pl @@ -47,7 +47,7 @@ my %warnings = ( 'COMMANOSPACE' => 'comma without following space', 'BRACEELSE' => '} else on the same line', 'PARENBRACE' => '){ without sufficient space', - 'SPACESEMILCOLON' => 'space before semicolon', + 'SPACESEMICOLON' => 'space before semicolon', 'BANNEDFUNC' => 'a banned function was used', 'FOPENMODE' => 'fopen needs a macro for the mode string', 'BRACEPOS' => 'wrong position for an open brace', @@ -462,14 +462,14 @@ sub scanfile { # check for space before the semicolon last in a line if($l =~ /^(.*[^ ].*) ;$/) { - checkwarn("SPACESEMILCOLON", + checkwarn("SPACESEMICOLON", $line, length($1), $file, $ol, "space before last semicolon"); } # scan for use of banned functions if($l =~ /^(.*\W) (gets| - strtok| + strtok| v?sprintf| (str|_mbs|_tcs|_wcs)n?cat| LoadLibrary(Ex)?(A|W)?) @@ -499,9 +499,9 @@ sub scanfile { } # if the previous line starts with if/while/for AND ends with an open - # brace, check that this line is indented $indent more steps, if not - # a cpp line - if($prevl =~ /^( *)(if|while|for)\(.*\{\z/) { + # brace, or an else statement, check that this line is indented $indent + # more steps, if not a cpp line + if($prevl =~ /^( *)((if|while|for)\(.*\{|else)\z/) { my $first = length($1); # this line has some character besides spaces @@ -511,7 +511,7 @@ sub scanfile { if($expect != $second) { my $diff = $second - $first; checkwarn("INDENTATION", $line, length($1), $file, $ol, - "not indented $indent steps, uses $diff)"); + "not indented $indent steps (uses $diff)"); } } @@ -573,7 +573,7 @@ sub scanfile { if($nostr =~ /(.*)\;[a-z0-9]/i) { checkwarn("SEMINOSPACE", $line, length($1)+1, $file, $ol, - "no space after semilcolon"); + "no space after semicolon"); } # check for more than one consecutive space before open brace or |
