1
0
mirror of https://github.com/moparisthebest/curl synced 2025-02-28 09:21:50 -05:00

checksrc: detect wrongly placed open braces in func declarations

This commit is contained in:
Daniel Stenberg 2016-11-23 08:48:42 +01:00
parent 8657c268e1
commit 80e7cfeb87

View File

@ -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;
}