]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
checksrc: do not apply `BANNEDFUNC` to struct member functions
authorViktor Szakats <commit@vsz.me>
Wed, 14 Jan 2026 22:50:42 +0000 (23:50 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 15 Jan 2026 01:06:06 +0000 (02:06 +0100)
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

scripts/checksrc.pl
tests/data/test1185

index 21d4782c7def68dcf6a31bf2693dd89a10c6753e..d065b0bc064b386ae51aac630c9f92ecd444f81c 100755 (executable)
@@ -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/;
index 3f7cd9fb70c21fbb5f59af0559b573cebac16eb8..a24548c9a08899698e3a5a6afd80a2d622f48008 100644 (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>