summaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/__support
diff options
context:
space:
mode:
authormikhnenko <[email protected]>2024-12-18 19:08:08 +0300
committermikhnenko <[email protected]>2024-12-18 19:29:26 +0300
commit7ed76959e6c06dbc4c249ce0f3b930463a6b65db (patch)
tree0e9528cb7261812a5ae7ed177048721eaebf8ed0 /contrib/libs/cxxsupp/libcxx/include/__support
parent4c8e7f015711b5175d63e1a87cbd40c49ce7aa70 (diff)
libc++: Run clang-format from upstream and update to 9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7
commit_hash:ca4954fe054e5a7190ad11ab71bfc7ca0965bca2
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__support')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h50
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h8
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h14
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/locale_mgmt_zos.h34
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/nanosleep.h6
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h43
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h11
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h313
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h18
9 files changed, 222 insertions, 275 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h b/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h
index 30e345cf9ee..fee2ba5df34 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h
@@ -12,39 +12,39 @@
#if defined(__BIONIC__)
-#ifdef __cplusplus
+# ifdef __cplusplus
extern "C" {
-#endif
+# endif
-#include <stdlib.h>
-#include <xlocale.h>
+# include <stdlib.h>
+# include <xlocale.h>
-#ifdef __cplusplus
+# ifdef __cplusplus
}
-#endif
+# endif
-#if defined(__ANDROID__)
+# if defined(__ANDROID__)
-#include <android/api-level.h>
-#if __ANDROID_API__ < 21
-#include <__support/xlocale/__posix_l_fallback.h>
-#endif
+# include <android/api-level.h>
+# if __ANDROID_API__ < 21
+# include <__support/xlocale/__posix_l_fallback.h>
+# endif
// If we do not have this header, we are in a platform build rather than an NDK
// build, which will always be at least as new as the ToT NDK, in which case we
// don't need any of the inlines below since libc provides them.
-#if __has_include(<android/ndk-version.h>)
-#include <android/ndk-version.h>
+# if __has_include(<android/ndk-version.h>)
+# include <android/ndk-version.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 __NDK_MAJOR__ <= 16
+# if __ANDROID_API__ < 21
+# include <__support/xlocale/__strtonum_fallback.h>
+# elif __ANDROID_API__ < 26
-#if defined(__cplusplus)
+# if defined(__cplusplus)
extern "C" {
-#endif
+# endif
inline _LIBCPP_HIDE_FROM_ABI_C float strtof_l(const char* __nptr, char** __endptr, locale_t) {
return ::strtof(__nptr, __endptr);
@@ -58,15 +58,15 @@ inline _LIBCPP_HIDE_FROM_ABI_C long strtol_l(const char* __nptr, char** __endptr
return ::strtol(__nptr, __endptr, __base);
}
-#if defined(__cplusplus)
+# if defined(__cplusplus)
}
-#endif
+# endif
-#endif // __ANDROID_API__ < 26
+# endif // __ANDROID_API__ < 26
-#endif // __NDK_MAJOR__ <= 16
-#endif // __has_include(<android/ndk-version.h>)
-#endif // defined(__ANDROID__)
+# endif // __NDK_MAJOR__ <= 16
+# endif // __has_include(<android/ndk-version.h>)
+# endif // defined(__ANDROID__)
#endif // defined(__BIONIC__)
#endif // _LIBCPP___SUPPORT_ANDROID_LOCALE_BIONIC_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h
index 1e4ece8dd3e..957d5cb47dd 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h
@@ -12,10 +12,10 @@
#if defined(__Fuchsia__)
-#include <cstdlib>
-#include <cwchar>
-#include <__support/xlocale/__posix_l_fallback.h>
-#include <__support/xlocale/__strtonum_fallback.h>
+# include <__support/xlocale/__posix_l_fallback.h>
+# include <__support/xlocale/__strtonum_fallback.h>
+# include <cstdlib>
+# include <cwchar>
#endif // defined(__Fuchsia__)
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h
index fe7dc8bc17a..bd7e4677366 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h
@@ -12,9 +12,7 @@
#include <time.h>
-inline _LIBCPP_HIDE_FROM_ABI int
-gettimeofdayMonotonic(struct timespec64* Output) {
-
+inline _LIBCPP_HIDE_FROM_ABI int gettimeofdayMonotonic(struct timespec64* Output) {
// The POSIX gettimeofday() function is not available on z/OS. Therefore,
// we will call stcke and other hardware instructions in implement equivalent.
// Note that nanoseconds alone will overflow when reaching new epoch in 2042.
@@ -24,7 +22,7 @@ gettimeofdayMonotonic(struct timespec64* Output) {
uint64_t Lo;
};
struct _t Value = {0, 0};
- uint64_t CC = 0;
+ uint64_t CC = 0;
asm(" stcke %0\n"
" ipm %1\n"
" srlg %1,%1,28\n"
@@ -36,17 +34,17 @@ gettimeofdayMonotonic(struct timespec64* Output) {
}
uint64_t us = (Value.Hi >> 4);
uint64_t ns = ((Value.Hi & 0x0F) << 8) + (Value.Lo >> 56);
- ns = (ns * 1000) >> 12;
- us = us - 2208988800000000;
+ ns = (ns * 1000) >> 12;
+ us = us - 2208988800000000;
register uint64_t DivPair0 asm("r0"); // dividend (upper half), remainder
DivPair0 = 0;
register uint64_t DivPair1 asm("r1"); // dividend (lower half), quotient
- DivPair1 = us;
+ DivPair1 = us;
uint64_t Divisor = 1000000;
asm(" dlgr %0,%2" : "+r"(DivPair0), "+r"(DivPair1) : "r"(Divisor) :);
- Output->tv_sec = DivPair1;
+ Output->tv_sec = DivPair1;
Output->tv_nsec = DivPair0 * 1000 + ns;
return 0;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/locale_mgmt_zos.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/locale_mgmt_zos.h
index 179f563eb75..5fc04b6b4b2 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/locale_mgmt_zos.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/locale_mgmt_zos.h
@@ -11,24 +11,24 @@
#define _LIBCPP___SUPPORT_IBM_LOCALE_MGMT_ZOS_H
#if defined(__MVS__)
-#include <locale.h>
-#include <string>
+# include <locale.h>
+# include <string>
-#ifdef __cplusplus
+# ifdef __cplusplus
extern "C" {
-#endif
+# endif
-#define _LC_MAX LC_MESSAGES /* highest real category */
-#define _NCAT (_LC_MAX + 1) /* maximum + 1 */
+# define _LC_MAX LC_MESSAGES /* highest real category */
+# define _NCAT (_LC_MAX + 1) /* maximum + 1 */
-#define _CATMASK(n) (1 << (n))
-#define LC_COLLATE_MASK _CATMASK(LC_COLLATE)
-#define LC_CTYPE_MASK _CATMASK(LC_CTYPE)
-#define LC_MONETARY_MASK _CATMASK(LC_MONETARY)
-#define LC_NUMERIC_MASK _CATMASK(LC_NUMERIC)
-#define LC_TIME_MASK _CATMASK(LC_TIME)
-#define LC_MESSAGES_MASK _CATMASK(LC_MESSAGES)
-#define LC_ALL_MASK (_CATMASK(_NCAT) - 1)
+# define _CATMASK(n) (1 << (n))
+# define LC_COLLATE_MASK _CATMASK(LC_COLLATE)
+# define LC_CTYPE_MASK _CATMASK(LC_CTYPE)
+# define LC_MONETARY_MASK _CATMASK(LC_MONETARY)
+# define LC_NUMERIC_MASK _CATMASK(LC_NUMERIC)
+# define LC_TIME_MASK _CATMASK(LC_TIME)
+# define LC_MESSAGES_MASK _CATMASK(LC_MESSAGES)
+# define LC_ALL_MASK (_CATMASK(_NCAT) - 1)
typedef struct locale_struct {
int category_mask;
@@ -38,7 +38,7 @@ typedef struct locale_struct {
std::string lc_numeric;
std::string lc_time;
std::string lc_messages;
-} * locale_t;
+}* locale_t;
// z/OS does not have newlocale, freelocale and uselocale.
// The functions below are workarounds in single thread mode.
@@ -46,8 +46,8 @@ locale_t newlocale(int category_mask, const char* locale, locale_t base);
void freelocale(locale_t locobj);
locale_t uselocale(locale_t newloc);
-#ifdef __cplusplus
+# ifdef __cplusplus
}
-#endif
+# endif
#endif // defined(__MVS__)
#endif // _LIBCPP___SUPPORT_IBM_LOCALE_MGMT_ZOS_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/nanosleep.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/nanosleep.h
index 7a32c66c11f..fadc784c029 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/nanosleep.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/nanosleep.h
@@ -22,7 +22,7 @@ inline int nanosleep(const struct timespec* __req, struct timespec* __rem) {
return -1;
}
long __micro_sec = (__req->tv_nsec + 999) / 1000;
- time_t __sec = __req->tv_sec;
+ time_t __sec = __req->tv_sec;
if (__micro_sec > 999999) {
++__sec;
__micro_sec -= 1000000;
@@ -31,7 +31,7 @@ inline int nanosleep(const struct timespec* __req, struct timespec* __rem) {
if (__sec) {
if (__rem) {
// Updating the remaining time to sleep in case of unsuccessful call to sleep().
- __rem->tv_sec = __sec;
+ __rem->tv_sec = __sec;
__rem->tv_nsec = __micro_sec * 1000;
}
errno = EINTR;
@@ -42,7 +42,7 @@ inline int nanosleep(const struct timespec* __req, struct timespec* __rem) {
if (__rt != 0 && __rem) {
// The usleep() does not provide the amount of remaining time upon its failure,
// so the time slept will be ignored.
- __rem->tv_sec = 0;
+ __rem->tv_sec = 0;
__rem->tv_nsec = __micro_sec * 1000;
// The errno is already set.
return -1;
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
index 03302b0d4f0..52538e264c0 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
@@ -11,7 +11,7 @@
#define _LIBCPP___SUPPORT_IBM_XLOCALE_H
#if defined(__MVS__)
-#include <__support/ibm/locale_mgmt_zos.h>
+# include <__support/ibm/locale_mgmt_zos.h>
#endif // defined(__MVS__)
#include <stdarg.h>
@@ -23,9 +23,9 @@ extern "C" {
#endif
#if defined(__MVS__)
-#include <wctype.h>
+# include <wctype.h>
// POSIX routines
-#include <__support/xlocale/__posix_l_fallback.h>
+# include <__support/xlocale/__posix_l_fallback.h>
#endif // defined(__MVS__)
namespace {
@@ -33,7 +33,7 @@ namespace {
struct __setAndRestore {
explicit __setAndRestore(locale_t locale) {
if (locale == (locale_t)0) {
- __cloc = newlocale(LC_ALL_MASK, "C", /* base */ (locale_t)0);
+ __cloc = newlocale(LC_ALL_MASK, "C", /* base */ (locale_t)0);
__stored = uselocale(__cloc);
} else {
__stored = uselocale(locale);
@@ -48,59 +48,52 @@ struct __setAndRestore {
private:
locale_t __stored = (locale_t)0;
- locale_t __cloc = (locale_t)0;
+ locale_t __cloc = (locale_t)0;
};
} // namespace
// The following are not POSIX routines. These are quick-and-dirty hacks
// to make things pretend to work
-inline _LIBCPP_HIDE_FROM_ABI long long
-strtoll_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI long long strtoll_l(const char* __nptr, char** __endptr, int __base, locale_t locale) {
__setAndRestore __newloc(locale);
return ::strtoll(__nptr, __endptr, __base);
}
-inline _LIBCPP_HIDE_FROM_ABI long
-strtol_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI long strtol_l(const char* __nptr, char** __endptr, int __base, locale_t locale) {
__setAndRestore __newloc(locale);
return ::strtol(__nptr, __endptr, __base);
}
-inline _LIBCPP_HIDE_FROM_ABI double
-strtod_l(const char *__nptr, char **__endptr, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI double strtod_l(const char* __nptr, char** __endptr, locale_t locale) {
__setAndRestore __newloc(locale);
return ::strtod(__nptr, __endptr);
}
-inline _LIBCPP_HIDE_FROM_ABI float
-strtof_l(const char *__nptr, char **__endptr, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI float strtof_l(const char* __nptr, char** __endptr, locale_t locale) {
__setAndRestore __newloc(locale);
return ::strtof(__nptr, __endptr);
}
-inline _LIBCPP_HIDE_FROM_ABI long double
-strtold_l(const char *__nptr, char **__endptr, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI long double strtold_l(const char* __nptr, char** __endptr, locale_t locale) {
__setAndRestore __newloc(locale);
return ::strtold(__nptr, __endptr);
}
inline _LIBCPP_HIDE_FROM_ABI unsigned long long
-strtoull_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
+strtoull_l(const char* __nptr, char** __endptr, int __base, locale_t locale) {
__setAndRestore __newloc(locale);
return ::strtoull(__nptr, __endptr, __base);
}
-inline _LIBCPP_HIDE_FROM_ABI unsigned long
-strtoul_l(const char *__nptr, char **__endptr, int __base, locale_t locale) {
+inline _LIBCPP_HIDE_FROM_ABI unsigned long strtoul_l(const char* __nptr, char** __endptr, int __base, locale_t locale) {
__setAndRestore __newloc(locale);
return ::strtoul(__nptr, __endptr, __base);
}
-inline _LIBCPP_HIDE_FROM_ABI int
-vasprintf(char **strp, const char *fmt, va_list ap) {
+inline _LIBCPP_HIDE_FROM_ABI int vasprintf(char** strp, const char* fmt, va_list ap) {
const size_t buff_size = 256;
- if ((*strp = (char *)malloc(buff_size)) == NULL) {
+ if ((*strp = (char*)malloc(buff_size)) == NULL) {
return -1;
}
@@ -111,14 +104,14 @@ vasprintf(char **strp, const char *fmt, va_list ap) {
#else
va_copy(ap_copy, ap);
#endif
- int str_size = vsnprintf(*strp, buff_size, fmt, ap_copy);
+ int str_size = vsnprintf(*strp, buff_size, fmt, ap_copy);
va_end(ap_copy);
- if ((size_t) str_size >= buff_size) {
- if ((*strp = (char *)realloc(*strp, str_size + 1)) == NULL) {
+ if ((size_t)str_size >= buff_size) {
+ if ((*strp = (char*)realloc(*strp, str_size + 1)) == NULL) {
return -1;
}
- str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
+ str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
}
return str_size;
}
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h
index 4e546500fcf..9c57bf42ab0 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h
@@ -11,12 +11,11 @@
#if defined(_NEWLIB_VERSION)
-#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \
- __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
-#include <__support/xlocale/__nop_locale_mgmt.h>
-#include <__support/xlocale/__posix_l_fallback.h>
-#include <__support/xlocale/__strtonum_fallback.h>
-#endif
+# if !defined(__NEWLIB__) || __NEWLIB__ < 2 || __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
+# include <__support/xlocale/__nop_locale_mgmt.h>
+# include <__support/xlocale/__posix_l_fallback.h>
+# include <__support/xlocale/__strtonum_fallback.h>
+# endif
#endif // _NEWLIB_VERSION
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h b/contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h
index 1c6b4b5f143..3c7ae9c693b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h
@@ -46,167 +46,143 @@
class __lconv_storage {
public:
- __lconv_storage(const lconv *__lc_input) {
- __lc_ = *__lc_input;
-
- __decimal_point_ = __lc_input->decimal_point;
- __thousands_sep_ = __lc_input->thousands_sep;
- __grouping_ = __lc_input->grouping;
- __int_curr_symbol_ = __lc_input->int_curr_symbol;
- __currency_symbol_ = __lc_input->currency_symbol;
- __mon_decimal_point_ = __lc_input->mon_decimal_point;
- __mon_thousands_sep_ = __lc_input->mon_thousands_sep;
- __mon_grouping_ = __lc_input->mon_grouping;
- __positive_sign_ = __lc_input->positive_sign;
- __negative_sign_ = __lc_input->negative_sign;
-
- __lc_.decimal_point = const_cast<char *>(__decimal_point_.c_str());
- __lc_.thousands_sep = const_cast<char *>(__thousands_sep_.c_str());
- __lc_.grouping = const_cast<char *>(__grouping_.c_str());
- __lc_.int_curr_symbol = const_cast<char *>(__int_curr_symbol_.c_str());
- __lc_.currency_symbol = const_cast<char *>(__currency_symbol_.c_str());
- __lc_.mon_decimal_point = const_cast<char *>(__mon_decimal_point_.c_str());
- __lc_.mon_thousands_sep = const_cast<char *>(__mon_thousands_sep_.c_str());
- __lc_.mon_grouping = const_cast<char *>(__mon_grouping_.c_str());
- __lc_.positive_sign = const_cast<char *>(__positive_sign_.c_str());
- __lc_.negative_sign = const_cast<char *>(__negative_sign_.c_str());
- }
-
- lconv *__get() {
- return &__lc_;
- }
+ __lconv_storage(const lconv* __lc_input) {
+ __lc_ = *__lc_input;
+
+ __decimal_point_ = __lc_input->decimal_point;
+ __thousands_sep_ = __lc_input->thousands_sep;
+ __grouping_ = __lc_input->grouping;
+ __int_curr_symbol_ = __lc_input->int_curr_symbol;
+ __currency_symbol_ = __lc_input->currency_symbol;
+ __mon_decimal_point_ = __lc_input->mon_decimal_point;
+ __mon_thousands_sep_ = __lc_input->mon_thousands_sep;
+ __mon_grouping_ = __lc_input->mon_grouping;
+ __positive_sign_ = __lc_input->positive_sign;
+ __negative_sign_ = __lc_input->negative_sign;
+
+ __lc_.decimal_point = const_cast<char*>(__decimal_point_.c_str());
+ __lc_.thousands_sep = const_cast<char*>(__thousands_sep_.c_str());
+ __lc_.grouping = const_cast<char*>(__grouping_.c_str());
+ __lc_.int_curr_symbol = const_cast<char*>(__int_curr_symbol_.c_str());
+ __lc_.currency_symbol = const_cast<char*>(__currency_symbol_.c_str());
+ __lc_.mon_decimal_point = const_cast<char*>(__mon_decimal_point_.c_str());
+ __lc_.mon_thousands_sep = const_cast<char*>(__mon_thousands_sep_.c_str());
+ __lc_.mon_grouping = const_cast<char*>(__mon_grouping_.c_str());
+ __lc_.positive_sign = const_cast<char*>(__positive_sign_.c_str());
+ __lc_.negative_sign = const_cast<char*>(__negative_sign_.c_str());
+ }
+
+ lconv* __get() { return &__lc_; }
+
private:
- lconv __lc_;
- std::string __decimal_point_;
- std::string __thousands_sep_;
- std::string __grouping_;
- std::string __int_curr_symbol_;
- std::string __currency_symbol_;
- std::string __mon_decimal_point_;
- std::string __mon_thousands_sep_;
- std::string __mon_grouping_;
- std::string __positive_sign_;
- std::string __negative_sign_;
+ lconv __lc_;
+ std::string __decimal_point_;
+ std::string __thousands_sep_;
+ std::string __grouping_;
+ std::string __int_curr_symbol_;
+ std::string __currency_symbol_;
+ std::string __mon_decimal_point_;
+ std::string __mon_thousands_sep_;
+ std::string __mon_grouping_;
+ std::string __positive_sign_;
+ std::string __negative_sign_;
};
class locale_t {
public:
- locale_t()
- : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {}
- locale_t(std::nullptr_t)
- : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {}
- locale_t(_locale_t __xlocale, const char* __xlocale_str)
- : __locale_(__xlocale), __locale_str_(__xlocale_str), __lc_(nullptr) {}
- locale_t(const locale_t &__l)
- : __locale_(__l.__locale_), __locale_str_(__l.__locale_str_), __lc_(nullptr) {}
-
- ~locale_t() {
- delete __lc_;
- }
-
- locale_t &operator =(const locale_t &__l) {
- __locale_ = __l.__locale_;
- __locale_str_ = __l.__locale_str_;
- // __lc_ not copied
- return *this;
- }
-
- friend bool operator==(const locale_t& __left, const locale_t& __right) {
- return __left.__locale_ == __right.__locale_;
- }
-
- friend bool operator==(const locale_t& __left, int __right) {
- 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;
- }
-
- friend bool operator==(int __left, const locale_t& __right) {
- return __left == 0 && nullptr == __right.__locale_;
- }
-
- friend bool operator==(std::nullptr_t, const locale_t& __right) {
- return nullptr == __right.__locale_;
- }
-
- friend bool operator!=(const locale_t& __left, const locale_t& __right) {
- return !(__left == __right);
- }
-
- friend bool operator!=(const locale_t& __left, int __right) {
- 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);
- }
-
- friend bool operator!=(int __left, const locale_t& __right) {
- return !(__left == __right);
- }
-
- friend bool operator!=(std::nullptr_t __left, const locale_t& __right) {
- return !(__left == __right);
- }
-
- operator bool() const {
- return __locale_ != nullptr;
- }
-
- const char* __get_locale() const { return __locale_str_; }
-
- operator _locale_t() const {
- return __locale_;
- }
-
- lconv *__store_lconv(const lconv *__input_lc) {
- delete __lc_;
- __lc_ = new __lconv_storage(__input_lc);
- return __lc_->__get();
- }
+ locale_t() : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {}
+ locale_t(std::nullptr_t) : __locale_(nullptr), __locale_str_(nullptr), __lc_(nullptr) {}
+ locale_t(_locale_t __xlocale, const char* __xlocale_str)
+ : __locale_(__xlocale), __locale_str_(__xlocale_str), __lc_(nullptr) {}
+ locale_t(const locale_t& __l) : __locale_(__l.__locale_), __locale_str_(__l.__locale_str_), __lc_(nullptr) {}
+
+ ~locale_t() { delete __lc_; }
+
+ locale_t& operator=(const locale_t& __l) {
+ __locale_ = __l.__locale_;
+ __locale_str_ = __l.__locale_str_;
+ // __lc_ not copied
+ return *this;
+ }
+
+ friend bool operator==(const locale_t& __left, const locale_t& __right) {
+ return __left.__locale_ == __right.__locale_;
+ }
+
+ friend bool operator==(const locale_t& __left, int __right) { 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; }
+
+ friend bool operator==(int __left, const locale_t& __right) { return __left == 0 && nullptr == __right.__locale_; }
+
+ friend bool operator==(std::nullptr_t, const locale_t& __right) { return nullptr == __right.__locale_; }
+
+ friend bool operator!=(const locale_t& __left, const locale_t& __right) { return !(__left == __right); }
+
+ friend bool operator!=(const locale_t& __left, int __right) { 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); }
+
+ friend bool operator!=(int __left, const locale_t& __right) { return !(__left == __right); }
+
+ friend bool operator!=(std::nullptr_t __left, const locale_t& __right) { return !(__left == __right); }
+
+ operator bool() const { return __locale_ != nullptr; }
+
+ const char* __get_locale() const { return __locale_str_; }
+
+ operator _locale_t() const { return __locale_; }
+
+ lconv* __store_lconv(const lconv* __input_lc) {
+ delete __lc_;
+ __lc_ = new __lconv_storage(__input_lc);
+ return __lc_->__get();
+ }
+
private:
- _locale_t __locale_;
- const char* __locale_str_;
- __lconv_storage *__lc_ = nullptr;
+ _locale_t __locale_;
+ const char* __locale_str_;
+ __lconv_storage* __lc_ = nullptr;
};
// Locale management functions
#define freelocale _free_locale
// FIXME: base currently unused. Needs manual work to construct the new locale
-locale_t newlocale( int __mask, const char * __locale, locale_t __base );
+locale_t newlocale(int __mask, const char* __locale, locale_t __base);
// uselocale can't be implemented on Windows because Windows allows partial modification
// of thread-local locale and so _get_current_locale() returns a copy while uselocale does
// not create any copies.
// We can still implement raii even without uselocale though.
-
-lconv *localeconv_l( locale_t & __loc );
-size_t mbrlen_l( const char *__restrict __s, size_t __n,
- mbstate_t *__restrict __ps, locale_t __loc);
-size_t mbsrtowcs_l( wchar_t *__restrict __dst, const char **__restrict __src,
- size_t __len, mbstate_t *__restrict __ps, locale_t __loc );
-size_t wcrtomb_l( char *__restrict __s, wchar_t __wc, mbstate_t *__restrict __ps,
- locale_t __loc);
-size_t mbrtowc_l( wchar_t *__restrict __pwc, const char *__restrict __s,
- size_t __n, mbstate_t *__restrict __ps, locale_t __loc);
-size_t mbsnrtowcs_l( wchar_t *__restrict __dst, const char **__restrict __src,
- size_t __nms, size_t __len, mbstate_t *__restrict __ps, locale_t __loc);
-size_t wcsnrtombs_l( char *__restrict __dst, const wchar_t **__restrict __src,
- size_t __nwc, size_t __len, mbstate_t *__restrict __ps, locale_t __loc);
-wint_t btowc_l( int __c, locale_t __loc );
-int wctob_l( wint_t __c, locale_t __loc );
-
-decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l );
+lconv* localeconv_l(locale_t& __loc);
+size_t mbrlen_l(const char* __restrict __s, size_t __n, mbstate_t* __restrict __ps, locale_t __loc);
+size_t mbsrtowcs_l(
+ wchar_t* __restrict __dst, const char** __restrict __src, size_t __len, mbstate_t* __restrict __ps, locale_t __loc);
+size_t wcrtomb_l(char* __restrict __s, wchar_t __wc, mbstate_t* __restrict __ps, locale_t __loc);
+size_t mbrtowc_l(
+ wchar_t* __restrict __pwc, const char* __restrict __s, size_t __n, mbstate_t* __restrict __ps, locale_t __loc);
+size_t mbsnrtowcs_l(wchar_t* __restrict __dst,
+ const char** __restrict __src,
+ size_t __nms,
+ size_t __len,
+ mbstate_t* __restrict __ps,
+ locale_t __loc);
+size_t wcsnrtombs_l(char* __restrict __dst,
+ const wchar_t** __restrict __src,
+ size_t __nwc,
+ size_t __len,
+ mbstate_t* __restrict __ps,
+ locale_t __loc);
+wint_t btowc_l(int __c, locale_t __loc);
+int wctob_l(wint_t __c, locale_t __loc);
+
+decltype(MB_CUR_MAX) MB_CUR_MAX_L(locale_t __l);
// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
#define mbtowc_l _mbtowc_l
@@ -214,23 +190,15 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l );
#define strtoull_l _strtoui64_l
#define strtod_l _strtod_l
#if defined(_LIBCPP_MSVCRT)
-#define strtof_l _strtof_l
-#define strtold_l _strtod_l
+# define strtof_l _strtof_l
+# define strtold_l _strtod_l
#else
_LIBCPP_EXPORTED_FROM_ABI float strtof_l(const char*, char**, locale_t);
_LIBCPP_EXPORTED_FROM_ABI long double strtold_l(const char*, char**, locale_t);
#endif
-inline _LIBCPP_HIDE_FROM_ABI int
-islower_l(int __c, _locale_t __loc)
-{
- return _islower_l((int)__c, __loc);
-}
-
-inline _LIBCPP_HIDE_FROM_ABI int
-isupper_l(int __c, _locale_t __loc)
-{
- return _isupper_l((int)__c, __loc);
-}
+inline _LIBCPP_HIDE_FROM_ABI int islower_l(int __c, _locale_t __loc) { return _islower_l((int)__c, __loc); }
+
+inline _LIBCPP_HIDE_FROM_ABI int isupper_l(int __c, _locale_t __loc) { return _isupper_l((int)__c, __loc); }
#define isdigit_l _isdigit_l
#define isxdigit_l _isxdigit_l
@@ -252,27 +220,20 @@ isupper_l(int __c, _locale_t __loc)
#define towupper_l _towupper_l
#define towlower_l _towlower_l
#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
-_LIBCPP_EXPORTED_FROM_ABI size_t strftime_l(char *ret, size_t n, const char *format,
- const struct tm *tm, locale_t loc);
+_LIBCPP_EXPORTED_FROM_ABI size_t strftime_l(char* ret, size_t n, const char* format, const struct tm* tm, locale_t loc);
#else
-#define strftime_l _strftime_l
+# define strftime_l _strftime_l
#endif
-#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
-_LIBCPP_EXPORTED_FROM_ABI int snprintf_l(char *__ret, size_t __n, locale_t __loc, const char *__format, ...);
-_LIBCPP_EXPORTED_FROM_ABI int asprintf_l( char **__ret, locale_t __loc, const char *__format, ... );
-_LIBCPP_EXPORTED_FROM_ABI int vasprintf_l( char **__ret, locale_t __loc, const char *__format, va_list __ap );
+#define sscanf_l(__s, __l, __f, ...) _sscanf_l(__s, __f, __l, __VA_ARGS__)
+#define sprintf_l(__s, __l, __f, ...) _sprintf_l(__s, __f, __l, __VA_ARGS__)
+#define vsprintf_l(__s, __l, __f, ...) _vsprintf_l(__s, __f, __l, __VA_ARGS__)
+#define vsnprintf_l(__s, __n, __l, __f, ...) _vsnprintf_l(__s, __n, __f, __l, __VA_ARGS__)
+_LIBCPP_EXPORTED_FROM_ABI int snprintf_l(char* __ret, size_t __n, locale_t __loc, const char* __format, ...);
+_LIBCPP_EXPORTED_FROM_ABI int asprintf_l(char** __ret, locale_t __loc, const char* __format, ...);
+_LIBCPP_EXPORTED_FROM_ABI int vasprintf_l(char** __ret, locale_t __loc, const char* __format, va_list __ap);
// not-so-pressing FIXME: use locale to determine blank characters
-inline int isblank_l( int __c, locale_t /*loc*/ )
-{
- return ( __c == ' ' || __c == '\t' );
-}
-inline int iswblank_l( wint_t __c, locale_t /*loc*/ )
-{
- return ( __c == L' ' || __c == L'\t' );
-}
+inline int isblank_l(int __c, locale_t /*loc*/) { return (__c == ' ' || __c == '\t'); }
+inline int iswblank_l(wint_t __c, locale_t /*loc*/) { return (__c == L' ' || __c == L'\t'); }
#endif // _LIBCPP___SUPPORT_WIN32_LOCALE_WIN32_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h
index 4b3caa895fe..f7d4d5ce3f1 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h
@@ -17,7 +17,7 @@ extern "C" {
#endif
// Patch over lack of extended locale support
-typedef void *locale_t;
+typedef void* locale_t;
inline _LIBCPP_HIDE_FROM_ABI_C locale_t duplocale(locale_t) { return NULL; }
@@ -27,18 +27,14 @@ inline _LIBCPP_HIDE_FROM_ABI_C locale_t newlocale(int, const char*, locale_t) {
inline _LIBCPP_HIDE_FROM_ABI_C locale_t uselocale(locale_t) { return NULL; }
-#define LC_COLLATE_MASK (1 << LC_COLLATE)
-#define LC_CTYPE_MASK (1 << LC_CTYPE)
+#define LC_COLLATE_MASK (1 << LC_COLLATE)
+#define LC_CTYPE_MASK (1 << LC_CTYPE)
#define LC_MESSAGES_MASK (1 << LC_MESSAGES)
#define LC_MONETARY_MASK (1 << LC_MONETARY)
-#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
-#define LC_TIME_MASK (1 << LC_TIME)
-#define LC_ALL_MASK (LC_COLLATE_MASK|\
- LC_CTYPE_MASK|\
- LC_MONETARY_MASK|\
- LC_NUMERIC_MASK|\
- LC_TIME_MASK|\
- LC_MESSAGES_MASK)
+#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
+#define LC_TIME_MASK (1 << LC_TIME)
+#define LC_ALL_MASK \
+ (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK | LC_MESSAGES_MASK)
#ifdef __cplusplus
} // extern "C"