-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[release/8.0-staging] Add flags when the clang's major version is > 20.0 #121150
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: release/8.0-staging
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -500,9 +500,21 @@ if (CLR_CMAKE_HOST_UNIX) | |
| #-fms-compatibility Enable full Microsoft Visual C++ compatibility | ||
| #-fms-extensions Accept some non-standard constructs supported by the Microsoft compiler | ||
|
|
||
| # Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around | ||
| # using twos-complement representation (this is normally undefined according to the C++ spec). | ||
| add_compile_options(-fwrapv) | ||
| if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 20.0) OR | ||
| (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20.0)) | ||
|
Comment on lines
+503
to
+504
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any concern here about Clang on macOS? If so, this should use MATCHES instead of STREQUAL. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we care about macOS for these changes. Is there doc on why to use MATCHES vs STREQUAL in this case? Is it "clang" on macOS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On macOS, it's AppleClang instead of Clang (as Apple has their forked build with slight differences). |
||
| # Make signed overflow well-defined. Implies the following flags in clang-20 and above. | ||
| # -fwrapv - Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around | ||
| # using twos-complement representation (this is normally undefined according to the C++ spec). | ||
| # -fwrapv-pointer - The same as -fwrapv but for pointers. | ||
| add_compile_options(-fno-strict-overflow) | ||
|
|
||
| # Suppress C++ strict aliasing rules. This matches our use of MSVC. | ||
| add_compile_options(-fno-strict-aliasing) | ||
| else() | ||
| # Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around | ||
| # using twos-complement representation (this is normally undefined according to the C++ spec). | ||
| add_compile_options(-fwrapv) | ||
| endif() | ||
|
|
||
AaronRobinsonMSFT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if(CLR_CMAKE_HOST_APPLE) | ||
| # Clang will by default emit objc_msgSend stubs in Xcode 14, which ld from earlier Xcodes doesn't understand. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.