xlocale.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #ifndef _LIBCPP___SUPPORT_MUSL_XLOCALE_H
  17. #define _LIBCPP___SUPPORT_MUSL_XLOCALE_H
  18. #include <cstdlib>
  19. #include <cwchar>
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. inline _LIBCPP_HIDE_FROM_ABI_C long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t) {
  24. return ::strtoll(__nptr, __endptr, __base);
  25. }
  26. inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
  27. strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t) {
  28. return ::strtoull(__nptr, __endptr, __base);
  29. }
  30. inline _LIBCPP_HIDE_FROM_ABI_C long long wcstoll_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
  31. return ::wcstoll(__nptr, __endptr, __base);
  32. }
  33. inline _LIBCPP_HIDE_FROM_ABI_C unsigned long long
  34. wcstoull_l(const wchar_t* __nptr, wchar_t** __endptr, int __base, locale_t) {
  35. return ::wcstoull(__nptr, __endptr, __base);
  36. }
  37. inline _LIBCPP_HIDE_FROM_ABI_C long double wcstold_l(const wchar_t* __nptr, wchar_t** __endptr, locale_t) {
  38. return ::wcstold(__nptr, __endptr);
  39. }
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif // _LIBCPP___SUPPORT_MUSL_XLOCALE_H