Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / libcxx / include / __support / xlocale / __posix_l_fallback.h
bloba56de0a5d78cdb0cd8418739fbcc7a0718ac24ae
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 // These are reimplementations of some extended locale functions ( *_l ) that
10 // are normally part of POSIX. This shared implementation provides parts of the
11 // extended locale support for libc's that normally don't have any (like
12 // Android's bionic and Newlib).
13 //===----------------------------------------------------------------------===//
15 #ifndef _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
16 #define _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
18 #include <__config>
19 #include <ctype.h>
20 #include <string.h>
21 #include <time.h>
23 #if _LIBCPP_HAS_WIDE_CHARACTERS
24 # include <wchar.h>
25 # include <wctype.h>
26 #endif
28 inline _LIBCPP_HIDE_FROM_ABI int isdigit_l(int __c, locale_t) { return ::isdigit(__c); }
30 inline _LIBCPP_HIDE_FROM_ABI int islower_l(int __c, locale_t) { return ::islower(__c); }
32 inline _LIBCPP_HIDE_FROM_ABI int isupper_l(int __c, locale_t) { return ::isupper(__c); }
34 inline _LIBCPP_HIDE_FROM_ABI int isxdigit_l(int __c, locale_t) { return ::isxdigit(__c); }
36 inline _LIBCPP_HIDE_FROM_ABI int toupper_l(int __c, locale_t) { return ::toupper(__c); }
38 inline _LIBCPP_HIDE_FROM_ABI int tolower_l(int __c, locale_t) { return ::tolower(__c); }
40 #if _LIBCPP_HAS_WIDE_CHARACTERS
41 inline _LIBCPP_HIDE_FROM_ABI int iswctype_l(wint_t __c, wctype_t __type, locale_t) { return ::iswctype(__c, __type); }
43 inline _LIBCPP_HIDE_FROM_ABI int iswalpha_l(wint_t __c, locale_t) { return ::iswalpha(__c); }
45 inline _LIBCPP_HIDE_FROM_ABI int iswblank_l(wint_t __c, locale_t) { return ::iswblank(__c); }
47 inline _LIBCPP_HIDE_FROM_ABI int iswcntrl_l(wint_t __c, locale_t) { return ::iswcntrl(__c); }
49 inline _LIBCPP_HIDE_FROM_ABI int iswdigit_l(wint_t __c, locale_t) { return ::iswdigit(__c); }
51 inline _LIBCPP_HIDE_FROM_ABI int iswlower_l(wint_t __c, locale_t) { return ::iswlower(__c); }
53 inline _LIBCPP_HIDE_FROM_ABI int iswprint_l(wint_t __c, locale_t) { return ::iswprint(__c); }
55 inline _LIBCPP_HIDE_FROM_ABI int iswpunct_l(wint_t __c, locale_t) { return ::iswpunct(__c); }
57 inline _LIBCPP_HIDE_FROM_ABI int iswspace_l(wint_t __c, locale_t) { return ::iswspace(__c); }
59 inline _LIBCPP_HIDE_FROM_ABI int iswupper_l(wint_t __c, locale_t) { return ::iswupper(__c); }
61 inline _LIBCPP_HIDE_FROM_ABI int iswxdigit_l(wint_t __c, locale_t) { return ::iswxdigit(__c); }
63 inline _LIBCPP_HIDE_FROM_ABI wint_t towupper_l(wint_t __c, locale_t) { return ::towupper(__c); }
65 inline _LIBCPP_HIDE_FROM_ABI wint_t towlower_l(wint_t __c, locale_t) { return ::towlower(__c); }
66 #endif // _LIBCPP_HAS_WIDE_CHARACTERS
68 inline _LIBCPP_HIDE_FROM_ABI int strcoll_l(const char* __s1, const char* __s2, locale_t) {
69 return ::strcoll(__s1, __s2);
72 inline _LIBCPP_HIDE_FROM_ABI size_t strxfrm_l(char* __dest, const char* __src, size_t __n, locale_t) {
73 return ::strxfrm(__dest, __src, __n);
76 inline _LIBCPP_HIDE_FROM_ABI size_t
77 strftime_l(char* __s, size_t __max, const char* __format, const struct tm* __tm, locale_t) {
78 return ::strftime(__s, __max, __format, __tm);
81 #if _LIBCPP_HAS_WIDE_CHARACTERS
82 inline _LIBCPP_HIDE_FROM_ABI int wcscoll_l(const wchar_t* __ws1, const wchar_t* __ws2, locale_t) {
83 return ::wcscoll(__ws1, __ws2);
86 inline _LIBCPP_HIDE_FROM_ABI size_t wcsxfrm_l(wchar_t* __dest, const wchar_t* __src, size_t __n, locale_t) {
87 return ::wcsxfrm(__dest, __src, __n);
89 #endif // _LIBCPP_HAS_WIDE_CHARACTERS
91 #endif // _LIBCPP___SUPPORT_XLOCALE_POSIX_L_FALLBACK_H