-
Notifications
You must be signed in to change notification settings - Fork 783
Windows arm64: use cc-rs' prefer_clang_cl_over_msvc
#2699
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
base: main
Are you sure you want to change the base?
Windows arm64: use cc-rs' prefer_clang_cl_over_msvc
#2699
Conversation
| "/Zc:forScope", | ||
| "/Zc:inline", | ||
| // Warnings. | ||
| "/Wall", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: [email protected]: In file included from C:\repos\ring\crypto/curve25519/curve25519.c:22:
warning: [email protected]: In file included from C:\repos\ring\crypto/curve25519\internal.h:18:
warning: [email protected]: 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: [email protected]: 60 | OPENSSL_STATIC_ASSERT(sizeof(int32_t) == sizeof(int), "int isn't 32 bits.");
warning: [email protected]: | ^
warning: [email protected]: C:\repos\ring\include\ring-core/type_check.h(29,42): note: expanded from macro 'OPENSSL_STATIC_ASSERT'
warning: [email protected]: 29 | #define OPENSSL_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
warning: [email protected]: | ^
warning: [email protected]: In file included from C:\repos\ring\crypto/curve25519/curve25519.c:22:
warning: [email protected]: In file included from C:\repos\ring\crypto/curve25519\internal.h:18:
warning: [email protected]: 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: [email protected]: 61 | OPENSSL_STATIC_ASSERT(sizeof(uint32_t) == sizeof(unsigned int), "unsigned int isn't 32 bits.");
warning: [email protected]: | ^
warning: [email protected]: C:\repos\ring\include\ring-core/type_check.h(29,42): note: expanded from macro 'OPENSSL_STATIC_ASSERT'
warning: [email protected]: 29 | #define OPENSSL_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
warning: [email protected]: | ^
warning: [email protected]: In file included from C:\repos\ring\crypto/curve25519/curve25519.c:22:
warning: [email protected]: In file included from C:\repos\ring\crypto/curve25519\internal.h:18:
warning: [email protected]: 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: [email protected]: 62 | OPENSSL_STATIC_ASSERT(sizeof(size_t) == sizeof(uintptr_t), "uintptr_t and size_t differ.");
warning: [email protected]: | ^
warning: [email protected]: C:\repos\ring\include\ring-core/type_check.h(29,42): note: expanded from macro 'OPENSSL_STATIC_ASSERT'
warning: [email protected]: 29 | #define OPENSSL_STATIC_ASSERT(cond, msg) _Static_assert(cond, msg)
warning: [email protected]: | ^
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.