Commit graph

37912 commits

Author SHA1 Message Date
Daniel Stenberg
3cf86508fd
VULN-DISCLOSURE-POLICY.md: use hackerone
- bug_report.yml: use hackerone

Closes #20683
2026-02-26 07:57:19 +01:00
Viktor Szakats
26eddf002f
GHA/linux: switch clang-tidy job to cmake for 2x speed, bump to v20, enable for tests
Checking lib and src under 3m15s versus 7m15s.

Downside: autotools clang-tidy support is no longer CI-tested.

The reason for the slowness is invoking a single clang-tidy command with
all source files, and clang-tidy checking them in a single thread,
sequentially. clang-tidy offers a `run-clang-tidy` Python script for
parallel  processing, which may help with this. However at this point
it's more practical to use cmake, which also supports verifying the
whole codebase, not only lib and src.

Also:
- bump clang-tidy to the latest available, v20 (from v18).
- enable running clang-tidy on tests. Takes under 2 minutes.

Also tried `_CURL_TESTS_CONCAT=ON`, it brings down the build tests step
from 1m47s to 54s, saving 1 minute. Skipped using it for now.

Closes #20725
2026-02-26 05:08:30 +01:00
Viktor Szakats
137e87ca72
clang-tidy: enable scanning headers
By setting `HeaderFilterRegex: '.*'`.

Closes #20720
2026-02-26 05:08:30 +01:00
Viktor Szakats
b1f853a384
unit3205: suppress two clang-tidy false positives
Silencing:
```
tests/unit/unit3205.c:565:32: error: the result from calling 'memcpy' is not null-terminated [bugprone-not-null-terminated-result]
  565 |         expect = (const char *)memcpy(alt, "DHE-", 4);
      |                                ^~~~~~            ~~~
      |                                strcpy
tests/unit/unit3205.c:569:32: error: the result from calling 'memcpy' is not null-terminated [bugprone-not-null-terminated-result]
  569 |         expect = (const char *)memcpy(alt + 4, "DHE-", 4) - 4;
      |                                ^~~~~~                ~~~
      |                                strcpy
```
Ref: https://github.com/curl/curl/actions/runs/22425366818/job/64932197466?pr=20725

Cherry-picked from #20725

Closes #20731
2026-02-26 04:19:18 +01:00
Viktor Szakats
d38bf7949d
tests/server: fix to clear the complete srvr_sockaddr_union_t variable
Reported by clang-tidy (seen on Linux with v18, v19, v20, not on macOS):
```
tests/server/dnsd.c:552:14: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
tests/server/dnsd.c:556:14: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
tests/server/rtspd.c:1183:14: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
tests/server/rtspd.c:1187:14: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
tests/server/sws.c:2235:14: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
tests/server/sws.c:2239:14: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
tests/server/tftpd.c:1188:14: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
tests/server/tftpd.c:1192:14: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
tests/server/util.c:860:21: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
tests/server/util.c:864:21: error: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
```
Ref: https://github.com/curl/curl/actions/runs/22424827575/job/64930560425?pr=20725

Cherry-picked from #20725

Closes #20730
2026-02-26 04:19:18 +01:00
Viktor Szakats
d110504e84
build: add missing GENERATEDCERTS files
Also alpha sort lists, while here.

Follow-up to 2cf19c245e #17493

Closes #20728
2026-02-26 03:09:16 +01:00
Viktor Szakats
2239879b74
cmake: minor fixes to test targets after prev
- run tests-clang-tidy when building testbins.
- drop redundant build-certs dependency for test targets.
  Already present via testdeps.

Follow-up to aae361242f #20708

Closes #20727
2026-02-26 02:44:39 +01:00
Viktor Szakats
b56e103d4d
build: do not include wolfSSL header in curl_setup.h
To fix building tests/server with cmake and both wolfSSL and OpenSSL
enabled (MultiSSL).

tests/server do not have libcurl dependency header paths setup because
it does not use libcurl. The code however includes `curl_setup.h`, which
tried including `wolfssl/version.h` before this patch to verify if the
wolfSSL coexist feature is available. Without a header path, it failed:
```
In file included from bld/tests/server/servers.c:3:
In file included from tests/server/first.h:40:
lib/curl_setup.h:737:12: fatal error: 'wolfssl/version.h' file not found
  737 | #  include <wolfssl/version.h>
      |            ^~~~~~~~~~~~~~~~~~~
1 error generated.
```
Ref: https://github.com/curl/curl/actions/runs/22410066319/job/64880787424#step:46:76

Fix by moving the include and version check to `vtls/wolfssl.c`.

Also: add an early version check to cmake.

Follow-up to 16f073ef49 #16973
Cherry-picked from #20720

Closes #20726
2026-02-26 01:36:16 +01:00
Viktor Szakats
aae361242f
cmake: replace internal option with a new testbins target
To allow building test binaries without test certs, replacing
`_CURL_SKIP_BUILD_CERTS` internal option with a build target that is
similar to `testdeps`, but without building the test certificates.

To make building test binaries a little bit faster, with less noisy
output, and without having to reconfigure the build.

Closes #20708
2026-02-25 22:57:02 +01:00
Viktor Szakats
3137f725cd
cmake: fix passing system header directories to clang-tidy for tests
Pass system directories with `-isystem` to avoid clang-tidy parsing
3rd-party and system headers with `HeaderFilterRegex: '.*' enabled.

Also:
- drop rule exception no longer necessary.
- sync normal vs. system header path order with compiler invocation.
- tidy up `set()` syntax.
- clear a temporary variable.

Bug: https://github.com/curl/curl/pull/20670#issuecomment-3940840176
Follow-up to e088e10454 #17705
Cherry-picked from: #20720

Closes #20724
2026-02-25 22:29:26 +01:00
Viktor Szakats
725c5609ae
clang-tidy: avoid/silence bugprone-not-null-terminated-result
Prefer `sizeof()` over `strlen()`, static const variables over macros.
Add a couple of `NOLINT`s to silence false positives.

Also sync similar code patterns between libtests.

Cherry-picked from #20720

Closes #20723
2026-02-25 22:11:05 +01:00
Viktor Szakats
39542f0993
cmake: add native clang-tidy support for tests, with concatenated sources
Tests are build in "unity"-style, by including sources into an umbrella
C files (similar to how CMake unity works). This does not play well with
clang-tidy, which seems to unconditionally ignore C sources included
like this. To fix it, curl's CMake implements a manual clang-tidy
support for tests, which  compiles sources one-by-one, while also making
sure sources compile cleanly standalone (e.g. all sources need to
include `first.h`). The manual clang-tidy implementation is fragile, and
performance, in particular when targeting Windows, is abysmal.

This patch introduces an alternate solution, enabled by the
`_CURL_TESTS_CONCAT=ON` option. In this mode, umbrella sources include
the actual sources instead of `#including` them. Allowing to use CMake's
built-in clang-tidy support to compile them, with clang-tidy actually
checking the sources. Making the manual clang-tidy support unnecessary.
In the Windows CI job it results in a 4x performance improvement (4m ->
1m), making it practical to run clang-tidy on tests on Windows, in CI.

The main downside is that clang-tidy doesn't understand the `#line`
directive. Meaning issues found show the wrong filename and line number
next to them. It's not impossible to locate errors this way, but also
not convenient.

Minor/potential downside is that the concatenated source needs to be
reassembled each time an original source is updated. This may result in
more copying on the disk when used in local development. The largest
source is 1.4MB, so probably not a show-stopper on most machines.

Another is the complexity of maintaining two methods in parallel, which
may be necessary till clang-tidy understands `#line`:
https://github.com/llvm/llvm-project/issues/62405

This solution may in theory also enable adding clang-tidy support for
tests in autotools, though I haven't tried.

Targeted for curl CI for now, and used in a GHA/windows job. 100%
experimental, not recommended outside these.

Closes #20667
2026-02-25 17:28:35 +01:00
Viktor Szakats
3b9d8412c0
clang-tidy: add more missing parentheses in macro values
Reported when running `HeaderFilterRegex: '.*'` in CI.

Also replace an underscored symbol with a regular one in macro
definition.

Cherry-picked from #20720

Closes #20721
2026-02-25 15:43:23 +01:00
Viktor Szakats
65f9426170
clang-tidy: enable more checks
Refs:
https://clang.llvm.org/extra/clang-tidy/checks/list.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/assert-side-effect.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/chained-comparison.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/dynamic-static-initializers.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/macro-repeated-side-effects.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/misplaced-operator-in-strlen-in-alloc.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/misplaced-pointer-arithmetic-in-alloc.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/not-null-terminated-result.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/posix-return.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/suspicious-enum-usage.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/suspicious-memset-usage.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/suspicious-missing-comma.html
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/suspicious-semicolon.html
https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-declaration.html
https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-function-ptr-dereference.html
https://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-parentheses.html

Closes #20622
2026-02-25 15:26:07 +01:00
Viktor Szakats
af78b199b2
tidy-up: miscellaneous
- vms/curlmsg_vms.h: delete unused/commented code.
- vtls/schannel_verify: sort includes.
- typecheck-gcc.h: fix indent and alignment.
- lib/config-win32.h: drop idle `#undef`.
- spacecheck: check for stray empty lines before after curly braces.
- make literals more readable: 1048576 -> 1024 * 1024
- scope variables.
- use ISO date in a comment.
- drop redundant parentheses.
- drop empty comments.
- unfold lines.
- duplicate/stray spaces in comments.
- fix indent, whitespace, minor typos.

Closes #20690
2026-02-25 14:44:56 +01:00
Viktor Szakats
ac46392f44
clang-tidy: enable bugprone-signed-char-misuse, fix fallouts
Examples:
```
lib/vtls/openssl.c:2585:18: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
 2585 |       msg_type = *(const char *)buf;
lib/vtls/openssl.c:2593:18: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
 2593 |       msg_type = *(const char *)buf;
tests/server/mqttd.c:514:10: warning: comparison between 'signed char' and 'unsigned char' [bugprone-signed-char-misuse]
  514 |       if(passwd_flag == (char)(conn_flags & passwd_flag)) {
tests/server/tftpd.c:362:13: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
  362 |         c = test->rptr[0];
tests/server/tftpd.c:454:9: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
  454 |     c = *p++;                     /* pick up a character */
src/tool_urlglob.c:272:46: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
  272 |     pat->c.ascii.letter = pat->c.ascii.min = min_c;
src/tool_urlglob.c:273:24: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
  273 |     pat->c.ascii.max = max_c;
tests/libtest/cli_h2_pausing.c:164:23: warning: suspicious usage of 'sizeof()' on an expression of pointer type [bugprone-sizeof-expression]
  164 |   memset(&resolve, 0, sizeof(resolve));
tests/libtest/cli_upload_pausing.c:158:23: warning: suspicious usage of 'sizeof()' on an expression of pointer type [bugprone-sizeof-expression]
  158 |   memset(&resolve, 0, sizeof(resolve));
tests/libtest/first.c:86:15: warning: 'signed char' to 'int' conversion; consider casting to 'unsigned char' first. [bugprone-signed-char-misuse]
   86 |     coptopt = arg[optpos];
```

Also:
- tests/server/mqttd: drop a redundant and a wrongly signed cast.

Ref: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/signed-char-misuse.html

Closes #20654
2026-02-25 14:44:56 +01:00
Daniel Stenberg
86772a76c7
RELEASE-NOTES: synced 2026-02-25 14:19:40 +01:00
Viktor Szakats
92eddc1fae
build: map Apple clang 26.4+ to llvm/clang 21.1
Ref: https://en.wikipedia.org/wiki/Xcode#Xcode_26.0_(since_version_number_change)_2

Closes #20717
2026-02-25 13:16:07 +01:00
Viktor Szakats
baf32a5cf4
build: enable -Wjump-misses-init for clang 21+
Refs:
543f112e14
43c05d9738

Follow-up to db4d617c1c #16252

Closes #20716
2026-02-25 12:28:58 +01:00
Hamza Bensliman
a4ce687af2
docs: add reproducible example for generating man page
Fixes #20699
Reported-by: sammydono on github
Closes #20703
2026-02-24 23:58:37 +01:00
Viktor Szakats
3e198f7586
build: fix building rare combinations
- http/2 + !headers
- gnutls + !verbose
- ssls-export + !verbose

Closes #20712
2026-02-24 20:49:06 +01:00
Viktor Szakats
102d4c8ba9
tidy-up: macro parentheses
Add missing and drop redundant parentheses.

Also: fix whitespace.

Ref: #20690

Closes #20710
2026-02-24 16:30:05 +01:00
Viktor Szakats
be2499f7dd
managen: silence Perl warnings
Closes #20707
2026-02-24 16:30:05 +01:00
Daniel Stenberg
c513b1d520
DEPRECATE.md: TLS SRP support gets removed in August 2026
Closes #20697
2026-02-24 16:02:34 +01:00
Daniel Stenberg
704a0a3fa9
config-riscos.h: drop all undefs
They are superfluous

Closes #20711
2026-02-24 15:54:45 +01:00
Daniel Stenberg
6ef6fb84ac
top-complexity: lower the max allowed complexity to 60
Closes #20706
2026-02-24 14:42:23 +01:00
Viktor Szakats
ba685ad5e5
openssl: fix potential NULL dereference when loading certs (Windows)
This could happen if the first cert to be loaded missed EKU (Enhanced
Key Usage) data, when using native CA on Windows.

Fix by skipping certs without Enhanced Key Usage data.

Detected by clang-tidy:
```
lib/vtls/openssl.c:2922:15: warning: Access to field 'cUsageIdentifier'
 results in a dereference of a null pointer (loaded from variable
 'enhkey_usage') [clang-analyzer-core.NullDereference]
 2922 |           if(!enhkey_usage->cUsageIdentifier) {
      |               ^
```

Refs:
https://learn.microsoft.com/windows/win32/secgloss/e-gly
https://learn.microsoft.com/windows/win32/api/wincrypt/nf-wincrypt-certgetenhancedkeyusage
https://gitlab.winehq.org/wine/wine/-/blob/wine-11.2/dlls/crypt32/cert.c?ref_type=tags#L3061-3164

Assisted-by: Stefan Eissing

Closes #20634
2026-02-24 12:34:19 +01:00
Daniel Stenberg
7981594df5
mbedtls: split mbed_connect_step1 into sub functions
Increase readability. Reduce complexity.

Closes #20689
2026-02-24 11:19:20 +01:00
Daniel Stenberg
956e1ae84f
setopt: refuse blobs with zero length
A blob must have a length or it will not be accepted. By enforcing the
check here, TLS backend code can rely on the fact that the length is
always non-zero from this point.

Reported-by: aisle-research-bot
URL: https://github.com/curl/curl/pull/20689#pullrequestreview-3846390367
Closes #20705
2026-02-24 11:18:12 +01:00
Diogo Correia
9d94b1a066
docs: use dot instead of comma at end of sentences
Some sentences incorrectly ended with a command instead of a dot.

Closes #20700
2026-02-24 08:15:39 +01:00
Viktor Szakats
67298a80b3
INSTALL-CMAKE.md: document the curl build target
Can be useful to together with `testdeps` to build all binaries.

Closes #20694
2026-02-24 01:11:17 +01:00
Viktor Szakats
453470fab1
spacecheck: double spaces in folded strings, fix fallouts
Closes #20695
2026-02-24 00:48:12 +01:00
Viktor Szakats
65262be0ab
clang-tidy: enable readability-math-missing-parentheses, adjust code
No functional changes.

Also:
- md4, md5: drop redundant parentheses from macro values.

Closes #20691
2026-02-23 18:57:40 +01:00
Daniel Stenberg
29bca12978
ftp: split ftp_state_use_port into sub functions
For readability and reduced complexity.

Fixed a bug when FTPPORT specifies an IPv6-address only, without brackets.

Closes #20685
2026-02-23 17:22:26 +01:00
Viktor Szakats
f1cee1f18a
clang-tidy: add arg names to prototypes where missing (cont.)
Detected by `readability-named-parameter` with `HeaderFilterRegex: '.*'`,
or `CURL_CLANG_TIDYFLAGS='--header-filter=.*'`. Seen on Windows.

Follow-up to e8415ad3c7 #20657
Follow-up to c878160e9c #20624

Closes #20693
2026-02-23 17:03:01 +01:00
Daniel Stenberg
e9786038d6
setopt: make setopt_copypostfields a separate function
Closes #20688
2026-02-23 16:45:37 +01:00
Viktor Szakats
3058ed3df8
lib: use lib source directory as base include path
Backtrack on previous change that aimed to solve the wrong `share.h`
being included. It turns out it did not fix this issue. At the same time
it introduced relative header filenames and the need to include the same
headers differently depending on the source files' location, reducing
readability and editability.

Replace this method by re-adding curl's lib source directory to the
header path and addressing headers by the their full, relative name to
that base directory. Aligning with this method already used in src and
tests.

With these advantages:
- makes includes easier to read, recognize, grep, sort, write, and copy
  between sources,
- syncs the way these headers are included across curl components,
- avoids the ambiguity between system `schannel.h`, `rustls.h` vs.
  local headers using the same names in `lib/vtls`,
- silences clang-tidy `readability-duplicate-include` checker, which
  detects the above issue,
  Ref: https://clang.llvm.org/extra/clang-tidy/checks/readability/duplicate-include.html
- possibly silences TIOBE coding standard warnings:
  `6.10.2.a: Don't use relative paths in #include statements.`
- long shot: it works well with concatenated test sources, for
  clang-tidy-friendly custom unity builds. Ref: #20667

Slight downside: it's not enforced.

If there happens to be a collision between a local `lib/*.h` header and
a system one, the solution is to rename (possibly with its `.c`
counterpart) into the `curl_` namespace. This is also the method used by
curl in the past.

Also:
- curlx/inet_pton: reduce scope of an include.
- toolx/tool_time: apply this to an include, and update VS project
  files accordingly. Also dropping unnecessary lib/curlx header path.
- clang-tidy: enable `readability-duplicate-include`.

Follow-up to 3887069c66 #19676
Follow-up to 625f2c1644 #16991 #16949

Closes #20623
2026-02-23 16:00:42 +01:00
Viktor Szakats
6ad50dc285
cmake: add C++ integration test
Also:
- include code to verify a C++-specific public header regression
  reported in 8.19.0-rc2.
- curl/curl.h: mention C++ global namespace in comment.
- GHA/dist: add CI job for C++. Runtime: 15 seconds.

Follow-up to ee9b000438 #20686
Ref: #20682

Closes #20687
2026-02-23 14:43:37 +01:00
Viktor Szakats
ee9b000438
curl/curl.h: revert to recursive macros to keep supporting C++ use-case
To avoid breaking 3rd-party code reusing these symbols as C++ methods,
e.g. in CMake sources:
```
cmake/src/v4.0.0-b30653ae0c.clean/Source/cmCurl.cxx:119:24: error: expected unqualified-id
  119 |     ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cafile.c_str());
      |                        ^
```

Also expand comment to highlight the case.

Reported-by: Kai Pastor
Bug: daa6b27b4d (r177869049)
Reported-by: Marcel Raad
Bug: https://curl.se/mail/lib-2026-02/0020.html
Fixes #20682
Follow-up to daa6b27b4d #20597

Closes #20686
2026-02-23 13:56:59 +01:00
Viktor Szakats
d6d8a1a15a
cmake: always build curlu and curltool test libs in unity mode
To speed up building/running tests by default (e.g. via `testdeps` or
`tests` targets.)

It reduces build commands to 21 (from 239) for a test build.

In CI, it affects build test step times as below:
- GHA/linux: aws-lc
  12s https://github.com/curl/curl/actions/runs/22279958343/job/64448913413 ->
  6s https://github.com/curl/curl/actions/runs/22282767915/job/64455970302
- GHA/linux: Fil-C
  39s https://github.com/curl/curl/actions/runs/22279958343/job/64448913430 ->
  37s https://github.com/curl/curl/actions/runs/22282767915/job/64455970352
- GHA/non-native: FreeBSD Intel
  22s https://github.com/curl/curl/actions/runs/22279958335/job/64448913514 ->
  15s https://github.com/curl/curl/actions/runs/22282767899/job/64455969960
- GHA/windows: dl-mingw 6.4.0
  23s https://github.com/curl/curl/actions/runs/22279958334/job/64448917225 ->
  9s https://github.com/curl/curl/actions/runs/22282767922/job/64455975006

Follow-up to fff9905bcf #20670

Closes #20677
2026-02-23 13:56:59 +01:00
Daniel Stenberg
3877db7bcf
openssl: fix compiler warning with OpenSSL master
vtls/openssl.c:469:15: error: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]

X509_get_X509_PUBKEY() now returns a const pointer - but only on OpenSSL
3, we must keep the non-const version for all forks.

Closes #20681
2026-02-23 10:23:57 +01:00
Viktor Szakats
e8415ad3c7
clang-tidy: add arg names to prototypes where missing
Detected by `readability-named-parameter` with `HeaderFilterRegex: '.*'`,
or `CURL_CLANG_TIDYFLAGS='--header-filter=.*'`.

Follow-up to c878160e9c #20624

Closes #20657
2026-02-23 01:00:47 +01:00
Daniel Stenberg
57a1cc5587
URL-SYNTAX.md: fix port number mistakes for IMAP and LDAP
Reported-by: Augment code
URL: https://github.com/curl/curl/pull/20673#pullrequestreview-3838139961
Closes #20679
2026-02-23 00:01:18 +01:00
Viktor Szakats
29758a6143
tests/server: silence clang-tidy warning
It looks like a case that can never happen in practice.

Seen on mingw-w64 with experimental concatenated (vs. #included) test
sources:
```
tests/server/util.c:662:16: error: Null pointer passed as 1st
 argument to string length function [clang-analyzer-unix.cstring.NullArg]
  662 |   size_t len = strlen(unix_socket);
      |                ^
```
Ref: https://github.com/curl/curl/actions/runs/22267482855/job/64416261156#step:10:273

Closes #20668
2026-02-22 22:32:13 +01:00
Viktor Szakats
c387c9fd0c
GHA/non-native: enable FreeBSD on arm again
Upstream package install is working again.

Follow-up to 41a6eeadf6 #20267

Closes #20678
2026-02-22 20:43:05 +01:00
Viktor Szakats
fff9905bcf
cmake: force-disable unity for clang-tidied build targets only
Instead of globally disabling unity for all targets when clang-tidy is
enabled.

After this patch `CMAKE_UNITY_BUILD=ON` is honored for:
- static libcurl when building both static and shared separately.
- libcurlu and libcurltool internal libraries when building the test
  target.

While keeping unity disabled for the libcurl build pass running
clang-tidy, and the curl tool, also running clang-tidy.

To make clang-tidy-enabled builds finish faster when unity mode is
enabled, yet performs the same clang-tidy checks as before this patch.

Effect on:
- GHA/macos: core build: same, buils tests 5-12 seconds faster,
  with steps going down from 259 to 25.

  52s: https://github.com/curl/curl/actions/runs/22279958340/job/64448913325 ->
  47s: https://github.com/curl/curl/actions/runs/22279873606/job/64448710743

- GHA/windows (not enabled): it'd save about 1 minute, bringing total
  time barely below 10m, still one of the slowest jobs overall.
  (#20667 is trying a way for 4x speed-up (with a drawback)).

  5m21s: https://github.com/curl/curl/actions/runs/22222907068/job/64284556852 ->
  4m26s: https://github.com/curl/curl/actions/runs/22281033369/job/64451601548

Closes #20670
2026-02-22 19:16:31 +01:00
Daniel Stenberg
0824bae8b0
config2setopts: split into smaller functions
Reduces complexity from 63 to 45

Closes #20676
2026-02-22 16:28:54 +01:00
Daniel Stenberg
84112673a0
socks_sspi: split Curl_SOCKS5_gssapi_negotiate into sub functions
Create and use socks5_sspi_setup(), socks5_sspi_loop() and
socks5_sspi_encryption(). Reduces complexity.

Closes #20581
2026-02-22 16:17:49 +01:00
Viktor Szakats
898ec9f2fb
cmake: limit clang-tidy to the shared libcurl if static is also built
On platforms that require building static and shared libcurl separately,
after this change clang-tidy is only run on one of them, to reduce build
time by avoiding the double-work. From a clang-tidy standpoint, static
and shared libs are identical.

Except `dllmain.c` on Windows, which is only present in shared. To keep
running it through clang-tidy, prefer the shared library for clang-tidy.

Closes #20675
2026-02-22 16:05:10 +01:00
Daniel Stenberg
8e3a2a64d1
tool: improve config error messaging
- make sure that errors for specific options in config files identify
  the file, line number and shows the error about the correct option

- improve some error message wording

- add warning for leading single quote of arguments in config files
  (verified in test 1712)

- adjust test error outputs accordingly

test1712 introduces mode=warn

Use the mode="warn" attribute if the output curl warning output, as it
then makes the check without newlines and the prefix to better handle
that the lines may wrap at different points depending on the lengths of
the lines and terminal width.

Fixes #20598
Closes #20666
2026-02-22 14:56:07 +01:00