433 Commits

Author SHA1 Message Date
Viktor Szakats
0431cbe71a build: globally suppress DJGPP warnings in FD_SET()
Replacing the many local `#pragma` used before this patch,
reducing the number of `__DJGPP__` guards from 58 to 13.

Closes #20299
2026-01-13 23:17:10 +01:00
Viktor Szakats
f4b16563ab cmake: drop unused LONG_LONG reference from Windows prefills
It's no longer used in curl.

Follow-up to 0159100f4f #20233

Closes #20241
2026-01-10 17:39:11 +01:00
Daniel Stenberg
0159100f4f lib: use (u)int64_t instead of long long
Remove config-plan9.h because it does not support 64 bit, meaning it has
not been working for years.

Closes #20233
2026-01-10 12:40:54 +01:00
Viktor Szakats
91c24d3e10 cmake: silence useless compiler warnings triggered by the FASTBuild generator
Silencing all of these:
```
11>/tmp/_fbuild.tmp/0x0752c383/core_2/70816E19/krb5_sspi.c:1:5: error: this style of line directive is a GNU extension [-Werror,-Wgnu-line-marker]
    1 | # 1 "<built-in>"
      |     ^
/path/to/curl/lib/vauth/krb5_sspi.c:29:6: error: this style of line directive is a GNU extension [-Werror,-Wgnu-line-marker]
   29 | # 26 "/path/to/curl/lib/vauth/krb5_sspi.c"
      |      ^
[...]
```

FASTBuild is slightly faster than Ninja in basic (single-machine, build
from scratch) cases (and can be more faster in other build cases). It
doesn't support unity builds. Maybe it can bring slightly better
performance to non-unity cmake CI jobs, in jobs having an 'install
prereq' phase already, and installing the fastbuild package being faster
than this gain. It overall seems marginal if any in curl CI. At least
for now. But it doesn't hurt if it works, and may be useful for some.

Requires CMake 4.2+.

That said this workaround may have a better place within CMake.

Refs:
https://www.kitware.com/cmake-fastbuild-distributed-cached-and-fast/
https://cmake.org/cmake/help/latest/generator/FASTBuild.html
https://github.com/fastbuild/fastbuild
https://fastbuild.org/docs/home.html

Closes #20230
2026-01-09 17:05:16 +01:00
Viktor Szakats
9552d9c0c0 build: detect and include inttypes.h again (revert)
Since not using `PRI*` macros, it isn't needed.

Follow-up to 13c1a93414 #20215
Revert 4c9e4e99c1 #20208

Closes #20225
2026-01-09 14:59:30 +01:00
Viktor Szakats
4c9e4e99c1 build: detect and include inttypes.h again
For `PRI*` printf masks for fixed-size C99 types.

Also:
- add simple fallback for `PRIu32`, `PRIx32`, if `inttypes.h` is
  missing.

Cherry-picked from #20200
Ref: #20207
Follow-up to 4701a6d2ae #19695
Ref: 60359ad504 #12275
Closes #20208
2026-01-07 16:10:23 +01:00
Joshua Vandaële
27ffb81a58 cmake: set found status to OFF when not found (for compression deps)
This fixes curl using libraries if `CURL_{BROTLI|ZLIB|ZSTD}` is set to
`OFF` but the library was found in a parent project that includes curl.

Closes #20147
2026-01-02 01:29:47 +01:00
Viktor Szakats
1892286086 cmake: match filename suffixes with file content
To:
- simplify recognizing CMake sources.
- ensure syntax highlighters use the correct file type.
- sync .h template filename with its autotools counterpart.

Also:
- cmakelint.sh: simplify, alpha sort the filelist.
- perlcheck.sh: simplify.

Closes #20039
2025-12-20 11:34:27 +01:00
Viktor Szakats
7ded0e21cd cmake: delete unused file CMake/CMakeConfigurableFile.in
Follow-up to 8cb0101449

Closes #20038
2025-12-19 15:35:15 +01:00
Viktor Szakats
673e02a616 cmake/FindRustls: merge two ifs
Closes #20017
2025-12-18 15:16:33 +01:00
Viktor Szakats
7e2b15ee56 build: replace -pedantic with -Wpedantic when supported
To use the modern form when possible. The modern option also allows
using the `no-` prefix to disable.

Supported by: gcc 4.8+, clang 3.2+ (= appleclang 4.2+)

This also automatically changes `-clang:-pedantic` to `-Wpedantic` in
clang-cl builds.

Refs:
9877f689f2
https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Warning-Options.html

Closes #20010
2025-12-18 01:35:59 +01:00
Viktor Szakats
9cd827a226 cmake: replace deprecated OPENSSL_FOUND with OpenSSL_FOUND
Used in `CMake/FindLibrtmp.cmake`.

`OpenSSL_FOUND` available since CMake v3.3.
`OPENSSL_FOUND` deprecated since v4.2.

Ref: https://cmake.org/cmake/help/v4.2/module/FindOpenSSL.html

Closes #20012
2025-12-17 17:56:33 +01:00
Viktor Szakats
32454b954a localtime: detect thread-safe alternatives and use them
- add local API `toolx_localtime()` to wrap the banned function
  `localtime()`. Used from libcurl, libtests and test servers.
- auto-detect and use `localtime_r()` where available (e.g. Linux).
  Also to support multi-threading.
- use `localtime_s()` on Windows. It requires MSVC or mingw-w64 v4+.
  Also to support multi-threading.
  Use local workaround to also support mingw-w64 v3.
- add `src/toolx` to keep internal APIs used by the curl tool and tests,
  but not by libcurl. `toolx_localtime()` is the first API in it.
- replace `localtime()` calls with `toolx_localtime()`.
  Except in examples.
- note Windows XP's default `msvcrt.dll` doesn't offer secure CRT APIs.
  XP likely needs a newer version of this DLL, or may not run.
- note that `localtime()` mirrors `gmtime()`, with the difference that
  `gmtime()`'s internal wrapper lives in curlx.

Also:
- drop redundant `int` casts.

Refs:
https://learn.microsoft.com/cpp/c-runtime-library/reference/localtime-localtime32-localtime64
https://learn.microsoft.com/cpp/c-runtime-library/reference/localtime-s-localtime32-s-localtime64-s
https://pubs.opengroup.org/onlinepubs/9799919799/functions/localtime.html
https://linux.die.net/man/3/localtime_r

Ref: #19955 (for `gmtime_r()`)
Follow-up to 54d9f060b4
Closes #19957
2025-12-16 14:30:06 +01:00
Viktor Szakats
fe8393d7db tidy-up: miscellaneous
- drop stray duplicate empty lines in docs, scripts, test data, include,
  examples, tests.
- drop duplicate PP parenthesis.
- curl-functions.m4: move literals to the right side in if expressions,
  to match rest of the source code.
- FAQ.md: delete language designator from an URL.
- packages: apply clang-format (OS400, VMS).
- scripts/schemetable.c: apply clang-format.
- data320: delete duplicate empty line that doesn't change the outcome.
- spacecheck: extend to check for duplicate empty lines
  (with exceptions.)
- fix whitespace nits

Closes #19936
2025-12-12 04:18:48 +01:00
Viktor Szakats
bd19433b0e build: set -Wno-format-signedness
Explicitly disable these warnings to allow using `-Weverything`.

There are around 600 of them across the codebase.

Silencing them has some drawbacks:
- enums (`CURLcode` mostly) would have to be cast to int to avoid
  different signedness depending on C compiler.
  (llvm/gcc: unsigned, MSVC/clang-cl: signed by default)
- hex masks need casts to unsigned to avoid the warning.
- fixing remaining warnings is annoying without fixing the above.
- without fixing all warnings the option cannot be enabled, to keep
  the codebase warning free.

Ref: #18343 (silenced all warnings, but without the enum cast)
Follow-up to 92f215fea1 #18477
Closes #19907
2025-12-09 23:54:55 +01:00
Viktor Szakats
c421c3e325 cmake: verify minimum CMake version in curl-config.cmake
Show a message if the CMake version is lower than that when consuming
libcurl via the CMake config.

The minimum CMake version on consumption is for now the same as
the minimum required (v3.7) to build curl itself.

Ref: https://cmake.org/cmake/help/v3.7/variable/CMAKE_MINIMUM_REQUIRED_VERSION.html
Ref: #18704 (discussion)
Follow-up to 16f073ef49 #16973
Closes #19776
2025-12-01 14:46:44 +01:00
Viktor Szakats
dabfae84f0 cmake: namespace all local variables in curl-config.cmake
Also:
- apply it to the local copy of this code in `lib/CMakeLists.txt`.
- replace 'CURL' with `@PROJECT_NAME@` in a message.

Closes #19777
2025-12-01 11:43:20 +01:00
Viktor Szakats
bf58ca6e8f cmake: narrow scope of custom CMAKE_MODULE_PATH in curl-config.cmake
Set it only while using local Find modules, leave it as-is while using
system ones.

Follow-up to 16f073ef49 #16973
Cherry-picked from #19776
2025-12-01 01:28:24 +01:00
Viktor Szakats
7799d15eef cmake: fix ws2_32 reference in curl-config.cmake
Follow-up to 16f073ef49 #16973
Follow-up to 554dfa5568 #17927

Closes #19775
2025-12-01 00:57:12 +01:00
Viktor Szakats
f553bff6ee cmakelint: also lint CMake .in files, fix a long line
```
CMakeConfigurableFile.in
cmake_uninstall.cmake.in
curl-config.cmake.in
```

Follow-up to 16f073ef49 #16973
Closes #19773
2025-12-01 00:03:07 +01:00
Viktor Szakats
ed331cea80 cmake: save and restore CMAKE_MODULE_PATH in curl-config.cmake
Reported-by: Kai Pastor
Bug: https://github.com/curl/curl/pull/16973#discussion_r2572957270
Follow-up to 16f073ef49 #16973

Closes #19758
2025-11-29 15:10:42 +01:00
Viktor Szakats
16f073ef49 cmake: define dependencies as IMPORTED interface targets
Rework the way curl's custom Find modules advertise their properties.

Before this patch, Find modules returned detected dependency properties
(header dirs, libs, libdirs, C flags, etc.) via global variables. curl's
main `CMakeLists.txt` copied their values into global lists, which it
later applied to targets. This solution worked internally, but it was
unsuited for the public, distributed `CURLConfig.cmake` and publishing
curl's Find modules with it, due to polluting the namespace of consumer
projects. It's also impractical to apply the many individual variables
to every targets depending on libcurl.

To allow using Find modules in consumer projects, this patch makes them
define as imported interface targets, named `CURL::<dependency>`. Then
store dependency information as target properties. It avoids namespace
pollution and makes the dependency information apply automatically
to all targets using `CURL::libcurl_static`.

Find modules continue to return `*_FOUND` and `*_VERSION` variables.

For dependencies detected via `pkg-config`, CMake 3.16+ is recommended.
Older CMake versions have a varying degree of support for
propagating/handling library directories. This may cause issues in envs
where dependencies reside in non-system locations and detected via
`pkg-config` (e.g. macOS + Homebrew). Use `CURL_USE_PKGCONFIG=OFF`
to fix these issues. Or upgrade to newer CMake, or link libcurl
dynamically.

Also:
- re-enable `pkg-config` for old cmake `find_library()` integration
  tests.
- make `curlinfo` build after these changes.
- distribute local Find modules.
- export the raw list of lib dependencies via `CURL_LIBRARIES_PRIVATE`.
- `CURLconfig.cmake`: use curl's Find modules to detect dependencies in
  the consumer env.
- add custom property to target property debug function.
- the curl build process no longer modifies `CMAKE_C_FLAGS`.
  Follow-up to e86542038d #17047

Ref: #14930
Ref: https://github.com/libssh2/libssh2/pull/1535
Ref: https://github.com/libssh2/libssh2/pull/1571
Ref: https://github.com/libssh2/libssh2/pull/1581
Ref: https://github.com/libssh2/libssh2/pull/1623

Closes #16973
2025-11-29 01:41:40 +01:00
Viktor Szakats
d03712169b cmake: add support for libbacktrace, fix two build issues
Also:
- memdebug: fix symbol collision in unity builds.
- memdebug: fix compiler warning by making a variable static.

Follow-up to c77bed81a2 #19657

Closes #19666
2025-11-24 14:29:29 +01:00
Viktor Szakats
ad35ecba97 badwords: fix issues found in scripts and other files
Single pass, not enforced.

Also:
- pyspelling.words: drop `web page`

Closes #19572
2025-11-17 17:18:07 +01:00
Marcel Raad
e9a973c513 build: exclude clang prereleases from compiler warning options
Starting with clang 18, stable clang releases start with minor version 1.
Exclude pre-releases with minor version 0 from the compiler warning
options for that major version.

This fixes the build with Android NDK r29, which uses a prerelease
version of clang 21 that doesn't know the new options yet.

Closes #19566
2025-11-17 13:43:50 +01:00
Viktor Szakats
2e1a045d89 build: drop support for VS2008 (Windows)
Require Visual Studio 2010 or newer.

Ref: https://github.com/curl/curl/discussions/15972

Follow-up to dc28bb86c1 #17798
Follow-up to 63e513b106 #17380

Closes #17931
2025-11-15 15:56:19 +01:00
Viktor Szakats
554dfa5568 build: drop Windows CE / CeGCC support
Windows CE support was limited to successful builds with ming32ce
(a toolchain that hasn't seen an update since 2009, using an ancient gcc
version and "old mingw"-style SDK headers, that curl deprecated earlier).
Builds with MSVC were broken for a long time. mingw32ce builds were never
actually tested and runtime and unlikely to work due to missing stubs.
Windows CE toolchains also miss to comply with C89. Paired with lack of
demand and support for the platform, curl deprecated it earlier.

This patch removes support from the codebase to ease maintaining Windows
codepaths.

Follow-up to f98c0ba834 #17924
Follow-up to 8491e6574c #17379
Follow-up to 2a292c3984 #15975

Closes #17927
2025-11-15 15:35:23 +01:00
Viktor Szakats
71d1eec675 tidy-up: miscellaneous
- cmake/Find*: make double quotes consistent.
- drop redundant parenthesis.
- GHA/checksrc: sync a step name with others.
- whitespace.

Closes #19233
2025-10-25 00:19:00 +02:00
Viktor Szakats
38c19edd67 cmake: say 'absolute path' in option descriptions and docs
To not have to guess. Also to sync with autotools, which already uses
this wording.

Also:
- replace the stray term 'folder' with 'directory' for consistency.
- store help text in a temp variable to avoid overly long strings
  (mandatory in CMake <4.2.0 and can't be trivially split), also
  to avoid repeating this string 4 times.

Ref: https://cmake.org/cmake/help/v4.2/command/set.html

Closes #19169
2025-10-21 15:07:36 +02:00
Viktor Szakats
1966c86d71 cmake: add and use local FindGnuTLS module
Replacing a combination of custom logic in the main script and relying
on CMake's built-in Find module, with code and behavior used for
the rest of dependencies.

Also to:
- add version detection in the non-pkg-config path.
- make `GNUTLS_INCLUDE_DIR` and `GNUTLS_LIBRARY` take precedence over
  pkg-config. As with other dependencies.
- document the above two configuration options.
- prepare for #16973, which originally introduced this local Find
  module.

The local module is doing largely the same as CMake's built-in
FindGnuTLS. Differences:
- honors `CURL_USE_PKGCONFIG`.
- returns GnuTLS version for non-pkg-config detection.
- consistently returns `GNUTLS_VERSION`.
  (CMake's built-in uses s different name in <3.16.)
- CMake 3.16+ returns an imported target. curl supports 3.7,
  therefore we may only use it conditionally, which isn't worth it.

Cherry-picked from #16973

Closes #19163
2025-10-21 14:37:40 +02:00
Viktor Szakats
921ff01263 cmake: two minor tidy-ups
- flatten an if tree.
- fix a typo in comment.

Closes #19171
2025-10-21 01:08:04 +02:00
Viktor Szakats
a000444cb0 cmake: fix Linux pre-fill HAVE_POSIX_STRERROR_R (when _CURL_PREFILL=ON)
It depends on C library.

Follow-up to f30f1307c1 #19116
2025-10-18 14:30:43 +02:00
Viktor Szakats
f30f1307c1 cmake: fix Linux pre-fills for non-glibc (when _CURL_PREFILL=ON)
- do not pre-fill `HAVE_LINUX_TCP_H` on Linux.
  `linux/tcp.h` is a Linux kernel userspace header. It's likely
  installed when using glibc and likely missing by default when using
  something else, e.g. MUSL (e.g. on Alpine).

  Therefore always detect it for Linux targets, and only pre-fill it for
  non-Linux ones.

- do not pre-fill `HAVE_GLIBC_STRERROR_R` on Linux.
  To fix it for non-glibc envs, e.g. MUSL (e.g. on Alpine).

Note, the pre-fill option is a disabled by default, internal option and
strongly not recommended outside of curl development.

Closes #19116
2025-10-18 13:53:30 +02:00
Viktor Szakats
1a81a8e478 version: add GSS backend name and version
MIT Kerberos version detection is implemented for autotools and cmake.

Examples:
```
curl 8.17.0-DEV (x86_64-pc-linux-gnu) ... mbedTLS/3.6.4 libidn2/2.3.7 nghttp2/1.59.0 libgss/1.0.4 OpenLDAP/2.6.7
curl 8.17.0-DEV (x86_64-pc-linux-gnu) ... LibreSSL/4.1.1 libidn2/2.3.7 nghttp2/1.59.0 mit-krb5/1.20.1 OpenLDAP/2.6.7
curl 8.17.0-DEV (x86_64-pc-linux-gnu) ... LibreSSL/4.1.1 libidn2/2.3.7 nghttp2/1.59.0 mit-krb5 OpenLDAP/2.6.7
curl 8.17.0-DEV (x86_64-pc-linux-gnu) ... LibreSSL/4.1.1 nghttp2/1.59.0 mit-krb5/1.20.1 OpenLDAP/2.6.7
curl 8.17.0-DEV (aarch64e-apple-darwin24.6.0) ... GnuTLS/3.8.10 libidn2/2.3.8 libssh2/1.11.1 nghttp2/1.67.1 mit-krb5/1.22.1
```

Also:
- cmake/FindGSS: strip project name ("Kerberos 5 release") from
  the version string when detected via `krb5-config`.

Closes #19073
2025-10-16 16:19:05 +02:00
Viktor Szakats
f04e7a7efa cmake: pre-fill three more type sizes on Windows
Use `CMAKE_SIZEOF_VOID_P` to fill the size of three types that differ
on 32 and 64-bit Windows: `curl_socket_t`, `size_t`, and on mingw-w64:
`ssize_t`.

`time_t` remains the only type needing detection at configuration time,
with MSVC or mingw-w64.

Ref: https://cmake.org/cmake/help/v4.1/variable/CMAKE_SIZEOF_VOID_P.html

Closes #19013
2025-10-11 01:04:24 +02:00
Viktor Szakats
6e9246aeb3 cmake/FindGSS: simplify/de-dupe lib setup
- lib name is always `gss` with GNU GSS.
- move lib name assigments to the detection blocks.

Closes #19012
2025-10-11 01:04:23 +02:00
Viktor Szakats
aeacf9a3e8 cmake/FindGSS: dedupe pkg-config module strings
Closes #18994
2025-10-10 19:47:08 +02:00
Viktor Szakats
05aa61fb3d cmake/FindGSS: drop wrong header check for GNU GSS
GNU GSS offers `gss.h`; do not check for `gssapi.h`. `gssapi.h`
was originally published by Heimdal, and later MIT Kerberos also added it
for Heimdal compatibility.

Closes #18993
2025-10-10 19:47:08 +02:00
Viktor Szakats
8be9a26451 build: drop Heimdal support, update docs, replace with MIT Kerberos in CI
The kerberos5 library Heimdal is one of three GSS libraries curl support.
It has a memory leak triggered by the new test in #18917 and the project
seems mostly abandoned.

Drop support and steer users to the MIT krb5 or GNU GSS libraries.

Co-authored-by: Daniel Stenberg

Ref: #18928
Closes #18928
Closes #18932
2025-10-09 02:27:29 +02:00
Viktor Szakats
cd7b45a3bb cmake/FindGSS: whitespace/formatting
Sync format more with the rest of the Find modules.

Cherry-picked from #18932
Closes #18957
2025-10-09 01:52:04 +02:00
Viktor Szakats
7c021fd14a cmake: minor Heimdal flavour detection fix
Do not detect Heimdal if a single `H` character appears in the vendor
string, require the full name: `Heimdal`.

Cherry-picked from #18932
Closes #18951
2025-10-09 01:15:04 +02:00
Viktor Szakats
1f11224232 cmake/FindGSS: fix pkg-config fallback logic for CMake <3.16
The documented `<prefix>_<moduleName>_VERSION` variables are empty in
all tested versions since 3.7.2 to 4.1.2. Stop using it as a fallback
for <3.16 versions, and replace with the undocumented, but working,
`FindPkgConfig` internal variable `_pkg_check_modules_pkg_name`. It
contains the module name which was found.

In practice it caused that with CMake <3.16 + `pkg-config`, curl always
detected the Heimdal flavor of GSS.

Also: Delete a fallback version detection method, which was already
marked with a question mark in comments, and used the same, always
empty, CMake variables.

Ref: https://cmake.org/cmake/help/v4.1/module/FindPkgConfig.html
Bug: https://github.com/curl/curl/pull/18932#issuecomment-3381807070

Closes #18950
2025-10-08 19:59:12 +02:00
Viktor Szakats
7682bd80e7 cmake: drop exclamation in comment looking like a name
Ref: https://github.com/curl/curl/pull/3316#issuecomment-442343555
Follow-up to ea4ba6d9ef #18803
Follow-up to 558814e16d

Closes #18810
2025-10-02 14:58:06 +02:00
Daniel Stenberg
b011e3fcfb vssh: drop support for wolfSSH
The implementation was incomplete and lesser than the other backends. No
one ever reported a bug or requested enhancements for this, indicating
that this backend was never used.

Closes #18700
2025-09-24 22:59:33 +02:00
Viktor Szakats
f833d5d1fb cmake: use modern alternatives for get_filename_component()
- use `cmake_path()` to query filenames, with CMake 3.20 or upper.
  https://cmake.org/cmake/help/v4.1/command/cmake_path.html#query

- use `cmake_host_system_information()` to query the registry,
  with CMake 3.24 or upper.
  https://cmake.org/cmake/help/v4.1/command/cmake_host_system_information.html#query-windows-registry
  Replacing the undocumented method.

- also quote the value passed to `get_filename_component()` where
  missing. (Could not cause an actual issue as used in the code.)

Closes #18688
2025-09-22 20:01:08 +02:00
Viktor Szakats
92f215fea1 build: address some -Weverything warnings, update picky warnings
`-Weverything` is not enabled by curl, and not recommended by LLVM,
because it may enable experimental options, and will result in new
fallouts after toolchain upgrades. This patch aims to fix/silence as much
as possible as found with llvm/clang 21.1.0. It also permanently enables
warnings that were fixed in source and deemed manageable in the future.
`-Wformat` warnings are addressed separately via #18343.

Fix/silence warnings in the source:
- typecheck-gcc.h: fix `-Wreserved-identifier`.
- lib: silence `-Wcast-function-type-strict`.
  For llvm 16+ or Apple clang 16+.
- asyn-ares: limit `HAPPY_EYEBALLS_DNS_TIMEOUT` to old c-ares versions.
- curl_trc: fix `-Wc++-hidden-decl`.
- doh: fix `-Wc++-keyword`.
- ftp: fix `-Wreserved-identifier`.
- ldap: fix `-Wreserved-identifier`.
- mqtt: comment unused macro to avoid warning.
- multi_ev: drop unused macros to avoid warnings.
- setopt: fix useless `break;` after `return;`.
- gtls, mbedtls, rustls: silence `-Wconditional-uninitialized`.
- socks_sspi, schannel, x509asn1: fix `-Wimplicit-int-enum-cast`.
- x509asn1: fix `-Wc++-keyword`.
- openssl: scope `OSSL_UI_METHOD_CAST` to avoid unused macro warning.
- libssh2, wolfssl: drop unused macros.
- curl_ngtcp2, curl_quiche, httpsrr, urlapi: drop/limit unused macros.
- tool_getparam: fix useless `break;` after `return;` or `break;`.
  Not normally enabled because it doesn't work with unity.
  https://github.com/llvm/llvm-project/issues/71046
- tool_operate: fix `-Wc++-keyword`.
- curlinfo: fix a `-Wunsafe-buffer-usage`.
- tests: silence `-Wformat-non-iso`.
- lib557: fix `-Wreserved-identifier`.
- lib1565: silence `-Wconditional-uninitialized`.

Enable the above clang warnings permanently in picky mode:
- `-Wc++-hidden-decl`
- `-Wc++-keyword` (except for Windows, where it collides with `wchar_t`)
- `-Wcast-function-type-strict`
- `-Wcast-function-type`
- `-Wconditional-uninitialized`
- `-Wformat-non-iso` (except for clang-cl)
- `-Wreserved-identifier`
- `-Wtentative-definition-compat`

Silence problematic `-Weverything` warnings globally (in picky mode):
- `-Wused-but-marked-unused` (88000+ hits) and
  `-Wdisabled-macro-expansion` (2600+ hits).
  Triggered by `typecheck-gcc.h` when building with clang 14+.
  Maybe there exists a way to fix within that header?
  Ref: https://discourse.llvm.org/t/removing-wused-but-marked-unused/55310
- `-Wunsafe-buffer-usage`. clang 16+. 7000+ hits.
  May be useful in theory, but such high volume of hits makes it
  impractical to review and possibly address. Meant for C++.
  Ref: https://clang.llvm.org/docs/SafeBuffers.html
  Ref: https://stackoverflow.com/questions/77017567/how-to-fix-code-to-avoid-warning-wunsafe-buffer-usage
  Ref: https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734
  Ref: https://github.com/llvm/llvm-project/pull/111624
- `-Wimplicit-void-ptr-cast`. clang 21+. 1700+ hits.
  C++ warning, deemed pure noise.
  Ref: https://github.com/curl/curl/issues/18470#issuecomment-3253506266
- `-Wswitch-default` (180+ hits), `-Wswitch-enum` (190+ hits),
  `-Wcovered-switch-default` (20+ hits).
  Next to impossible to fix cleanly, esp. when the covered `case`
  branches depend on compile-time options.
- `-Wdocumentation-unknown-command` (8+ hits).
  Triggered in a few sources. Seems arbitrary and bogus.
- `-Wpadded` (550+ hits).
- `-Wc++-keyword` on Windows, where it collides with `wchar_t`.
  (100+ hits)
  Ref: https://github.com/llvm/llvm-project/issues/155988
- `-Wreserved-macro-identifier`. clang 13+. 5+ hits.
  Sometimes it's necessary to set external macros that use
  the reserved namespace. E.g. `_CRT_NONSTDC_NO_DEPRECATE`,
  `__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__`, `__NO_NET_API`,
  possibly `_REENTRANT`, and more.
  It's not worth trying to silence them individually.
- `-Wnonportable-system-include-path` with `clang-cl`.
  It'd be broken by doing what the warning suggests.
- `-Wformat-non-iso` for clang-cl.

CMake `PICKY_COMPILER=ON` (the default) or `./configure`
`--enable-warnings` (not the default) is required to enable these
silencing rules.

Also:
- autotools, cmake: fix Apple clang and mainline llvm version translations.
  Ref: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
- autotools, cmake: enable `-Warray-compare` for clang 20+.
  Follow-up to 4b7accda5a #17196
- cmake: fix to enable `-Wmissing-variable-declarations` at an earlier
  clang version.
- cmake: update internal logic to handle warning options with `+` in
  them.
- cmake: fix internal logic to match the whole option when looking
  into `CMAKE_C_FLAGS` for custom-disabled warnings.

Follow-up to b85cb8cb4e #18485

Closes #18477
2025-09-20 10:16:15 +02:00
Viktor Szakats
49145249be tidy-up: drop stray "unused" comments
Closes #18453
2025-09-03 16:31:16 +02:00
Viktor Szakats
31e6798544 build: support LibreSSL native crypto lib with ngtcp2 1.15.0+
In ngtcp2 1.15.0 the LibreSSL crypto interface library got its own name:
`libngtcp2_crypto_libressl`. In previous versions it used
`libngtcp2_crypto_quictls`, shared with quictls itself (but not
compatible with).

Adapt autotools and cmake scripts to look for the new name first, and
fall back to the old one if not found.

Fallback to quictls tested OK in CI with both autotools and cmake:
https://github.com/curl/curl/actions/runs/17174994908?pr=18377

Ref: https://github.com/ngtcp2/ngtcp2/releases/tag/v1.15.0
Ref: https://github.com/ngtcp2/ngtcp2/pull/1716

Closes #18377
2025-08-23 15:45:36 +02:00
Viktor Szakats
01a2308236 mbedtls: bump minimum version required to 3.2.0
3.2.0 was released on July 11, 2022.

Ref: #18161
Closes #18254
2025-08-13 09:09:45 +02:00
Viktor Szakats
ffafec8ffa cmake: enable -Wall for MSVC 1944
MSVC=1944 is now tested in CI. It did not trigger new `-Wall` compiler
warnings, thus safe to enable `-Wall` for.

Closes #18165
2025-08-04 19:08:27 +02:00