-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Add _pointerBitWidth platform condition #41534
Conversation
CC: @xwu |
@swift-ci test |
Fantastic to see this resurrected. As you deduced correctly, I never did have the time to return to this (most particularly, the proposal process), but it would be lovely to have and I'm glad to see you pick it up. |
lib/Basic/LangOptions.cpp
Outdated
@@ -356,6 +364,25 @@ std::pair<bool, bool> LangOptions::setTarget(llvm::Triple triple) { | |||
break; | |||
} | |||
|
|||
// Set the "_native_word_size" platform condition. |
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.
Nit:
// Set the "_native_word_size" platform condition. | |
// Set the "_pointerBitWidth" platform condition. |
But also could you document where these particular target arches come from so we can keep things in sync in the future?
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'm not entirely sure what you mean by "where these particular target arches come from". It uses the same targets as the rest of the code in this file.
87f9ad4
to
61f3518
Compare
61f3518
to
ddd5479
Compare
@swift-ci smoke test |
@@ -7,7 +7,7 @@ | |||
let i: Int = "Hello" | |||
#endif | |||
|
|||
#if arch(arm) && os(Android) && _runtime(_Native) && _endian(little) | |||
#if arch(arm) && os(Android) && _runtime(_Native) && _endian(little) && _pointerBitWidth(_32) |
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 pointless if it's not possible to use other pointer sizes on platforms like Android armv7.
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'm not sure I understand. In what cases would you want other pointer sizes on armv7?
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.
My point is that isn't arch(arm)
here redundant with _pointerBitWidth(_32)
, ie the former always implies the latter?
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.
Oh, but the whole point of this test is to check that all of these are properly set. If any of them wasn't, the test would fail.
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.
OK, so the goal is to just lump together all compile-time properties of this platform, even though some of them are redundant so nobody would ever use some combos of those checks together, got it.
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.
Not quite. It is to ensure that if we are compiling for armv7-unknown-linux-androideabi
, all of the expected conditions hold. We have these tests for all targets.
ddd5479
to
6881b41
Compare
@swift-ci test |
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.
Wooooo thanks @drexin for making this a reality! |
* Add _pointerBitWidth platform condition * Fixes after rebasing --------- Co-authored-by: Xiaodi Wu <[email protected]>
The original PR was #14413, but was seemingly abandoned. Proposal is forthcoming.
rdar://107070345