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

@ -151,7 +151,7 @@
/* disabled WebSocket */
#cmakedefine CURL_DISABLE_WEBSOCKETS 1
/* disables use of socketpair for curl_multi_poll */
/* disables use of socketpair for curl_multi_poll() */
#cmakedefine CURL_DISABLE_SOCKETPAIR 1
/* disables TELNET */
@ -160,6 +160,9 @@
/* disables TFTP */
#cmakedefine CURL_DISABLE_TFTP 1
/* disables curl_easy_setopt()/curl_easy_getinfo() type checking */
#cmakedefine CURL_DISABLE_TYPECHECK 1
/* disables verbose strings */
#cmakedefine CURL_DISABLE_VERBOSE_STRINGS 1