From 62ba3604dc58ab339f34d96935b10e8384403af1 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 14 Jan 2026 23:50:42 +0100 Subject: [PATCH] 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 --- scripts/checksrc.pl | 8 +++++--- tests/data/test1185 | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/checksrc.pl b/scripts/checksrc.pl index 21d4782c7d..d065b0bc06 100755 --- a/scripts/checksrc.pl +++ b/scripts/checksrc.pl @@ -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/; diff --git a/tests/data/test1185 b/tests/data/test1185 index 3f7cd9fb70..a24548c9a0 100644 --- a/tests/data/test1185 +++ b/tests/data/test1185 @@ -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