build: extend GNU C guards to clang where applicable, fix fallouts#17955
Closed
vszakats wants to merge 10 commits intocurl:masterfrom
Closed
build: extend GNU C guards to clang where applicable, fix fallouts#17955vszakats wants to merge 10 commits intocurl:masterfrom
vszakats wants to merge 10 commits intocurl:masterfrom
Conversation
First supported in llvm/clang 3.8. Use a version number that covers this also for Apple clang, which matched 3.8 at its version 7.3.
```
D:/a/curl/curl/tests/libtest/lib1912.c:44:57: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
44 | print_err(o->name, "CURLOT_LONG or CURLOT_VALUES");
| ^
D:/a/curl/curl/tests/libtest/lib1912.c:48:41: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
48 | print_err(o->name, "CURLOT_OFF_T");
| ^
D:/a/curl/curl/tests/libtest/lib1912.c:52:42: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
52 | print_err(o->name, "CURLOT_STRING");
| ^
D:/a/curl/curl/tests/libtest/lib1912.c:56:41: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
56 | print_err(o->name, "CURLOT_SLIST");
| ^
D:/a/curl/curl/tests/libtest/lib1912.c:60:41: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
60 | print_err(o->name, "CURLOT_CBPTR");
| ^
D:/a/curl/curl/tests/libtest/lib1912.c:65:44: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
65 | print_err(o->name, "CURLOT_FUNCTION");
| ^
D:/a/curl/curl/tests/libtest/lib1912.c:69:44: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
69 | print_err(o->name, "CURLOT_FUNCTION");
| ^
D:/a/curl/curl/tests/libtest/lib1912.c:73:42: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
73 | print_err(o->name, "CURLOT_OBJECT");
| ^
```
https://github.com/curl/curl/actions/runs/16351302841/job/46198524880?pr=17955#step:12:61
```
D:/a/curl/curl/tests/libtest/lib2032.c:145:29: error: sizeof on pointer operation will return size of 'CURL **' (aka 'void **') instead of 'CURL *[3]' (aka 'void *[3]') [-Werror,-Wsizeof-array-decay]
145 | ntlm_easy + num_handles);
| ~~~~~~~~~ ^
```
https://github.com/curl/curl/actions/runs/16351302841/job/46198524880?pr=17955#step:12:86
This reverts commit e23bf42. Turns out at v14 the mainline and apple clang version matched. https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
Without changing code. Previous iteration triggered the torture tests: https://github.com/curl/curl/actions/runs/16353901487/job/46207376778?pr=17955#step:41:4212
This reverts commit e7584ed.
vszakats
added a commit
that referenced
this pull request
Dec 12, 2025
- cmake: automatically disable typecheck when running clang-tidy, to avoid possible interference, and to improve performance. - INSTALL-CMAKE: document both this, and unity=off for clang-tidy. - GHA/linux: disable for some static analyzers CI jobs to avoid possible interference. - GHA/linux: disable in Fil-C job to improve build performance. Follow-up to 9e6f1c5 #19637 Follow-up to fd2ca23 #17955 Closes #19941
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some GNU C version guards implicitly include the clang compiler, because
clang reports itself as GCC 4.2.1.
This implicit inclusion doesn't happen if the guard requires a GCC
version above 4.2.1.
Fix two such guards to explicitly include clang where it does support
the guarded feature:
curl/curl.h: use
typecheck-gcc.hwith clang.llvm clang v14+ supports this. The corresponding Apple clang version
is also v14.
Ref: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions
Apple clang v14 tested OK in CI:
https://github.com/curl/curl/actions/runs/16353901480/job/46207437204
tool_urlglib: use
__builtin_mul_overflow()with clang v8+.llvm clang v3.8+ supports this, but to accommodate for Apple clang,
start with v8, the Apple version having the mainline v3.8 feature set.
Also fix compile warnings triggered by the above:
lib1912: fix duplicate
;:Ref: https://github.com/curl/curl/actions/runs/16351302841/job/46198524880?pr=17955#step:12:61
lib2032: silence typcheck warning with a cast:
Ref: https://github.com/curl/curl/actions/runs/16351302841/job/46198524880?pr=17955#step:12:86