cmake: force-disable unity for clang-tidied build targets only#20670
cmake: force-disable unity for clang-tidied build targets only#20670vszakats wants to merge 5 commits intocurl:masterfrom
Conversation
|
Fun fact: clang-tidy may still check into system headers without the I find it unpredictable which included file / header is checked by clang-tidy. E.g. the manual page https://clang.llvm.org/extra/clang-tidy/index.html says Correction: The v23 (dev) docs mention these as defaults. The v21 (stable, as used in these tests) Hard to say if this is a documentation fix, or maybe edit: fix → #20724 |
Instead of blanked disabling it for all targets. In practice it means `CMAKE_UNITY_BUILD=ON` is honored for libcurlu and libcurltool internal libraries after this patch, making clang-tidy builds faster, by avoiding checking
2200e08 to
dfc7db6
Compare
This reverts commit 0312564.
To speed up building tests by default. Follow-up to fff9905 curl#20670
To speed up building/running tests by default (e.g. via `testdeps` or `tests` targets.) It reduces build commands to 21 (from 239) for a test build. In CI, it affects build test step times as below: - GHA/linux: aws-lc 12s https://github.com/curl/curl/actions/runs/22279958343/job/64448913413 -> 6s https://github.com/curl/curl/actions/runs/22282767915/job/64455970302 - GHA/linux: Fil-C 39s https://github.com/curl/curl/actions/runs/22279958343/job/64448913430 -> 37s https://github.com/curl/curl/actions/runs/22282767915/job/64455970352 - GHA/non-native: FreeBSD Intel 22s https://github.com/curl/curl/actions/runs/22279958335/job/64448913514 -> 15s https://github.com/curl/curl/actions/runs/22282767899/job/64455969960 - GHA/windows: dl-mingw 6.4.0 23s https://github.com/curl/curl/actions/runs/22279958334/job/64448917225 -> 9s https://github.com/curl/curl/actions/runs/22282767922/job/64455975006 Follow-up to fff9905 #20670 Closes #20677
It turned out to be my mistake. System headers were picked accidentally Testing and fixing in #20720, and it'll become a separate PR. → #20724 |
Pass system directories with `-isystem` to avoid clang-tidy parsing 3rd-party and system headers with `HeaderFilterRegex: '.*' enabled. Also: - drop rule exception no longer necessary. - sync normal vs. system header path order with compiler invocation. - tidy up `set()` syntax. - clear a temporary variable. Bug: #20670 (comment) Follow-up to e088e10 #17705 Cherry-picked from: #20720 Closes #20724
Instead of globally disabling unity for all targets when clang-tidy is
enabled.
After this patch
CMAKE_UNITY_BUILD=ONis honored for:target.
While keeping unity disabled for the libcurl build pass running
clang-tidy, and the curl tool, also running clang-tidy.
To make clang-tidy-enabled builds finish faster when unity mode is
enabled, yet performs the same clang-tidy checks as before this patch.
Effect on:
GHA/macos: core build: same, buils tests 5-12 seconds faster,
with steps going down from 259 to 25.
52s: https://github.com/curl/curl/actions/runs/22279958340/job/64448913325 ->
47s: https://github.com/curl/curl/actions/runs/22279873606/job/64448710743
GHA/windows (not enabled): it'd save about 1 minute, bringing total
time barely below 10m, still one of the slowest jobs overall.
(cmake: add native clang-tidy support for tests, with concatenated sources #20667 is trying a way for 4x speed-up (with a drawback)).
5m21s: https://github.com/curl/curl/actions/runs/22222907068/job/64284556852 ->
4m26s: https://github.com/curl/curl/actions/runs/22281033369/job/64451601548
Closes #20670
https://github.com/curl/curl/pull/20670/files?w=1
consider enabling unity for libcurlu and libcurltool permanently (as in 'initial idea' below). [OTHER PR] → cmake: always build curlu and curltool test libs in unity mode #20677
additional opportunity is to selectively disable unity for the shared libcurl only, when building both shared and static. This has no downside AFAICS.
initial idea: always enable unity for internal libs curlu and curltool:
alternative take: consider force-disabling unity only for targets checked with clang-tidy when clang-tidy is enabled. (More complex, more limited, possibly safer, more flexible?) → went with this one.