xref: /netbsd-src/external/apache2/llvm/dist/libcxx/include/__support/android/locale_bionic.h (revision 4d6fc14bc9b0c5bf3e30be318c143ee82cadd108)
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_SUPPORT_ANDROID_LOCALE_BIONIC_H
11 #define _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
12 
13 #if defined(__BIONIC__)
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #include <stdlib.h>
20 #include <xlocale.h>
21 
22 #ifdef __cplusplus
23 }
24 #endif
25 
26 #if defined(__ANDROID__)
27 
28 #include <android/api-level.h>
29 #include <android/ndk-version.h>
30 #if __ANDROID_API__ < 21
31 #include <__support/xlocale/__posix_l_fallback.h>
32 #endif
33 // In NDK versions later than 16, locale-aware functions are provided by
34 // legacy_stdlib_inlines.h
35 #if __NDK_MAJOR__ <= 16
36 #if __ANDROID_API__ < 21
37 #include <__support/xlocale/__strtonum_fallback.h>
38 #elif __ANDROID_API__ < 26
39 
40 #if defined(__cplusplus)
41 extern "C" {
42 #endif
43 
strtof_l(const char * __nptr,char ** __endptr,locale_t)44 inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char* __nptr, char** __endptr,
45                                                 locale_t) {
46   return ::strtof(__nptr, __endptr);
47 }
48 
strtod_l(const char * __nptr,char ** __endptr,locale_t)49 inline _LIBCPP_INLINE_VISIBILITY double strtod_l(const char* __nptr,
50                                                  char** __endptr, locale_t) {
51   return ::strtod(__nptr, __endptr);
52 }
53 
strtol_l(const char * __nptr,char ** __endptr,int __base,locale_t)54 inline _LIBCPP_INLINE_VISIBILITY long strtol_l(const char* __nptr, char** __endptr,
55                                                int __base, locale_t) {
56   return ::strtol(__nptr, __endptr, __base);
57 }
58 
59 #if defined(__cplusplus)
60 }
61 #endif
62 
63 #endif // __ANDROID_API__ < 26
64 
65 #endif // __NDK_MAJOR__ <= 16
66 #endif // defined(__ANDROID__)
67 
68 #endif // defined(__BIONIC__)
69 #endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
70