diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-11-23 08:48:42 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-11-24 23:58:22 +0100 |
commit | 80e7cfeb87c18a7552933ff43a96bd1b709eec22 (patch) | |
tree | 3de4c80fd79bdf5e32c604d4e40040f689c9e444 /lib/checksrc.pl | |
parent | 8657c268e1938c4bd9200b7f5ab69ba156310403 (diff) | |
download | curl-80e7cfeb87c18a7552933ff43a96bd1b709eec22.tar.gz |
checksrc: detect wrongly placed open braces in func declarations
Diffstat (limited to 'lib/checksrc.pl')
-rwxr-xr-x | lib/checksrc.pl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl index 9a74a6f46..479a5dbde 100755 --- a/lib/checksrc.pl +++ b/lib/checksrc.pl @@ -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; } |