[libcxx-commits] [libcxx] [libc++] Remove support for Android 4 and older (PR #124062)

Brad Smith via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 22 20:29:39 PST 2025


https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/124062

None

>From a943e48c7f9bdaeb8c1eaa4e9f22d0c1faa5257d Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Wed, 22 Jan 2025 23:27:46 -0500
Subject: [PATCH] [libc++] Remove support for Android 4 and older

---
 .../__cxx03/__locale_dir/locale_base_api/android.h |  7 +------
 .../include/__locale_dir/locale_base_api/android.h |  7 +------
 libcxx/src/verbose_abort.cpp                       | 14 +-------------
 3 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/libcxx/include/__cxx03/__locale_dir/locale_base_api/android.h b/libcxx/include/__cxx03/__locale_dir/locale_base_api/android.h
index 265dbf892a54f6..e96e64d9816474 100644
--- a/libcxx/include/__cxx03/__locale_dir/locale_base_api/android.h
+++ b/libcxx/include/__cxx03/__locale_dir/locale_base_api/android.h
@@ -18,9 +18,6 @@ extern "C" {
 }
 
 #include <__cxx03/android/api-level.h>
-#if __ANDROID_API__ < 21
-#  include <__cxx03/__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
@@ -30,9 +27,7 @@ extern "C" {
 // 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 <__cxx03/__support/xlocale/__strtonum_fallback.h>
-#    elif __ANDROID_API__ < 26
+#    if __ANDROID_API__ < 26
 
 inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t) {
   return ::strtof(__nptr, __endptr);
diff --git a/libcxx/include/__locale_dir/locale_base_api/android.h b/libcxx/include/__locale_dir/locale_base_api/android.h
index 08ef5407dedf4e..36b8d93e1b228c 100644
--- a/libcxx/include/__locale_dir/locale_base_api/android.h
+++ b/libcxx/include/__locale_dir/locale_base_api/android.h
@@ -18,9 +18,6 @@ extern "C" {
 }
 
 #include <android/api-level.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
@@ -30,9 +27,7 @@ extern "C" {
 // 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 __ANDROID_API__ < 26
 
 inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t) {
   return ::strtof(__nptr, __endptr);
diff --git a/libcxx/src/verbose_abort.cpp b/libcxx/src/verbose_abort.cpp
index 6704709d247ca1..fd6bc4943d6bab 100644
--- a/libcxx/src/verbose_abort.cpp
+++ b/libcxx/src/verbose_abort.cpp
@@ -13,13 +13,8 @@
 #include <cstdlib>
 
 #ifdef __BIONIC__
-#  include <android/api-level.h>
-#  if __ANDROID_API__ >= 21
-#    include <syslog.h>
+#  include <syslog.h>
 extern "C" void android_set_abort_message(const char* msg);
-#  else
-#    include <assert.h>
-#  endif // __ANDROID_API__ >= 21
 #endif   // __BIONIC__
 
 #if defined(__APPLE__) && __has_include(<CrashReporterClient.h>)
@@ -54,7 +49,6 @@ _LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) _LIBCPP_VERBOS
 #elif defined(__BIONIC__)
   vasprintf(&buffer, format, list);
 
-#  if __ANDROID_API__ >= 21
   // Show error in tombstone.
   android_set_abort_message(buffer);
 
@@ -62,12 +56,6 @@ _LIBCPP_WEAK void __libcpp_verbose_abort(char const* format, ...) _LIBCPP_VERBOS
   openlog("libc++", 0, 0);
   syslog(LOG_CRIT, "%s", buffer);
   closelog();
-#  else
-  // The good error reporting wasn't available in Android until L. Since we're
-  // about to abort anyway, just call __assert2, which will log _somewhere_
-  // (tombstone and/or logcat) in older releases.
-  __assert2(__FILE__, __LINE__, __func__, buffer);
-#  endif // __ANDROID_API__ >= 21
 #endif
   va_end(list);
 



More information about the libcxx-commits mailing list