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:
parent
8657c268e1
commit
80e7cfeb87
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user