]> granicus.if.org Git - curl/commitdiff
checksrc: detect open brace without space
authorDaniel Stenberg <daniel@haxx.se>
Mon, 4 Jul 2011 20:08:14 +0000 (22:08 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 4 Jul 2011 20:08:14 +0000 (22:08 +0200)
We use "if(condition) {" with a space between the close paren and the
open brace.

lib/checksrc.pl

index 5d369496a192989be34cbe0a1040d0751eead6c1..c3e01305ee798763168911e3ae307ffb44717cd1 100755 (executable)
@@ -148,6 +148,11 @@ sub scanfile {
         if($l =~ /^(.*)\} else/) {
             checkwarn($line, length($1), $file, $l, "else after closing brace on same line");
         }
+        # check for "){"
+        if($l =~ /^(.*)\)\{/) {
+            checkwarn($line, length($1)+1, $file, $l, "missing space after close paren");
+        }
+
         # check for open brace first on line but not first column
         # only alert if previous line ended with a close paren and wasn't a cpp
         # line