diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2018-05-16 22:40:12 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2018-05-16 22:40:12 +0000 |
commit | acd1f4e73802c807369a37b60981237bc86e8fc2 (patch) | |
tree | dd3d409d827a5d456ca574a4311d8e6207f7198e /libcxx/include/support/android | |
parent | ddc84bf7d19591470470fc883285961157bf9fef (diff) | |
download | bcm5719-llvm-acd1f4e73802c807369a37b60981237bc86e8fc2.tar.gz bcm5719-llvm-acd1f4e73802c807369a37b60981237bc86e8fc2.zip |
Condition usage of locale stdlib functions on Android API version
Some *_l functions were not available in some versions of Bionic. This CL
checks that the NDK version supports the functions, and if not, falls back
on the corresponding functions that don't take a locale.
Patch by Tom Anderson!
Differential Revision: https://reviews.llvm.org/D46558
llvm-svn: 332543
Diffstat (limited to 'libcxx/include/support/android')
-rw-r--r-- | libcxx/include/support/android/locale_bionic.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libcxx/include/support/android/locale_bionic.h b/libcxx/include/support/android/locale_bionic.h index 796b8d8271d..d638757fd75 100644 --- a/libcxx/include/support/android/locale_bionic.h +++ b/libcxx/include/support/android/locale_bionic.h @@ -27,14 +27,14 @@ extern "C" { #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 @@ inline _LIBCPP_ALWAYS_INLINE long strtol_l(const char* __nptr, char** __endptr, #endif // __ANDROID_API__ < 26 +#endif // __NDK_MAJOR__ <= 16 #endif // defined(__ANDROID__) #endif // defined(__BIONIC__) |