checksrc: do not apply BANNEDFUNC to struct member functions

Omit this warning, when `close()` is banned:
```
./lib/vtls/vtls.c:947:13: warning: use of close is banned (BANNEDFUNC)
   Curl_ssl->close(cf, data);
             ^
```
Ref: https://github.com/curl/curl/actions/runs/21012427938/job/60410334312?pr=20212#step:3:6

Ref: #20212

Closes #20323
This commit is contained in:
Viktor Szakats
2026-01-14 23:50:42 +01:00
parent 82e0d387a2
commit 62ba3604dc
2 changed files with 8 additions and 3 deletions

View File

@@ -970,9 +970,11 @@ sub scanfile {
my $bad = $2;
my $prefix = $1;
my $suff = $3;
checkwarn("BANNEDFUNC",
$line, length($prefix), $file, $ol,
"use of $bad is banned");
if($prefix !~ /(->|\.)$/) {
checkwarn("BANNEDFUNC",
$line, length($prefix), $file, $ol,
"use of $bad is banned");
}
my $search = quotemeta($prefix . $bad . $suff);
my $replace = $prefix . 'x' x (length($bad) + 1);
$l =~ s/$search/$replace/;

View File

@@ -88,6 +88,9 @@ void startfunc(int a, int b) {
// CPP comment ?
int d = impl->magicbad(1); /* member function always allowed */
int e = impl.magicbad(); /* member function always allowed */
/* comment does not end
</file>