[libc++] Fix aligned_alloc usage for Android
authorShoaib Meenai <smeenai@fb.com>
Sat, 7 Jan 2023 07:35:15 +0000 (23:35 -0800)
committerShoaib Meenai <smeenai@fb.com>
Tue, 10 Jan 2023 14:25:50 +0000 (06:25 -0800)
Android only provides this function on API 28+; fix libc++ builds when
targeting older API levels.

Reviewed By: arichardson, #libc, philnik

Differential Revision: https://reviews.llvm.org/D141184

libcxx/include/__config

index 1a519b9..505ccf9 100644 (file)
@@ -741,6 +741,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
          __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500)
 #      define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC
 #    endif
+#  elif defined(__ANDROID__) && __ANDROID_API__ < 28
+// Android only provides aligned_alloc when targeting API 28 or higher.
+#    define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC
 #  endif
 
 #  if defined(__APPLE__) || defined(__FreeBSD__)