Skip to content

Commit ec516ff

Browse files
authored
Fix __isOSVersionAtLeast for Android (llvm#80496)
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.
1 parent 44b717d commit ec516ff

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler-rt/lib/builtins/os_version_check.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ int32_t __isOSVersionAtLeast(int32_t Major, int32_t Minor, int32_t Subminor) {
316316
static pthread_once_t once = PTHREAD_ONCE_INIT;
317317
pthread_once(&once, readSystemProperties);
318318

319-
return SdkVersion >= Major ||
320-
(IsPreRelease && Major == __ANDROID_API_FUTURE__);
319+
// Allow all on pre-release. Note that we still rely on compile-time checks.
320+
return SdkVersion >= Major || IsPreRelease;
321321
}
322322

323323
#else

0 commit comments

Comments
 (0)