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
9 changed files with 76 additions and 44 deletions

View File

@@ -24,7 +24,7 @@
*
***************************************************************************/
/* wraps curl_easy_setopt() with typechecking */
/* wraps curl_easy_setopt() with type checking */
/* To add a new kind of warning, add an
* if(curlcheck_sometype_option(_curl_opt))
@@ -159,7 +159,7 @@
curl_easy_setopt(handle, option, value); \
})
/* wraps curl_easy_getinfo() with typechecking */
/* wraps curl_easy_getinfo() with type checking */
#define curl_easy_getinfo(handle, info, arg) \
__extension__({ \
if(__builtin_constant_p(info)) { \