-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
Fix __isOSVersionAtLeast for Android #80496
Fix __isOSVersionAtLeast for Android #80496
Conversation
Allow pre-release APIs on pre-release devices. The current implementation requires __ANDROID_API_FUTURE__ to use new APIs on pre-release system. This makes it hard to maintain the codebase because it should be switched a concrete version (e.g. __ANDROID_API_X__ on release of X). Instead, we can just allow pre-release APIs on pre-release system without mandating the major version of __ANDROID_API_FUTURE__. Note that this doesn't make API guards just no-op in pre-release builds. We can still rely on its compile-time checks and it still works as expected with release builds. Even with pre-release builds, it's the same as before because we would pass __ANDROID_API_FUTURE__ to make the calls anyway.
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
This will incorrectly allow APIs from version N when the build target is a preview of N-1, right? |
Well, I don't think it's regression. Without the change, we'll have to guard both symbols with Afaik, when there's two in-development versions, preview build doesn't need to distinguish two versions. For example, if N is a final SDK version and N+1 and N+2 are in-dev versions, a preview build should allow both N+1 and N+2 because both versions are in-development. |
But a preview of N+1 won't have the N+2 APIs? |
I don't think it's a problem or regression because it's still a preview. Besides, an API for N+2 guarded with |
Hi @DanAlbert, a friendly ping. |
Right now you use Is my understanding wrong, or are you saying that's not a regression? |
|
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.
Discussed over IM. Not a regression because the problem I'm worried about __builtin_available
returning true when it should not) already exists with an N+1 preview when using __builtin_available(android 10000)
. That's probably going to be something we have to deal with eventually, but I don't think we can deal with that here until the OS gives us clearer signals.
Thanks Dan for approval! Elliott (@enh-google), do you have any concern? |
"if danalbert's happy, i'm happy" --- he thinks about this stuff a lot more deeply than i do :-) |
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.
(danalbert seems convinced, so i have nothing to add...)
Hi all |
@jooyunghan Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested Please check whether problems have been caused by your change specifically, as How to do this, and the rest of the post-merge process, is covered in detail here. If your change does cause a problem, it may be reverted, or you can revert it yourself. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! |
Allow pre-release APIs on pre-release devices.
The current implementation requires ANDROID_API_FUTURE to use new APIs on pre-release system. This makes it hard to maintain the codebase because it should be switched a concrete version (e.g. ANDROID_API_X on release of X).
Instead, we can just allow pre-release APIs on pre-release system without mandating the major version of ANDROID_API_FUTURE.
Note that this doesn't make API guards just no-op in pre-release builds. We can still rely on its compile-time checks and it still works as expected with release builds. Even with pre-release builds, it's the same as before because we would pass ANDROID_API_FUTURE to make the calls anyway.