summaryrefslogtreecommitdiffstats
path: root/lib/libcxx/include/support
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcxx/include/support')
-rw-r--r--lib/libcxx/include/support/android/locale_bionic.h37
-rw-r--r--lib/libcxx/include/support/win32/locale_win32.h8
-rw-r--r--lib/libcxx/include/support/xlocale/__posix_l_fallback.h78
-rw-r--r--lib/libcxx/include/support/xlocale/__strtonum_fallback.h24
4 files changed, 96 insertions, 51 deletions
diff --git a/lib/libcxx/include/support/android/locale_bionic.h b/lib/libcxx/include/support/android/locale_bionic.h
index 482e2343358..50fcf5c36a7 100644
--- a/lib/libcxx/include/support/android/locale_bionic.h
+++ b/lib/libcxx/include/support/android/locale_bionic.h
@@ -24,8 +24,45 @@ extern "C" {
}
#endif
+#if defined(__ANDROID__)
+
+#include <android/api-level.h>
+#include <android/ndk-version.h>
#include <support/xlocale/__posix_l_fallback.h>
+// In NDK versions later than 16, locale-aware functions are provided by
+// legacy_stdlib_inlines.h
+#if __NDK_MAJOR__ <= 16
+#if __ANDROID_API__ < 21
#include <support/xlocale/__strtonum_fallback.h>
+#elif __ANDROID_API__ < 26
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char* __nptr, char** __endptr,
+ locale_t) {
+ return ::strtof(__nptr, __endptr);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY double strtod_l(const char* __nptr,
+ char** __endptr, locale_t) {
+ return ::strtod(__nptr, __endptr);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY long strtol_l(const char* __nptr, char** __endptr,
+ int __base, locale_t) {
+ return ::strtol(__nptr, __endptr, __base);
+}
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // __ANDROID_API__ < 26
+
+#endif // __NDK_MAJOR__ <= 16
+#endif // defined(__ANDROID__)
#endif // defined(__BIONIC__)
#endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
diff --git a/lib/libcxx/include/support/win32/locale_win32.h b/lib/libcxx/include/support/win32/locale_win32.h
index aebfff22ecf..68682c9624b 100644
--- a/lib/libcxx/include/support/win32/locale_win32.h
+++ b/lib/libcxx/include/support/win32/locale_win32.h
@@ -46,6 +46,10 @@ public:
return __left.__locale == nullptr && __right == 0;
}
+ friend bool operator==(const locale_t& __left, long long __right) {
+ return __left.__locale == nullptr && __right == 0;
+ }
+
friend bool operator==(const locale_t& __left, std::nullptr_t) {
return __left.__locale == nullptr;
}
@@ -66,6 +70,10 @@ public:
return !(__left == __right);
}
+ friend bool operator!=(const locale_t& __left, long long __right) {
+ return !(__left == __right);
+ }
+
friend bool operator!=(const locale_t& __left, std::nullptr_t __right) {
return !(__left == __right);
}
diff --git a/lib/libcxx/include/support/xlocale/__posix_l_fallback.h b/lib/libcxx/include/support/xlocale/__posix_l_fallback.h
index c893a67313c..b9a0939f8fa 100644
--- a/lib/libcxx/include/support/xlocale/__posix_l_fallback.h
+++ b/lib/libcxx/include/support/xlocale/__posix_l_fallback.h
@@ -20,141 +20,141 @@
extern "C" {
#endif
-inline _LIBCPP_ALWAYS_INLINE int isalnum_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int isalnum_l(int c, locale_t) {
return ::isalnum(c);
}
-inline _LIBCPP_ALWAYS_INLINE int isalpha_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int isalpha_l(int c, locale_t) {
return ::isalpha(c);
}
-inline _LIBCPP_ALWAYS_INLINE int isblank_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int isblank_l(int c, locale_t) {
return ::isblank(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iscntrl_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iscntrl_l(int c, locale_t) {
return ::iscntrl(c);
}
-inline _LIBCPP_ALWAYS_INLINE int isdigit_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int isdigit_l(int c, locale_t) {
return ::isdigit(c);
}
-inline _LIBCPP_ALWAYS_INLINE int isgraph_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int isgraph_l(int c, locale_t) {
return ::isgraph(c);
}
-inline _LIBCPP_ALWAYS_INLINE int islower_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int islower_l(int c, locale_t) {
return ::islower(c);
}
-inline _LIBCPP_ALWAYS_INLINE int isprint_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int isprint_l(int c, locale_t) {
return ::isprint(c);
}
-inline _LIBCPP_ALWAYS_INLINE int ispunct_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int ispunct_l(int c, locale_t) {
return ::ispunct(c);
}
-inline _LIBCPP_ALWAYS_INLINE int isspace_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int isspace_l(int c, locale_t) {
return ::isspace(c);
}
-inline _LIBCPP_ALWAYS_INLINE int isupper_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int isupper_l(int c, locale_t) {
return ::isupper(c);
}
-inline _LIBCPP_ALWAYS_INLINE int isxdigit_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int isxdigit_l(int c, locale_t) {
return ::isxdigit(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswalnum_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswalnum_l(wint_t c, locale_t) {
return ::iswalnum(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswalpha_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswalpha_l(wint_t c, locale_t) {
return ::iswalpha(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswblank_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswblank_l(wint_t c, locale_t) {
return ::iswblank(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswcntrl_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswcntrl_l(wint_t c, locale_t) {
return ::iswcntrl(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswdigit_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswdigit_l(wint_t c, locale_t) {
return ::iswdigit(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswgraph_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswgraph_l(wint_t c, locale_t) {
return ::iswgraph(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswlower_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswlower_l(wint_t c, locale_t) {
return ::iswlower(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswprint_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswprint_l(wint_t c, locale_t) {
return ::iswprint(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswpunct_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswpunct_l(wint_t c, locale_t) {
return ::iswpunct(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswspace_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswspace_l(wint_t c, locale_t) {
return ::iswspace(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswupper_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswupper_l(wint_t c, locale_t) {
return ::iswupper(c);
}
-inline _LIBCPP_ALWAYS_INLINE int iswxdigit_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int iswxdigit_l(wint_t c, locale_t) {
return ::iswxdigit(c);
}
-inline _LIBCPP_ALWAYS_INLINE int toupper_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int toupper_l(int c, locale_t) {
return ::toupper(c);
}
-inline _LIBCPP_ALWAYS_INLINE int tolower_l(int c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int tolower_l(int c, locale_t) {
return ::tolower(c);
}
-inline _LIBCPP_ALWAYS_INLINE wint_t towupper_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY wint_t towupper_l(wint_t c, locale_t) {
return ::towupper(c);
}
-inline _LIBCPP_ALWAYS_INLINE wint_t towlower_l(wint_t c, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY wint_t towlower_l(wint_t c, locale_t) {
return ::towlower(c);
}
-inline _LIBCPP_ALWAYS_INLINE int strcoll_l(const char *s1, const char *s2,
- locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int strcoll_l(const char *s1, const char *s2,
+ locale_t) {
return ::strcoll(s1, s2);
}
-inline _LIBCPP_ALWAYS_INLINE size_t strxfrm_l(char *dest, const char *src,
- size_t n, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY size_t strxfrm_l(char *dest, const char *src,
+ size_t n, locale_t) {
return ::strxfrm(dest, src, n);
}
-inline _LIBCPP_ALWAYS_INLINE size_t strftime_l(char *s, size_t max,
- const char *format,
- const struct tm *tm, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY size_t strftime_l(char *s, size_t max,
+ const char *format,
+ const struct tm *tm, locale_t) {
return ::strftime(s, max, format, tm);
}
-inline _LIBCPP_ALWAYS_INLINE int wcscoll_l(const wchar_t *ws1,
- const wchar_t *ws2, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY int wcscoll_l(const wchar_t *ws1,
+ const wchar_t *ws2, locale_t) {
return ::wcscoll(ws1, ws2);
}
-inline _LIBCPP_ALWAYS_INLINE size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src,
- size_t n, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src,
+ size_t n, locale_t) {
return ::wcsxfrm(dest, src, n);
}
diff --git a/lib/libcxx/include/support/xlocale/__strtonum_fallback.h b/lib/libcxx/include/support/xlocale/__strtonum_fallback.h
index 4ae3918b3d3..50b4db35427 100644
--- a/lib/libcxx/include/support/xlocale/__strtonum_fallback.h
+++ b/lib/libcxx/include/support/xlocale/__strtonum_fallback.h
@@ -20,43 +20,43 @@
extern "C" {
#endif
-inline _LIBCPP_ALWAYS_INLINE float strtof_l(const char *nptr,
- char **endptr, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char *nptr,
+ char **endptr, locale_t) {
return ::strtof(nptr, endptr);
}
-inline _LIBCPP_ALWAYS_INLINE double strtod_l(const char *nptr,
- char **endptr, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY double strtod_l(const char *nptr,
+ char **endptr, locale_t) {
return ::strtod(nptr, endptr);
}
-inline _LIBCPP_ALWAYS_INLINE long double strtold_l(const char *nptr,
- char **endptr, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY long double strtold_l(const char *nptr,
+ char **endptr, locale_t) {
return ::strtold(nptr, endptr);
}
-inline _LIBCPP_ALWAYS_INLINE long long
+inline _LIBCPP_INLINE_VISIBILITY long long
strtoll_l(const char *nptr, char **endptr, int base, locale_t) {
return ::strtoll(nptr, endptr, base);
}
-inline _LIBCPP_ALWAYS_INLINE unsigned long long
+inline _LIBCPP_INLINE_VISIBILITY unsigned long long
strtoull_l(const char *nptr, char **endptr, int base, locale_t) {
return ::strtoull(nptr, endptr, base);
}
-inline _LIBCPP_ALWAYS_INLINE long long
+inline _LIBCPP_INLINE_VISIBILITY long long
wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
return ::wcstoll(nptr, endptr, base);
}
-inline _LIBCPP_ALWAYS_INLINE unsigned long long
+inline _LIBCPP_INLINE_VISIBILITY unsigned long long
wcstoull_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
return ::wcstoull(nptr, endptr, base);
}
-inline _LIBCPP_ALWAYS_INLINE long double wcstold_l(const wchar_t *nptr,
- wchar_t **endptr, locale_t) {
+inline _LIBCPP_INLINE_VISIBILITY long double wcstold_l(const wchar_t *nptr,
+ wchar_t **endptr, locale_t) {
return ::wcstold(nptr, endptr);
}