-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build: extend GNU C guards to clang where applicable, fix fallouts #17955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vszakats
wants to merge
10
commits into
curl:master
Choose a base branch
from
vszakats:clangcc-guards
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8
−6
Conversation
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
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.
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.h
with 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