Skip to content
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

build: fix clang-cl builds, add CI job #15449

Closed
wants to merge 30 commits into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Oct 29, 2024

  • appveyor: add build-only job for clang-cl.

  • cmake: -pedantic-errors enables -Werror,-Wlanguage-extension-token
    automatically, which makes __int64 detection fail.
    Explictly disable this compiler warning for clang-cl to make the
    feature detection work and to accept __int64 in the source code.

  • cmake: disable -Wlanguage-extension-token warning for clang-cl
    to fix these when encountering __int64:

    lib/formdata.c(797,29): error : extension used [-Werror,-Wlanguage-extension-token] 
    lib/warnless.c(117,33): error : extension used [-Werror,-Wlanguage-extension-token] 
    lib/warnless.c(60,28): message : expanded from macro 'CURL_MASK_SCOFFT' 
    lib/warnless.c(59,38): message : expanded from macro 'CURL_MASK_UCOFFT' 
    include\curl/system.h(352,40): message : expanded from macro 'CURL_TYPEOF_CURL_OFF_T' 
    
  • make __GNUC__ warning suppressions apply to __clang__ too.
    Necessary for clang-cl, which defines the latter, but not the former.
    (Regular clang defines both.)

  • examples: fix clang-cl compiler warning in http2-upload.c.

    docs\examples\http2-upload.c(56,5): error : no previous prototype for function 'my_gettimeofday' [-Werror,-Wmissing-prototypes]
    docs\examples\http2-upload.c(56,1): message : declare 'static' if the function is not intended to be used outside of this translation unit
    
  • unit2604: add missing #pragma GCC diagnostic pop.
    Follow-up to e53523f CI: move Azure jobs to GHA, fix fallouts, sshserver, runtests tweaks #14859

  • unit1652: limit compiler warning suppression to GCC.
    They do not affect clang builds.
    Follow-up to 71cf0d1 tests: speed up builds with single-binary test bundles #14772


@github-actions github-actions bot added Windows Windows-specific CI Continuous Integration labels Oct 29, 2024
@vszakats vszakats added the build label Oct 29, 2024
@vszakats vszakats marked this pull request as draft October 29, 2024 15:14
Fixes:
```
  In file included from C:\projects\curl\_bld\lib\CMakeFiles\libcurl_object.dir\Unity\unity_0_c.c:145:
C:/projects/curl/lib/formdata.c(797,29): error : extension used [-Werror,-Wlanguage-extension-token] [C:\projects\curl\_bld\lib\libcurl_object.vcxproj]
  In file included from C:\projects\curl\_bld\lib\CMakeFiles\libcurl_object.dir\Unity\unity_0_c.c:391:
C:/projects/curl/lib/warnless.c(117,33): error : extension used [-Werror,-Wlanguage-extension-token] [C:\projects\curl\_bld\lib\libcurl_object.vcxproj]
C:/projects/curl/lib/warnless.c(60,28): message : expanded from macro 'CURL_MASK_SCOFFT' [C:\projects\curl\_bld\lib\libcurl_object.vcxproj]
C:/projects/curl/lib/warnless.c(59,38): message : expanded from macro 'CURL_MASK_UCOFFT' [C:\projects\curl\_bld\lib\libcurl_object.vcxproj]
C:\projects\curl\include\curl/system.h(352,40): message : expanded from macro 'CURL_TYPEOF_CURL_OFF_T' [C:\projects\curl\_bld\lib\libcurl_object.vcxproj]
```
https://ci.appveyor.com/project/curlorg/curl/builds/50887118/job/3kjlub2t0k6kadka#L180

Triggered by the `__int64` type, when using clang-cl (17.0.3).

Follow-up to 84338c4 curl#12331
This reverts commit d7820c2.

It's on by default, so going with the solution of explicitly silencing
it in source.
@vszakats vszakats changed the title appveyor: clang-cl blind try 1 build: fix clang-cl builds, add CI job Oct 29, 2024
@vszakats vszakats added the cmake label Oct 29, 2024
```
curl\docs\examples\http2-upload.c(56,5): error : no previous prototype for function 'my_gettimeofday' [-Werror,-Wmissing-prototypes] [C:\projects\curl\_bld\docs\examples\curl-example-http2-upload.vcxproj]
curl\docs\examples\http2-upload.c(56,1): message : declare 'static' if the function is not intended to be used outside of this translation unit [C:\projects\curl\_bld\docs\examples\curl-example-http2-upload.vcxproj]
```
Ref: https://ci.appveyor.com/project/curlorg/curl/builds/50888614/job/6gl5ssxusx7wmo2d#L476
@vszakats vszakats marked this pull request as ready for review October 29, 2024 20:34
__clang__ normally implies __GNUC__. Except for clang-cl,
where it doesn't. Explicitly enable these for __clang__ to cover
this case.
@vszakats vszakats closed this in fb711b5 Oct 30, 2024
@vszakats vszakats deleted the appveyor-clang-cl branch October 30, 2024 22:16
vszakats added a commit to vszakats/curl that referenced this pull request Nov 5, 2024
It's enabled by -pedantic as a warning and by -pedantic-errors as an error.
Before this patch this was done only for `CURL_WERROR=ON` builds.

(Verifiable using llvm's `diagtool show-enabled -pedantic test.c`)

Follow-up to fb711b5 curl#15449
@vszakats vszakats mentioned this pull request Nov 5, 2024
1 task
vszakats added a commit to vszakats/curl that referenced this pull request Nov 5, 2024
This fixes clang-cl builds with `CURL_WERROR=OFF` (default).

This warning is enabled by `-pedantic` as a warning and by
`-pedantic-errors` as an error. Verifiable using llvm's
`diagtool show-enabled -pedantic test.c`.

Follow-up to fb711b5 curl#15449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant