Commit 80e7cfeb authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

checksrc: detect wrongly placed open braces in func declarations

parent 8657c268
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -485,6 +485,19 @@ sub scanfile {
                      $line, length($1)-1, $file, $ol,
                      "no space before asterisk");
        }

        # check for 'void func() {', but avoid false positives by requiring
        # both an open and closed parentheses before the open brace
        if($l =~ /^((\w).*){\z/) {
            my $k = $1;
            $k =~ s/const *//;
            $k =~ s/static *//;
            if($k =~ /\(.*\)/) {
                checkwarn("BRACEPOS",
                          $line, length($l)-1, $file, $ol,
                          "wrongly placed open brace");
            }
        }
        $line++;
        $prevl = $ol;
    }