GHA/codeql: add tweak to successfully build libtests for CodeQL#19632
GHA/codeql: add tweak to successfully build libtests for CodeQL#19632vszakats wants to merge 5 commits intocurl:masterfrom
Conversation
|
Went up to 896/930 after merging to master. List of C files not tested by CodeQL: These are either impossible to build, and/or safe to ignore. |
|
Disabling typecheck also makes building libtests much faster on the local machine. It's been a while I was wondering why it's noticeably slow compared to everything else. Probably since fd2ca23 #17955, because I'm mostly compiling with clang. Type checking is of course nice, if not essential, but it'd need to be enabled in just a couple of CI jobs to catch mistakes, and may make the rest faster too. (Also important because I almost put myself on a track to start parallelizing libtests builds, and that'd be a great pain.) Disable it with:
edit: also reminds me of a so far parked experiment to introduce a type-safe setopt API. Just one for long options would be nice. |
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: fdacf34 #19632 Also: - GHA/codeql: use it. - test1165: check in `include/curl`. - lib1912: delete stray todo comment. - spelling and comment nits. Closes #19637
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: fdacf34 curl#19632 Also: - GHA/codeql: use it. - test1165: check in `include/curl`. - lib1912: delete stray todo comment. - spelling and comment nits. Closes curl#19637
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: fdacf34 curl#19632 Also: - GHA/codeql: use it. - test1165: check in `include/curl`. - lib1912: delete stray todo comment. - spelling and comment nits. Closes curl#19637
Turns out the cause of CodeQL hangs (or probably just extreme long
compile) is the header
curl/typecheck-gcc.h. By accident I noticedthat the preprocessed output of libtests.c is 75 MB (megabytes). This
is much higher than the amounf of source code hinted, also compared to
e.g. units.c or other build targets. The reason for the extreme size
is each easy option call pulling in the large checker logic defined
in this header.
By compiling with
-DCURL_DISABLE_TYPECHECK, preprocessed output dropsto 2.2 MB (34x), and the libtests target builds without issues.
Also build all tests and examples with the Linux HTTP/3 config, covering
3 more files.
With these, CodeQL C coverage is 893 out of 930 (96%) (was: 645 69%)
Follow-up to 71fc11e #18695
Follow-up to a333fd4 #18557
Follow-up to b4922b1 #18564
Closes vszakats#11