build: disable typecheck via the command-line instead of curl_config.h

To make it apply to examples. This in turn makes analyzers run quicker
and with fewer false positives.

It's a special disable option, having its effect via `curl/curl.h`.

Bug: https://github.com/curl/curl/pull/20649#issuecomment-3934885021
Follow-up to 9e6f1c5efb #19637

Closes #20650
This commit is contained in:
Viktor Szakats 2026-02-20 15:03:17 +01:00
parent 1eb79cf54b
commit 4b4637a445
No known key found for this signature in database
4 changed files with 18 additions and 8 deletions

View file

@ -47,7 +47,9 @@ sub scanconf {
while(<S>) {
if(/(CURL_DISABLE_[A-Z0-9_]+)/g) {
my ($sym)=($1);
$disable{$sym} = 1;
if(not $sym =~ /^(CURL_DISABLE_TYPECHECK)$/) {
$disable{$sym} = 1;
}
}
}
close S;
@ -70,7 +72,7 @@ sub scanconf_cmake {
while(<S>) {
if(/(CURL_DISABLE_[A-Z0-9_]+)/g) {
my ($sym)=($1);
if(not $sym =~ /^(CURL_DISABLE_INSTALL|CURL_DISABLE_SRP)$/) {
if(not $sym =~ /^(CURL_DISABLE_INSTALL|CURL_DISABLE_SRP|CURL_DISABLE_TYPECHECK)$/) {
$hashr->{$sym} = 1;
}
}
@ -86,7 +88,10 @@ sub scan_cmake_config_h {
scanconf_cmake(\%disable_cmake_config_h, "$root/lib/curl_config-cmake.h.in");
}
my %whitelisted = ('CURL_DISABLE_DEPRECATION' => 1);
my %whitelisted = (
'CURL_DISABLE_DEPRECATION' => 1,
'CURL_DISABLE_TYPECHECK' => 1,
);
sub scan_file {
my ($source)=@_;
@ -128,7 +133,9 @@ sub scan_docs {
$line++;
if(/^## `(CURL_DISABLE_[A-Z0-9_]+)`/g) {
my ($sym)=($1);
$docs{$sym} = $line;
if(not $sym =~ /^(CURL_DISABLE_TYPECHECK)$/) {
$docs{$sym} = $line;
}
}
}
close F;