build: add build-level CURL_DISABLE_TYPECHECK options

Usage:
- autotools: `--disable-typecheck` (or `--enable-typecheck` (default))
- cmake: `-DCURL_DISABLE_TYPECHECK=ON`.

To disable `curl_easy_setopt()`/`curl_easy_getinfo()` type checking with
supported (new) gcc and clang compilers. It is useful to improve build
performance for the `tests/libtest` target. In particular the CodeQL
analyzer may take above an hour to compile with type checking enabled,
and disabling it brings it down to seconds. On local machines it may
also cut build times in half when build testdeps, depending on platform
and compiler.

Other than these cases, we recommend leaving type checking enabled.

Ref: fdacf34aae #19632

Also:
- GHA/codeql: use it.
- test1165: check in `include/curl`.
- lib1912: delete stray todo comment.
- spelling and comment nits.

Closes #19637
This commit is contained in:
Viktor Szakats 2025-11-21 12:43:54 +01:00
parent eaa7651374
commit 9e6f1c5efb
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
9 changed files with 76 additions and 44 deletions

View file

@ -68,8 +68,8 @@ Disable the FTP (and FTPS) protocol
## `CURL_DISABLE_GETOPTIONS`
Disable the `curl_easy_options` API calls that lets users get information
about existing options to `curl_easy_setopt`.
Disable the `curl_easy_options()` API calls that lets users get information
about existing options to `curl_easy_setopt()`.
## `CURL_DISABLE_GOPHER`
@ -182,6 +182,12 @@ Disable the TELNET protocol
Disable the TFTP protocol
## `CURL_DISABLE_TYPECHECK`
Disable `curl_easy_setopt()`/`curl_easy_getinfo()` type checking.
Useful to improve build performance for the `tests/libtest` test tool.
## `CURL_DISABLE_VERBOSE_STRINGS`
Disable verbose strings and error messages.

View file

@ -317,10 +317,11 @@ target_link_libraries(my_target PRIVATE CURL::libcurl)
- `CURL_DISABLE_SHUFFLE_DNS`: Disable shuffle DNS feature. Default: `OFF`
- `CURL_DISABLE_SMB`: Disable SMB. Default: `OFF`
- `CURL_DISABLE_SMTP`: Disable SMTP. Default: `OFF`
- `CURL_DISABLE_SOCKETPAIR`: Disable use of socketpair for curl_multi_poll. Default: `OFF`
- `CURL_DISABLE_SOCKETPAIR`: Disable use of socketpair for curl_multi_poll(). Default: `OFF`
- `CURL_DISABLE_SRP`: Disable TLS-SRP support. Default: `OFF`
- `CURL_DISABLE_TELNET`: Disable Telnet. Default: `OFF`
- `CURL_DISABLE_TFTP`: Disable TFTP. Default: `OFF`
- `CURL_DISABLE_TYPECHECK`: Disable curl_easy_setopt()/curl_easy_getinfo() type checking. Default: `OFF`
- `CURL_DISABLE_VERBOSE_STRINGS`: Disable verbose strings. Default: `OFF`
- `CURL_DISABLE_WEBSOCKETS`: Disable WebSocket. Default: `OFF`
- `HTTP_ONLY`: Disable all protocols except HTTP (This overrides all `CURL_DISABLE_*` options). Default: `OFF`