mirror of
https://github.com/curl/curl.git
synced 2026-05-05 14:17:33 +03:00
checksrc: detect wrongly placed open braces in func declarations
This commit is contained in:
parent
8657c268e1
commit
80e7cfeb87
1 changed files with 13 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue