Windows arm64: use cc-rs' prefer_clang_cl_over_msvc#2699
Windows arm64: use cc-rs' prefer_clang_cl_over_msvc#2699dennisameling wants to merge 2 commits intobriansmith:mainfrom
prefer_clang_cl_over_msvc#2699Conversation
| "/Zc:forScope", | ||
| "/Zc:inline", | ||
| // Warnings. | ||
| "/Wall", |
There was a problem hiding this comment.
This seems to be triggering the warnings (which are then treated as errors) that @MarijnS95 reported here. Even when adding /std:c11, they keep showing up:
warning: ring@0.17.14: In file included from C:\repos\ring\crypto/curve25519/curve25519.c:22:
warning: ring@0.17.14: In file included from C:\repos\ring\crypto/curve25519\internal.h:18:
warning: ring@0.17.14: C:\repos\ring\include\ring-core/base.h(60,1): error: '_Static_assert' is incompatible with C standards before C11 [-Werror,-Wpre-c11-compat]
warning: ring@0.17.14: 60 | OPENSSL_STATIC_ASSERT(sizeof(int32_t) == sizeof(int), "int isn't 32 bits.");
warning: ring@0.17.14: | ^
warning: ring@0.17.14: C:\repos\ring\include\ring-core/type_check.h(29,42): note: expanded from macro 'OPENSSL_STATIC_ASSERT'
warning: ring@0.17.14: 29 | #define OPENSSL_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
warning: ring@0.17.14: | ^
warning: ring@0.17.14: In file included from C:\repos\ring\crypto/curve25519/curve25519.c:22:
warning: ring@0.17.14: In file included from C:\repos\ring\crypto/curve25519\internal.h:18:
warning: ring@0.17.14: C:\repos\ring\include\ring-core/base.h(61,1): error: '_Static_assert' is incompatible with C standards before C11 [-Werror,-Wpre-c11-compat]
warning: ring@0.17.14: 61 | OPENSSL_STATIC_ASSERT(sizeof(uint32_t) == sizeof(unsigned int), "unsigned int isn't 32 bits.");
warning: ring@0.17.14: | ^
warning: ring@0.17.14: C:\repos\ring\include\ring-core/type_check.h(29,42): note: expanded from macro 'OPENSSL_STATIC_ASSERT'
warning: ring@0.17.14: 29 | #define OPENSSL_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
warning: ring@0.17.14: | ^
warning: ring@0.17.14: In file included from C:\repos\ring\crypto/curve25519/curve25519.c:22:
warning: ring@0.17.14: In file included from C:\repos\ring\crypto/curve25519\internal.h:18:
warning: ring@0.17.14: C:\repos\ring\include\ring-core/base.h(62,1): error: '_Static_assert' is incompatible with C standards before C11 [-Werror,-Wpre-c11-compat]
warning: ring@0.17.14: 62 | OPENSSL_STATIC_ASSERT(sizeof(size_t) == sizeof(uintptr_t), "uintptr_t and size_t differ.");
warning: ring@0.17.14: | ^
warning: ring@0.17.14: C:\repos\ring\include\ring-core/type_check.h(29,42): note: expanded from macro 'OPENSSL_STATIC_ASSERT'
warning: ring@0.17.14: 29 | #define OPENSSL_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
warning: ring@0.17.14: | ^
Removing the /Wall flag fixes the build. This looks like a bug in clang-cl.exe to me and I could reproduce the behavior in a minimal example. Reported that here: https://developercommunity.visualstudio.com/t/Calling-clang-clexe-with-Wall-reports/10961806
There was a problem hiding this comment.
This is not a bug in clang-cl - /Wall in CL parlance translates to -Weverything in Clang parlance. That includes these spurious warnings designed to help users migrating code forward to avoid pitfalls when their code base uses multiple C versions simultaneously.
This is a new attempt to address #2215, and might supersede #2216 - I'll leave that up to you.
cc-rsversion 1.2.35 introduced support forprefer_clang_cl_over_msvc, which automatically findsclang-clin the Visual Studio installation directory and uses it instead ofcl.exe. Sinceclang-clsupports MSVC-style flags, this should address the reported issue.Confirming this is working as expected on Windows arm64. In this CI run you can see that
clang-cl.exeis invoked as expected.