Author: zijunzhao Date: 2022-05-10T23:56:58Z New Revision: d38e8c6e3aa5a5e4d86b689206b62a4ceb74f7a8
URL: https://github.com/llvm/llvm-project/commit/d38e8c6e3aa5a5e4d86b689206b62a4ceb74f7a8 DIFF: https://github.com/llvm/llvm-project/commit/d38e8c6e3aa5a5e4d86b689206b62a4ceb74f7a8.diff LOG: [libcxx] locale_bionic.h: skip ndk-version.h on Android platform The Android platform does not have ndk-version.h, but it will always have up-to-date libc headers, so it does not need any compatibility code intended for past versions of NDK_MAJOR. If ndk-version.h is missing, assume NDK_MAJOR is (conceptually) infinite. Bug: https://buganizer.corp.google.com/issues/222341313 Test: None Change-Id: I370f5b4348cc2aad906a37bdeb9204d2aa4b05ea Added: Modified: libcxx/include/__support/android/locale_bionic.h Removed: ################################################################################ diff --git a/libcxx/include/__support/android/locale_bionic.h b/libcxx/include/__support/android/locale_bionic.h index 8c6d4bd0dc322..535bad7856480 100644 --- a/libcxx/include/__support/android/locale_bionic.h +++ b/libcxx/include/__support/android/locale_bionic.h @@ -26,10 +26,15 @@ extern "C" { #if defined(__ANDROID__) #include <android/api-level.h> -#include <android/ndk-version.h> #if __ANDROID_API__ < 21 #include <__support/xlocale/__posix_l_fallback.h> #endif + +// If we do not have this header, we are in a platform build rather than an NDK +// build, which will always be at least as new as the ToT NDK, in which case we +// don't need any of the inlines below since libc provides them. +#if __has_include(<android/ndk-version.h>) +#include <android/ndk-version.h> // In NDK versions later than 16, locale-aware functions are provided by // legacy_stdlib_inlines.h #if __NDK_MAJOR__ <= 16 @@ -63,6 +68,7 @@ inline _LIBCPP_INLINE_VISIBILITY long strtol_l(const char* __nptr, char** __endp #endif // __ANDROID_API__ < 26 #endif // __NDK_MAJOR__ <= 16 +#endif // __has_include(<android/ndk-version.h>) #endif // defined(__ANDROID__) #endif // defined(__BIONIC__) _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits