summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2020-01-14 12:24:32 -0800
committerDan Albert <danalbert@google.com>2020-01-14 12:24:32 -0800
commit71370c7f361bde782080986d64e22b1e54cb64ff (patch)
tree157f90143804691fd79a06ee23d3ae5c76fc05a6
parentff4d4ada4395e6300d141304ce739767061ff798 (diff)
downloadndk-71370c7f361bde782080986d64e22b1e54cb64ff.tar.gz
Reapply: Hack libc++ support header to work in the platform.
Upstream now supports using ToT libc++ with old NDKs, but as such it is now *only* compatible with the NDK. That will need to be fixed both for the platorm and for the NDK-in-platform use case since neither has android/ndk-version.h. Original change: https://android-review.googlesource.com/c/platform/prebuilts/ndk/+/827587 I still need up upstream this. Test: treehugger Bug: http://b/146465110 Bug: http://b/147470750
-rw-r--r--r21/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/r21/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h b/r21/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h
index 5b16071d9..0ca9c7720 100644
--- a/r21/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h
+++ b/r21/sources/cxx-stl/llvm-libc++/include/support/android/locale_bionic.h
@@ -25,9 +25,20 @@ extern "C" {
#if defined(__ANDROID__)
+#include <support/xlocale/__posix_l_fallback.h>
+
+// HACK: Not in upstream NDK or libc++.
+// Upstream now supports using ToT libc++ with old NDKs, but as such it is now
+// *only* compatible with the NDK. That will need to be fixed both for the
+// platorm and for the NDK-in-platform use case since neither has
+// android/ndk-version.h.
+
+// 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/api-level.h>
#include <android/ndk-version.h>
-#include <support/xlocale/__posix_l_fallback.h>
// In NDK versions later than 16, locale-aware functions are provided by
// legacy_stdlib_inlines.h
#if __NDK_MAJOR__ <= 16
@@ -61,6 +72,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__)