1 // -*- C++ -*-
2 //===-----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_ANDROID_H
11 #define _LIBCPP___LOCALE_LOCALE_BASE_API_ANDROID_H
12
13 #include <stdlib.h>
14
15 // FIXME: Is this actually required?
16 extern "C" {
17 #include <xlocale.h>
18 }
19
20 #include <android/api-level.h>
21 #if __ANDROID_API__ < 21
22 # include <__support/xlocale/__posix_l_fallback.h>
23 #endif
24
25 // If we do not have this header, we are in a platform build rather than an NDK
26 // build, which will always be at least as new as the ToT NDK, in which case we
27 // don't need any of the inlines below since libc provides them.
28 #if __has_include(<android/ndk-version.h>)
29 # include <android/ndk-version.h>
30 // In NDK versions later than 16, locale-aware functions are provided by
31 // legacy_stdlib_inlines.h
32 # if __NDK_MAJOR__ <= 16
33 # if __ANDROID_API__ < 21
34 # include <__support/xlocale/__strtonum_fallback.h>
35 # elif __ANDROID_API__ < 26
36
strtof_l(const char * __nptr,char ** __endptr,locale_t)37 inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t) {
38 return ::strtof(__nptr, __endptr);
39 }
40
strtod_l(const char * __nptr,char ** __endptr,locale_t)41 inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t) {
42 return ::strtod(__nptr, __endptr);
43 }
44
45 # endif // __ANDROID_API__ < 26
46
47 # endif // __NDK_MAJOR__ <= 16
48 #endif // __has_include(<android/ndk-version.h>)
49
50 #endif // _LIBCPP___LOCALE_LOCALE_BASE_API_ANDROID_H
51