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 // This adds support for the extended locale functions that are currently
10 // missing from the Musl C library.
11 //
12 // This only works when the specified locale is "C" or "POSIX", but that's
13 // about as good as we can do without implementing full xlocale support
14 // in Musl.
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef _LIBCPP___SUPPORT_MUSL_XLOCALE_H
18 #define _LIBCPP___SUPPORT_MUSL_XLOCALE_H
19 
20 #include <cstdlib>
21 #include <cwchar>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
28   return ::strtoll(__nptr, __endptr, __base);
29 }
30 
31 inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
32 strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
33   return ::strtoull(__nptr, __endptr, __base);
34 }
35 
36 inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
37   return ::wcstoll(__nptr, __endptr, __base);
38 }
39 
40 inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
41   return ::wcstoull(__nptr, __endptr, __base);
42 }
43 
44 inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
45   return ::wcstold(__nptr, __endptr);
46 }
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 
52 #endif // _LIBCPP___SUPPORT_MUSL_XLOCALE_H
53