[libcxx] [llvm] Remove workarounds for NDK versions before 2017's r16. (PR #148879)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 09:32:33 PDT 2025


https://github.com/enh-google updated https://github.com/llvm/llvm-project/pull/148879

>From 700598e76302c5ec9c035083b365c2259f228f92 Mon Sep 17 00:00:00 2001
From: enh-google <enh at google.com>
Date: Tue, 15 Jul 2025 12:08:31 -0400
Subject: [PATCH 1/2] Remove workarounds for NDK versions before 2017's r16.

---
 libcxx/include/__locale_dir/locale_base_api.h |  2 -
 .../__locale_dir/locale_base_api/android.h    | 45 -------------------
 2 files changed, 47 deletions(-)
 delete mode 100644 libcxx/include/__locale_dir/locale_base_api/android.h

diff --git a/libcxx/include/__locale_dir/locale_base_api.h b/libcxx/include/__locale_dir/locale_base_api.h
index 8dbc28e839839..9f3ce02a3af20 100644
--- a/libcxx/include/__locale_dir/locale_base_api.h
+++ b/libcxx/include/__locale_dir/locale_base_api.h
@@ -129,8 +129,6 @@
 //       will define those directly.
 #    if defined(_AIX) || defined(__MVS__)
 #      include <__locale_dir/locale_base_api/ibm.h>
-#    elif defined(__ANDROID__)
-#      include <__locale_dir/locale_base_api/android.h>
 #    elif defined(__OpenBSD__)
 #      include <__locale_dir/locale_base_api/openbsd.h>
 #    elif defined(__wasi__) || _LIBCPP_HAS_MUSL_LIBC
diff --git a/libcxx/include/__locale_dir/locale_base_api/android.h b/libcxx/include/__locale_dir/locale_base_api/android.h
deleted file mode 100644
index 36b8d93e1b228..0000000000000
--- a/libcxx/include/__locale_dir/locale_base_api/android.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_ANDROID_H
-#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_ANDROID_H
-
-#include <stdlib.h>
-
-// FIXME: Is this actually required?
-extern "C" {
-#include <xlocale.h>
-}
-
-#include <android/api-level.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/ndk-version.h>
-// In NDK versions later than 16, locale-aware functions are provided by
-// legacy_stdlib_inlines.h
-#  if __NDK_MAJOR__ <= 16
-#    if __ANDROID_API__ < 26
-
-inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t) {
-  return ::strtof(__nptr, __endptr);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t) {
-  return ::strtod(__nptr, __endptr);
-}
-
-#    endif // __ANDROID_API__ < 26
-
-#  endif // __NDK_MAJOR__ <= 16
-#endif   // __has_include(<android/ndk-version.h>)
-
-#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_ANDROID_H

>From 4d3bc8c865178a976fa28b76bf1c591fb699d100 Mon Sep 17 00:00:00 2001
From: enh-google <enh at google.com>
Date: Tue, 15 Jul 2025 12:32:24 -0400
Subject: [PATCH 2/2] Remove build system references to deleted "android.h".

---
 libcxx/include/CMakeLists.txt                   | 1 -
 libcxx/include/module.modulemap.in              | 1 -
 llvm/utils/gn/secondary/libcxx/include/BUILD.gn | 1 -
 3 files changed, 3 deletions(-)

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 4f2a8dddad92c..d729fa81e2b2f 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -514,7 +514,6 @@ set(files
   __locale_dir/check_grouping.h
   __locale_dir/get_c_locale.h
   __locale_dir/locale_base_api.h
-  __locale_dir/locale_base_api/android.h
   __locale_dir/locale_base_api/bsd_locale_fallbacks.h
   __locale_dir/locale_base_api/ibm.h
   __locale_dir/locale_base_api/musl.h
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 61ba1c381b2b3..602e72bbf5b01 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -1590,7 +1590,6 @@ module std [system] {
     }
 
     module locale_base_api {
-      textual header "__locale_dir/locale_base_api/android.h"
       textual header "__locale_dir/locale_base_api/bsd_locale_fallbacks.h"
       textual header "__locale_dir/locale_base_api/ibm.h"
       textual header "__locale_dir/locale_base_api/musl.h"
diff --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index 6051674a790e8..74fa3f81fc317 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -1171,7 +1171,6 @@ if (current_toolchain == default_toolchain) {
       "__locale_dir/check_grouping.h",
       "__locale_dir/get_c_locale.h",
       "__locale_dir/locale_base_api.h",
-      "__locale_dir/locale_base_api/android.h",
       "__locale_dir/locale_base_api/bsd_locale_fallbacks.h",
       "__locale_dir/locale_base_api/ibm.h",
       "__locale_dir/locale_base_api/musl.h",



More information about the llvm-commits mailing list