[PATCH] D46558: Condition usage of locale stdlib functions on Android API version

Tom Anderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 15 15:12:30 PDT 2018


thomasanderson updated this revision to Diff 146928.
thomasanderson added a comment.

Fix the case where 21 <= __ANDROID_API__ < 26 and __NDK_VERSION__ <= 16


https://reviews.llvm.org/D46558

Files:
  include/support/android/locale_bionic.h


Index: include/support/android/locale_bionic.h
===================================================================
--- include/support/android/locale_bionic.h
+++ include/support/android/locale_bionic.h
@@ -27,14 +27,14 @@
 #if defined(__ANDROID__)
 
 #include <android/api-level.h>
-
-// Android gained most locale aware functions in L (API level 21)
-#if __ANDROID_API__ < 21
+#include <android/ndk-version.h>
 #include <support/xlocale/__posix_l_fallback.h>
-#endif
-
-// The strto* family was added in O (API Level 26)
-#if __ANDROID_API__ < 26
+// In NDK versions later than 16, locale-aware functions are provided by
+// legacy_stdlib_inlines.h
+#if __NDK_MAJOR__ <= 16
+#if __ANDROID_API__ < 21
+#include <support/xlocale/__strtonum_fallback.h>
+#elif __ANDROID_API__ < 26
 
 #if defined(__cplusplus)
 extern "C" {
@@ -61,6 +61,7 @@
 
 #endif // __ANDROID_API__ < 26
 
+#endif // __NDK_MAJOR__ <= 16
 #endif // defined(__ANDROID__)
 
 #endif // defined(__BIONIC__)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46558.146928.patch
Type: text/x-patch
Size: 972 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180515/73c10e55/attachment.bin>


More information about the llvm-commits mailing list