[PATCH] D86596: Implement __isOSVersionAtLeast for Android

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 15:18:50 PDT 2023


smeenai added inline comments.
Herald added subscribers: Enna1, ctetreau, danielkiss.
Herald added a project: All.


================
Comment at: compiler-rt/lib/builtins/os_version_check.c:232-234
+  if (__system_property_get("ro.build.version.sdk", buf) == 0) {
+    // When the system property doesn't exist, defaults to future API level.
+    SdkVersion = __ANDROID_API_FUTURE__;
----------------
This is inconsistent with `android_get_device_api_level`, which returns -1 on failure instead (per https://developer.android.com/ndk/reference/group/apilevels#android_get_device_api_level). How come a different behavior was chosen here? I don't know if it's at all likely for reading this property to fail anyway, but if it does, it seems confusing for an availability check to go in the opposite direction as a manual check based on `android_get_device_api_level`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86596/new/

https://reviews.llvm.org/D86596



More information about the llvm-commits mailing list