-
Notifications
You must be signed in to change notification settings - Fork 1k
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
cmake: Adjust diagnostic flags for clang-cl
#1647
base: master
Are you sure you want to change the base?
Conversation
I guess the patch is trivial enough not to bother, but I'm not entirely sure if I understand the purpose of this. Couldn't you build using clang on Windows directly? Or is the purpose of this PR to help users who want to use Visual Studio but with clang instead of MSVC? My thinking is that if you use Visual Studio for an application that depends on libsecp256k1, you don't bother how libsecp256k1 itself is built. |
clang-cl
clang-cl
My apologies for any confusion. The PR description has been reworked. |
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.
utACK 4c50d73
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.
utACK other than the nit.
try_append_c_flags(-Wall) # GCC >= 2.95 and probably many other compilers. | ||
endif() | ||
if(CMAKE_C_COMPILER_ID STREQUAL "MSVC") | ||
# Keep the following commands ordered lexicographically. |
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.
I'd prefer to set /W3
here and -Wall
with the other try_append_c_flags
for consistency, as I don't see why it needs to be special-cased.
Edit: Retracted, see below.
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.
According to the docs, the /Wall
option in clang-cl, which is equivalent to -Wall
, enables Clang's core -Weverything
option.
We use /W3
, which enables Clang's core -Wall
option.
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.
Wow. Confirmed: https://godbolt.org/z/WEr3qGeox
That's... hugely unexpected. It really doesn't give me much faith in the proper forwarding of other options :(
When building with
clang-cl
on Windows, the output is cluttered with warning messages because compiler diagnostic flags are not applied correctly:This PR resolves this issue.
Additional note for reviewers: The VS builtin clang can also be used assuming that the following VS components are installed:
The user can generate a build system on Windows as follows:
Required for downstream projects which aim to build with
clang-cl
(see bitcoin/bitcoin#31456).