aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/cxxsupp/libcxx/include/__support
diff options
context:
space:
mode:
authorAndrey Khalyavin <halyavin@gmail.com>2022-02-10 16:46:29 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:29 +0300
commitf773626848a7c7456803654292e716b83d69cc12 (patch)
treedb052dfcf9134f492bdbb962cb6c16cea58e1ed3 /contrib/libs/cxxsupp/libcxx/include/__support
parentf43ab775d197d300eb67bd4497632b909cd7c2a5 (diff)
downloadydb-f773626848a7c7456803654292e716b83d69cc12.tar.gz
Restoring authorship annotation for Andrey Khalyavin <halyavin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__support')
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h124
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h38
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h106
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/limits.h190
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/locale_mgmt_zos.h106
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/nanosleep.h112
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/support.h100
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h258
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h88
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h46
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/openbsd/xlocale.h38
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/solaris/floatingpoint.h20
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/solaris/wchar.h84
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h146
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/win32/atomic_win32.h2270
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/win32/limits_msvc_win32.h134
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h510
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__nop_locale_mgmt.h96
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h310
-rw-r--r--contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h118
20 files changed, 2447 insertions, 2447 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 733eb83642..8624c56611 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/android/locale_bionic.h
@@ -1,71 +1,71 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
-#define _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
-
-#if defined(__BIONIC__)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdlib.h>
-#include <xlocale.h>
-
-#ifdef __cplusplus
-}
-#endif
-
-#if defined(__ANDROID__)
-
-#include <android/api-level.h>
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
+#define _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
+
+#if defined(__BIONIC__)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdlib.h>
+#include <xlocale.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#if defined(__ANDROID__)
+
+#include <android/api-level.h>
#if defined(__has_include) && __has_include(<android/ndk-version.h>)
# include <android/ndk-version.h>
#endif
-#if __ANDROID_API__ < 21
-#include <__support/xlocale/__posix_l_fallback.h>
-#endif
-// 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,
+#if __ANDROID_API__ < 21
+#include <__support/xlocale/__posix_l_fallback.h>
+#endif
+// 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,
+ 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,
+ 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
+ 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/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h
index e8def81480..7ecdf8096e 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/fuchsia/xlocale.h
@@ -1,22 +1,22 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
-#define _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
-
-#if defined(__Fuchsia__)
-
-#include <cstdlib>
-#include <cwchar>
-#include <__support/xlocale/__posix_l_fallback.h>
-#include <__support/xlocale/__strtonum_fallback.h>
-
-#endif // defined(__Fuchsia__)
-
-#endif // _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
+#define _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
+
+#if defined(__Fuchsia__)
+
+#include <cstdlib>
+#include <cwchar>
+#include <__support/xlocale/__posix_l_fallback.h>
+#include <__support/xlocale/__strtonum_fallback.h>
+
+#endif // defined(__Fuchsia__)
+
+#endif // _LIBCPP_SUPPORT_FUCHSIA_XLOCALE_H
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 46e02a6c8b..f4f70d5aae 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/gettod_zos.h
@@ -1,53 +1,53 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_IBM_GETTOD_ZOS_H
-#define _LIBCPP_SUPPORT_IBM_GETTOD_ZOS_H
-
-#include <time.h>
-
-static inline 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.
-
- struct _t {
- uint64_t Hi;
- uint64_t Lo;
- };
- struct _t Value = {0, 0};
- uint64_t CC = 0;
- asm(" stcke %0\n"
- " ipm %1\n"
- " srlg %1,%1,28\n"
- : "=m"(Value), "+r"(CC)::);
-
- if (CC != 0) {
- errno = EMVSTODNOTSET;
- return CC;
- }
- uint64_t us = (Value.Hi >> 4);
- uint64_t ns = ((Value.Hi & 0x0F) << 8) + (Value.Lo >> 56);
- 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;
- uint64_t Divisor = 1000000;
- asm(" dlgr %0,%2" : "+r"(DivPair0), "+r"(DivPair1) : "r"(Divisor) :);
-
- Output->tv_sec = DivPair1;
- Output->tv_nsec = DivPair0 * 1000 + ns;
- return 0;
-}
-
-#endif // _LIBCPP_SUPPORT_IBM_GETTOD_ZOS_H
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_IBM_GETTOD_ZOS_H
+#define _LIBCPP_SUPPORT_IBM_GETTOD_ZOS_H
+
+#include <time.h>
+
+static inline 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.
+
+ struct _t {
+ uint64_t Hi;
+ uint64_t Lo;
+ };
+ struct _t Value = {0, 0};
+ uint64_t CC = 0;
+ asm(" stcke %0\n"
+ " ipm %1\n"
+ " srlg %1,%1,28\n"
+ : "=m"(Value), "+r"(CC)::);
+
+ if (CC != 0) {
+ errno = EMVSTODNOTSET;
+ return CC;
+ }
+ uint64_t us = (Value.Hi >> 4);
+ uint64_t ns = ((Value.Hi & 0x0F) << 8) + (Value.Lo >> 56);
+ 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;
+ uint64_t Divisor = 1000000;
+ asm(" dlgr %0,%2" : "+r"(DivPair0), "+r"(DivPair1) : "r"(Divisor) :);
+
+ Output->tv_sec = DivPair1;
+ Output->tv_nsec = DivPair0 * 1000 + ns;
+ return 0;
+}
+
+#endif // _LIBCPP_SUPPORT_IBM_GETTOD_ZOS_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/limits.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/limits.h
index 45f1f1e368..3ef86e164b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/limits.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/limits.h
@@ -1,98 +1,98 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H
-#define _LIBCPP_SUPPORT_IBM_LIMITS_H
-
-#if !defined(_AIX) // Linux
-#include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN
-
-static const unsigned int _QNAN_F = 0x7fc00000;
-#define NANF (*((float *)(&_QNAN_F)))
-static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0};
-#define NANL (*((long double *)(&_QNAN_LDBL128)))
-static const unsigned int _SNAN_F= 0x7f855555;
-#define NANSF (*((float *)(&_SNAN_F)))
-static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555};
-#define NANS (*((double *)(&_SNAN_D)))
-static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0};
-#define NANSL (*((long double *)(&_SNAN_LDBL128)))
-
-#define __builtin_huge_val() HUGE_VAL
-#define __builtin_huge_valf() HUGE_VALF
-#define __builtin_huge_vall() HUGE_VALL
-#define __builtin_nan(__dummy) NAN
-#define __builtin_nanf(__dummy) NANF
-#define __builtin_nanl(__dummy) NANL
-#define __builtin_nans(__dummy) NANS
-#define __builtin_nansf(__dummy) NANSF
-#define __builtin_nansl(__dummy) NANSL
-
-#else
-
-#include <math.h>
-#include <float.h> // limit constants
-
-#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000
-#define __builtin_huge_valf() HUGE_VALF //0x7f800000
-#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000
-#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000
-#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000
-#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000
-#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555
-#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555
-#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555
-
-#define __FLT_MANT_DIG__ FLT_MANT_DIG
-#define __FLT_DIG__ FLT_DIG
-#define __FLT_RADIX__ FLT_RADIX
-#define __FLT_MIN_EXP__ FLT_MIN_EXP
-#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
-#define __FLT_MAX_EXP__ FLT_MAX_EXP
-#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
-#define __FLT_MIN__ FLT_MIN
-#define __FLT_MAX__ FLT_MAX
-#define __FLT_EPSILON__ FLT_EPSILON
-// predefined by XLC on LoP
-#define __FLT_DENORM_MIN__ 1.40129846e-45F
-
-#define __DBL_MANT_DIG__ DBL_MANT_DIG
-#define __DBL_DIG__ DBL_DIG
-#define __DBL_MIN_EXP__ DBL_MIN_EXP
-#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
-#define __DBL_MAX_EXP__ DBL_MAX_EXP
-#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
-#define __DBL_MIN__ DBL_MIN
-#define __DBL_MAX__ DBL_MAX
-#define __DBL_EPSILON__ DBL_EPSILON
-// predefined by XLC on LoP
-#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
-
-#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
-#define __LDBL_DIG__ LDBL_DIG
-#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
-#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
-#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
-#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
-#define __LDBL_MIN__ LDBL_MIN
-#define __LDBL_MAX__ LDBL_MAX
-#define __LDBL_EPSILON__ LDBL_EPSILON
-// predefined by XLC on LoP
-#if __LONGDOUBLE128
-#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
-#else
-#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
-#endif
-
-// predefined by XLC on LoP
-#define __CHAR_BIT__ 8
-
-#endif // _AIX
-
-#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H
+#define _LIBCPP_SUPPORT_IBM_LIMITS_H
+
+#if !defined(_AIX) // Linux
+#include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN
+
+static const unsigned int _QNAN_F = 0x7fc00000;
+#define NANF (*((float *)(&_QNAN_F)))
+static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0};
+#define NANL (*((long double *)(&_QNAN_LDBL128)))
+static const unsigned int _SNAN_F= 0x7f855555;
+#define NANSF (*((float *)(&_SNAN_F)))
+static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555};
+#define NANS (*((double *)(&_SNAN_D)))
+static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0};
+#define NANSL (*((long double *)(&_SNAN_LDBL128)))
+
+#define __builtin_huge_val() HUGE_VAL
+#define __builtin_huge_valf() HUGE_VALF
+#define __builtin_huge_vall() HUGE_VALL
+#define __builtin_nan(__dummy) NAN
+#define __builtin_nanf(__dummy) NANF
+#define __builtin_nanl(__dummy) NANL
+#define __builtin_nans(__dummy) NANS
+#define __builtin_nansf(__dummy) NANSF
+#define __builtin_nansl(__dummy) NANSL
+
+#else
+
+#include <math.h>
+#include <float.h> // limit constants
+
+#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000
+#define __builtin_huge_valf() HUGE_VALF //0x7f800000
+#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000
+#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000
+#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000
+#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000
+#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555
+#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555
+#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555
+
+#define __FLT_MANT_DIG__ FLT_MANT_DIG
+#define __FLT_DIG__ FLT_DIG
+#define __FLT_RADIX__ FLT_RADIX
+#define __FLT_MIN_EXP__ FLT_MIN_EXP
+#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
+#define __FLT_MAX_EXP__ FLT_MAX_EXP
+#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
+#define __FLT_MIN__ FLT_MIN
+#define __FLT_MAX__ FLT_MAX
+#define __FLT_EPSILON__ FLT_EPSILON
+// predefined by XLC on LoP
+#define __FLT_DENORM_MIN__ 1.40129846e-45F
+
+#define __DBL_MANT_DIG__ DBL_MANT_DIG
+#define __DBL_DIG__ DBL_DIG
+#define __DBL_MIN_EXP__ DBL_MIN_EXP
+#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
+#define __DBL_MAX_EXP__ DBL_MAX_EXP
+#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
+#define __DBL_MIN__ DBL_MIN
+#define __DBL_MAX__ DBL_MAX
+#define __DBL_EPSILON__ DBL_EPSILON
+// predefined by XLC on LoP
+#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+
+#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
+#define __LDBL_DIG__ LDBL_DIG
+#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
+#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
+#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
+#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
+#define __LDBL_MIN__ LDBL_MIN
+#define __LDBL_MAX__ LDBL_MAX
+#define __LDBL_EPSILON__ LDBL_EPSILON
+// predefined by XLC on LoP
+#if __LONGDOUBLE128
+#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
+#else
+#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
+#endif
+
+// predefined by XLC on LoP
+#define __CHAR_BIT__ 8
+
+#endif // _AIX
+
+#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H
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 90ad2c2c86..6e13874043 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
@@ -1,53 +1,53 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_ZOS_H
-#define _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_ZOS_H
-
-#if defined(__MVS__)
-#include <locale.h>
-#include <string>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#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)
-
-typedef struct locale_struct {
- int category_mask;
- std::string lc_collate;
- std::string lc_ctype;
- std::string lc_monetary;
- std::string lc_numeric;
- std::string lc_time;
- std::string lc_messages;
-} * locale_t;
-
-// z/OS does not have newlocale, freelocale and uselocale.
-// The functions below are workarounds in single thread mode.
-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
-}
-#endif
-#endif // defined(__MVS__)
-#endif // _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_ZOS_H
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_ZOS_H
+#define _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_ZOS_H
+
+#if defined(__MVS__)
+#include <locale.h>
+#include <string>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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)
+
+typedef struct locale_struct {
+ int category_mask;
+ std::string lc_collate;
+ std::string lc_ctype;
+ std::string lc_monetary;
+ std::string lc_numeric;
+ std::string lc_time;
+ std::string lc_messages;
+} * locale_t;
+
+// z/OS does not have newlocale, freelocale and uselocale.
+// The functions below are workarounds in single thread mode.
+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
+}
+#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 6ebcecc68a..d536290686 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/nanosleep.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/nanosleep.h
@@ -1,56 +1,56 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
-#define _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
-
-#include <unistd.h>
-
-inline int nanosleep(const struct timespec* __req, struct timespec* __rem) {
- // The nanosleep() function is not available on z/OS. Therefore, we will call
- // sleep() to sleep for whole seconds and usleep() to sleep for any remaining
- // fraction of a second. Any remaining nanoseconds will round up to the next
- // microsecond.
- if (__req->tv_sec < 0 || __req->tv_nsec < 0 || __req->tv_nsec > 999999999) {
- errno = EINVAL;
- return -1;
- }
- useconds_t __micro_sec =
- static_cast<useconds_t>((__req->tv_nsec + 999) / 1000);
- time_t __sec = __req->tv_sec;
- if (__micro_sec > 999999) {
- ++__sec;
- __micro_sec -= 1000000;
- }
- __sec = sleep(static_cast<unsigned int>(__sec));
- if (__sec) {
- if (__rem) {
- // Updating the remaining time to sleep in case of unsuccessful call to sleep().
- __rem->tv_sec = __sec;
- __rem->tv_nsec = __micro_sec * 1000;
- }
- errno = EINTR;
- return -1;
- }
- if (__micro_sec) {
- int __rt = usleep(__micro_sec);
- 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_nsec = __micro_sec * 1000;
- // The errno is already set.
- return -1;
- }
- return __rt;
- }
- return 0;
-}
-
-#endif // _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
+#define _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
+
+#include <unistd.h>
+
+inline int nanosleep(const struct timespec* __req, struct timespec* __rem) {
+ // The nanosleep() function is not available on z/OS. Therefore, we will call
+ // sleep() to sleep for whole seconds and usleep() to sleep for any remaining
+ // fraction of a second. Any remaining nanoseconds will round up to the next
+ // microsecond.
+ if (__req->tv_sec < 0 || __req->tv_nsec < 0 || __req->tv_nsec > 999999999) {
+ errno = EINVAL;
+ return -1;
+ }
+ useconds_t __micro_sec =
+ static_cast<useconds_t>((__req->tv_nsec + 999) / 1000);
+ time_t __sec = __req->tv_sec;
+ if (__micro_sec > 999999) {
+ ++__sec;
+ __micro_sec -= 1000000;
+ }
+ __sec = sleep(static_cast<unsigned int>(__sec));
+ if (__sec) {
+ if (__rem) {
+ // Updating the remaining time to sleep in case of unsuccessful call to sleep().
+ __rem->tv_sec = __sec;
+ __rem->tv_nsec = __micro_sec * 1000;
+ }
+ errno = EINTR;
+ return -1;
+ }
+ if (__micro_sec) {
+ int __rt = usleep(__micro_sec);
+ 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_nsec = __micro_sec * 1000;
+ // The errno is already set.
+ return -1;
+ }
+ return __rt;
+ }
+ return 0;
+}
+
+#endif // _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/support.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/support.h
index a7751b0176..cfa8bf91fd 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/support.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/support.h
@@ -1,53 +1,53 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_IBM_SUPPORT_H
-#define _LIBCPP_SUPPORT_IBM_SUPPORT_H
-
-extern "builtin" int __popcnt4(unsigned int);
-extern "builtin" int __popcnt8(unsigned long long);
-extern "builtin" unsigned int __cnttz4(unsigned int);
-extern "builtin" unsigned int __cnttz8(unsigned long long);
-extern "builtin" unsigned int __cntlz4(unsigned int);
-extern "builtin" unsigned int __cntlz8(unsigned long long);
-
-// Builtin functions for counting population
-#define __builtin_popcount(x) __popcnt4(x)
-#define __builtin_popcountll(x) __popcnt8(x)
-#if defined(__64BIT__)
-#define __builtin_popcountl(x) __builtin_popcountll(x)
-#else
-#define __builtin_popcountl(x) __builtin_popcount(x)
-#endif
-
-// Builtin functions for counting trailing zeros
-#define __builtin_ctz(x) __cnttz4(x)
-#define __builtin_ctzll(x) __cnttz8(x)
-#if defined(__64BIT__)
-#define __builtin_ctzl(x) __builtin_ctzll(x)
-#else
-#define __builtin_ctzl(x) __builtin_ctz(x)
-#endif
-
-// Builtin functions for counting leading zeros
-#define __builtin_clz(x) __cntlz4(x)
-#define __builtin_clzll(x) __cntlz8(x)
-#if defined(__64BIT__)
-#define __builtin_clzl(x) __builtin_clzll(x)
-#else
-#define __builtin_clzl(x) __builtin_clz(x)
-#endif
-
-#if defined(__64BIT__)
-#define __SIZE_WIDTH__ 64
-#else
-#define __SIZE_WIDTH__ 32
-#endif
-
-#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_IBM_SUPPORT_H
+#define _LIBCPP_SUPPORT_IBM_SUPPORT_H
+
+extern "builtin" int __popcnt4(unsigned int);
+extern "builtin" int __popcnt8(unsigned long long);
+extern "builtin" unsigned int __cnttz4(unsigned int);
+extern "builtin" unsigned int __cnttz8(unsigned long long);
+extern "builtin" unsigned int __cntlz4(unsigned int);
+extern "builtin" unsigned int __cntlz8(unsigned long long);
+
+// Builtin functions for counting population
+#define __builtin_popcount(x) __popcnt4(x)
+#define __builtin_popcountll(x) __popcnt8(x)
+#if defined(__64BIT__)
+#define __builtin_popcountl(x) __builtin_popcountll(x)
+#else
+#define __builtin_popcountl(x) __builtin_popcount(x)
+#endif
+
+// Builtin functions for counting trailing zeros
+#define __builtin_ctz(x) __cnttz4(x)
+#define __builtin_ctzll(x) __cnttz8(x)
+#if defined(__64BIT__)
+#define __builtin_ctzl(x) __builtin_ctzll(x)
+#else
+#define __builtin_ctzl(x) __builtin_ctz(x)
+#endif
+
+// Builtin functions for counting leading zeros
+#define __builtin_clz(x) __cntlz4(x)
+#define __builtin_clzll(x) __cntlz8(x)
+#if defined(__64BIT__)
+#define __builtin_clzl(x) __builtin_clzll(x)
+#else
+#define __builtin_clzl(x) __builtin_clz(x)
+#endif
+
+#if defined(__64BIT__)
+#define __SIZE_WIDTH__ 64
+#else
+#define __SIZE_WIDTH__ 32
+#endif
+
+#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
index 15b8386dd3..5377d75cac 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/ibm/xlocale.h
@@ -1,133 +1,133 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H
-#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
-
-#include <__support/ibm/locale_mgmt_zos.h>
-#include <stdarg.h>
-
-#include "cstdlib"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(__MVS__)
-#include <wctype.h>
-// POSIX routines
-#include <__support/xlocale/__posix_l_fallback.h>
-#endif // defined(__MVS__)
-
-namespace {
-
-struct __setAndRestore {
- explicit __setAndRestore(locale_t locale) {
- if (locale == (locale_t)0) {
- __cloc = newlocale(LC_ALL_MASK, "C", /* base */ (locale_t)0);
- __stored = uselocale(__cloc);
- } else {
- __stored = uselocale(locale);
- }
- }
-
- ~__setAndRestore() {
- uselocale(__stored);
- if (__cloc)
- freelocale(__cloc);
- }
-
-private:
- locale_t __stored = (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
-static inline
-long long strtoll_l(const char *__nptr, char **__endptr,
- int __base, locale_t locale) {
- __setAndRestore __newloc(locale);
- return strtoll(__nptr, __endptr, __base);
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H
+#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
+
+#include <__support/ibm/locale_mgmt_zos.h>
+#include <stdarg.h>
+
+#include "cstdlib"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(__MVS__)
+#include <wctype.h>
+// POSIX routines
+#include <__support/xlocale/__posix_l_fallback.h>
+#endif // defined(__MVS__)
+
+namespace {
+
+struct __setAndRestore {
+ explicit __setAndRestore(locale_t locale) {
+ if (locale == (locale_t)0) {
+ __cloc = newlocale(LC_ALL_MASK, "C", /* base */ (locale_t)0);
+ __stored = uselocale(__cloc);
+ } else {
+ __stored = uselocale(locale);
+ }
+ }
+
+ ~__setAndRestore() {
+ uselocale(__stored);
+ if (__cloc)
+ freelocale(__cloc);
+ }
+
+private:
+ locale_t __stored = (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
+static inline
+long long strtoll_l(const char *__nptr, char **__endptr,
+ int __base, locale_t locale) {
+ __setAndRestore __newloc(locale);
+ return strtoll(__nptr, __endptr, __base);
+}
+
+static inline
+long strtol_l(const char *__nptr, char **__endptr,
+ int __base, locale_t locale) {
+ __setAndRestore __newloc(locale);
+ return strtol(__nptr, __endptr, __base);
+}
+
+static inline
+double strtod_l(const char *__nptr, char **__endptr,
+ locale_t locale) {
+ __setAndRestore __newloc(locale);
+ return strtod(__nptr, __endptr);
+}
+
+static inline
+float strtof_l(const char *__nptr, char **__endptr,
+ locale_t locale) {
+ __setAndRestore __newloc(locale);
+ return strtof(__nptr, __endptr);
+}
+
+static inline
+long double strtold_l(const char *__nptr, char **__endptr,
+ locale_t locale) {
+ __setAndRestore __newloc(locale);
+ return strtold(__nptr, __endptr);
+}
+
+static inline
+unsigned long long strtoull_l(const char *__nptr, char **__endptr,
+ int __base, locale_t locale) {
+ __setAndRestore __newloc(locale);
+ return strtoull(__nptr, __endptr, __base);
+}
+
+static inline
+unsigned long strtoul_l(const char *__nptr, char **__endptr,
+ int __base, locale_t locale) {
+ __setAndRestore __newloc(locale);
+ return strtoul(__nptr, __endptr, __base);
+}
+
+static inline
+int vasprintf(char **strp, const char *fmt, va_list ap) {
+ const size_t buff_size = 256;
+ if ((*strp = (char *)malloc(buff_size)) == NULL) {
+ return -1;
+ }
+
+ va_list ap_copy;
+ // va_copy may not be provided by the C library in C++ 03 mode.
+#if defined(_LIBCPP_CXX03_LANG) && __has_builtin(__builtin_va_copy)
+ __builtin_va_copy(ap_copy, ap);
+#else
+ va_copy(ap_copy, ap);
+#endif
+ 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) {
+ return -1;
+ }
+ str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
+ }
+ return str_size;
}
-
-static inline
-long strtol_l(const char *__nptr, char **__endptr,
- int __base, locale_t locale) {
- __setAndRestore __newloc(locale);
- return strtol(__nptr, __endptr, __base);
-}
-
-static inline
-double strtod_l(const char *__nptr, char **__endptr,
- locale_t locale) {
- __setAndRestore __newloc(locale);
- return strtod(__nptr, __endptr);
-}
-
-static inline
-float strtof_l(const char *__nptr, char **__endptr,
- locale_t locale) {
- __setAndRestore __newloc(locale);
- return strtof(__nptr, __endptr);
-}
-
-static inline
-long double strtold_l(const char *__nptr, char **__endptr,
- locale_t locale) {
- __setAndRestore __newloc(locale);
- return strtold(__nptr, __endptr);
-}
-
-static inline
-unsigned long long strtoull_l(const char *__nptr, char **__endptr,
- int __base, locale_t locale) {
- __setAndRestore __newloc(locale);
- return strtoull(__nptr, __endptr, __base);
-}
-
-static inline
-unsigned long strtoul_l(const char *__nptr, char **__endptr,
- int __base, locale_t locale) {
- __setAndRestore __newloc(locale);
- return strtoul(__nptr, __endptr, __base);
-}
-
-static inline
-int vasprintf(char **strp, const char *fmt, va_list ap) {
- const size_t buff_size = 256;
- if ((*strp = (char *)malloc(buff_size)) == NULL) {
- return -1;
- }
-
- va_list ap_copy;
- // va_copy may not be provided by the C library in C++ 03 mode.
-#if defined(_LIBCPP_CXX03_LANG) && __has_builtin(__builtin_va_copy)
- __builtin_va_copy(ap_copy, ap);
-#else
- va_copy(ap_copy, ap);
-#endif
- 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) {
- return -1;
- }
- str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
- }
- return str_size;
-}
-
-#ifdef __cplusplus
-}
-#endif
-#endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H
+
+#ifdef __cplusplus
+}
+#endif
+#endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h
index e91701afd5..17d3859b5c 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/musl/xlocale.h
@@ -1,47 +1,47 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-// This adds support for the extended locale functions that are currently
-// missing from the Musl C library.
-//
-// This only works when the specified locale is "C" or "POSIX", but that's
-// about as good as we can do without implementing full xlocale support
-// in Musl.
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_MUSL_XLOCALE_H
-#define _LIBCPP_SUPPORT_MUSL_XLOCALE_H
-
-#include <cstdlib>
-#include <cwchar>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
- int base, locale_t) {
- return wcstoll(nptr, endptr, base);
-}
-
-static inline unsigned long long wcstoull_l(const wchar_t *nptr,
- wchar_t **endptr, int base,
- locale_t) {
- return wcstoull(nptr, endptr, base);
-}
-
-static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
- locale_t) {
- return wcstold(nptr, endptr);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LIBCPP_SUPPORT_MUSL_XLOCALE_H
+//
+//===----------------------------------------------------------------------===//
+// This adds support for the extended locale functions that are currently
+// missing from the Musl C library.
+//
+// This only works when the specified locale is "C" or "POSIX", but that's
+// about as good as we can do without implementing full xlocale support
+// in Musl.
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_MUSL_XLOCALE_H
+#define _LIBCPP_SUPPORT_MUSL_XLOCALE_H
+
+#include <cstdlib>
+#include <cwchar>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
+ int base, locale_t) {
+ return wcstoll(nptr, endptr, base);
+}
+
+static inline unsigned long long wcstoull_l(const wchar_t *nptr,
+ wchar_t **endptr, int base,
+ locale_t) {
+ return wcstoull(nptr, endptr, base);
+}
+
+static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
+ locale_t) {
+ return wcstold(nptr, endptr);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _LIBCPP_SUPPORT_MUSL_XLOCALE_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h
index b75f9263a4..97a9be101b 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/newlib/xlocale.h
@@ -1,27 +1,27 @@
-//===----------------------------------------------------------------------===//
-//
+//===----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
-#define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
-
-#if defined(_NEWLIB_VERSION)
-
-#include <cstdlib>
-#include <clocale>
-#include <cwctype>
-#include <ctype.h>
-#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
-
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
+#define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
+
+#if defined(_NEWLIB_VERSION)
+
+#include <cstdlib>
+#include <clocale>
+#include <cwctype>
+#include <ctype.h>
+#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
+
+#endif
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/openbsd/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/openbsd/xlocale.h
index 49d66fde1e..927d87f4c5 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/openbsd/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/openbsd/xlocale.h
@@ -1,19 +1,19 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_OPENBSD_XLOCALE_H
-#define _LIBCPP_SUPPORT_OPENBSD_XLOCALE_H
-
-#include <__support/xlocale/__strtonum_fallback.h>
-#include <clocale>
-#include <cstdlib>
-#include <ctype.h>
-#include <cwctype>
-
-#endif
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_OPENBSD_XLOCALE_H
+#define _LIBCPP_SUPPORT_OPENBSD_XLOCALE_H
+
+#include <__support/xlocale/__strtonum_fallback.h>
+#include <clocale>
+#include <cstdlib>
+#include <ctype.h>
+#include <cwctype>
+
+#endif
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/solaris/floatingpoint.h b/contrib/libs/cxxsupp/libcxx/include/__support/solaris/floatingpoint.h
index 5f1628fbe4..c5c626ba3e 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/solaris/floatingpoint.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/solaris/floatingpoint.h
@@ -1,13 +1,13 @@
-//===----------------------------------------------------------------------===//
-//
+//===----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#define atof sun_atof
-#define strtod sun_strtod
-#include_next "floatingpoint.h"
-#undef atof
-#undef strtod
+//
+//===----------------------------------------------------------------------===//
+
+#define atof sun_atof
+#define strtod sun_strtod
+#include_next "floatingpoint.h"
+#undef atof
+#undef strtod
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/solaris/wchar.h b/contrib/libs/cxxsupp/libcxx/include/__support/solaris/wchar.h
index f01fd743a2..641fceb7a4 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/solaris/wchar.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/solaris/wchar.h
@@ -1,46 +1,46 @@
-//===----------------------------------------------------------------------===//
-//
+//===----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#define iswalpha sun_iswalpha
-#define iswupper sun_iswupper
-#define iswlower sun_iswlower
-#define iswdigit sun_iswdigit
-#define iswxdigit sun_iswxdigit
-#define iswalnum sun_iswalnum
-#define iswspace sun_iswspace
-#define iswpunct sun_iswpunct
-#define iswprint sun_iswprint
-#define iswgraph sun_iswgraph
-#define iswcntrl sun_iswcntrl
-#define iswctype sun_iswctype
-#define towlower sun_towlower
-#define towupper sun_towupper
-#define wcswcs sun_wcswcs
-#define wcswidth sun_wcswidth
-#define wcwidth sun_wcwidth
-#define wctype sun_wctype
-#define _WCHAR_T 1
-#include_next "wchar.h"
+//
+//===----------------------------------------------------------------------===//
+
+#define iswalpha sun_iswalpha
+#define iswupper sun_iswupper
+#define iswlower sun_iswlower
+#define iswdigit sun_iswdigit
+#define iswxdigit sun_iswxdigit
+#define iswalnum sun_iswalnum
+#define iswspace sun_iswspace
+#define iswpunct sun_iswpunct
+#define iswprint sun_iswprint
+#define iswgraph sun_iswgraph
+#define iswcntrl sun_iswcntrl
+#define iswctype sun_iswctype
+#define towlower sun_towlower
+#define towupper sun_towupper
+#define wcswcs sun_wcswcs
+#define wcswidth sun_wcswidth
+#define wcwidth sun_wcwidth
+#define wctype sun_wctype
+#define _WCHAR_T 1
+#include_next "wchar.h"
#undef iswalpha
-#undef iswupper
-#undef iswlower
-#undef iswdigit
-#undef iswxdigit
-#undef iswalnum
-#undef iswspace
-#undef iswpunct
-#undef iswprint
-#undef iswgraph
-#undef iswcntrl
-#undef iswctype
-#undef towlower
-#undef towupper
-#undef wcswcs
-#undef wcswidth
-#undef wcwidth
-#undef wctype
+#undef iswupper
+#undef iswlower
+#undef iswdigit
+#undef iswxdigit
+#undef iswalnum
+#undef iswspace
+#undef iswpunct
+#undef iswprint
+#undef iswgraph
+#undef iswcntrl
+#undef iswctype
+#undef towlower
+#undef towupper
+#undef wcswcs
+#undef wcswidth
+#undef wcwidth
+#undef wctype
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h b/contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h
index 05131f0272..5247f1f04f 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/solaris/xlocale.h
@@ -1,76 +1,76 @@
-//===----------------------------------------------------------------------===//
-//
+//===----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-////////////////////////////////////////////////////////////////////////////////
-// Minimal xlocale implementation for Solaris. This implements the subset of
-// the xlocale APIs that libc++ depends on.
-////////////////////////////////////////////////////////////////////////////////
-#ifndef __XLOCALE_H_INCLUDED
-#define __XLOCALE_H_INCLUDED
-
-#include <stdlib.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
-int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
-
-int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
-
-int toupper_l(int __c, locale_t __l);
-int tolower_l(int __c, locale_t __l);
-
-struct lconv *localeconv(void);
-struct lconv *localeconv_l(locale_t __l);
-
-// FIXME: These are quick-and-dirty hacks to make things pretend to work
-static inline
-long long strtoll_l(const char *__nptr, char **__endptr,
- int __base, locale_t __loc) {
- return strtoll(__nptr, __endptr, __base);
-}
-static inline
-long strtol_l(const char *__nptr, char **__endptr,
- int __base, locale_t __loc) {
- return strtol(__nptr, __endptr, __base);
-}
-static inline
-unsigned long long strtoull_l(const char *__nptr, char **__endptr,
- int __base, locale_t __loc) {
- return strtoull(__nptr, __endptr, __base);
-}
-static inline
-unsigned long strtoul_l(const char *__nptr, char **__endptr,
- int __base, locale_t __loc) {
- return strtoul(__nptr, __endptr, __base);
-}
-static inline
-float strtof_l(const char *__nptr, char **__endptr,
- locale_t __loc) {
- return strtof(__nptr, __endptr);
-}
-static inline
-double strtod_l(const char *__nptr, char **__endptr,
- locale_t __loc) {
- return strtod(__nptr, __endptr);
-}
-static inline
-long double strtold_l(const char *__nptr, char **__endptr,
- locale_t __loc) {
- return strtold(__nptr, __endptr);
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+//
+//===----------------------------------------------------------------------===//
+
+////////////////////////////////////////////////////////////////////////////////
+// Minimal xlocale implementation for Solaris. This implements the subset of
+// the xlocale APIs that libc++ depends on.
+////////////////////////////////////////////////////////////////////////////////
+#ifndef __XLOCALE_H_INCLUDED
+#define __XLOCALE_H_INCLUDED
+
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
+int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
+
+int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
+
+int toupper_l(int __c, locale_t __l);
+int tolower_l(int __c, locale_t __l);
+
+struct lconv *localeconv(void);
+struct lconv *localeconv_l(locale_t __l);
+
+// FIXME: These are quick-and-dirty hacks to make things pretend to work
+static inline
+long long strtoll_l(const char *__nptr, char **__endptr,
+ int __base, locale_t __loc) {
+ return strtoll(__nptr, __endptr, __base);
+}
+static inline
+long strtol_l(const char *__nptr, char **__endptr,
+ int __base, locale_t __loc) {
+ return strtol(__nptr, __endptr, __base);
+}
+static inline
+unsigned long long strtoull_l(const char *__nptr, char **__endptr,
+ int __base, locale_t __loc) {
+ return strtoull(__nptr, __endptr, __base);
+}
+static inline
+unsigned long strtoul_l(const char *__nptr, char **__endptr,
+ int __base, locale_t __loc) {
+ return strtoul(__nptr, __endptr, __base);
+}
+static inline
+float strtof_l(const char *__nptr, char **__endptr,
+ locale_t __loc) {
+ return strtof(__nptr, __endptr);
+}
+static inline
+double strtod_l(const char *__nptr, char **__endptr,
+ locale_t __loc) {
+ return strtod(__nptr, __endptr);
+}
+static inline
+long double strtold_l(const char *__nptr, char **__endptr,
+ locale_t __loc) {
+ return strtold(__nptr, __endptr);
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/win32/atomic_win32.h b/contrib/libs/cxxsupp/libcxx/include/__support/win32/atomic_win32.h
index e32bcf9073..f3515fca00 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/win32/atomic_win32.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/win32/atomic_win32.h
@@ -1,1164 +1,1164 @@
-#ifndef _LIBCPP_ATOMIC_WIN32
-#define _LIBCPP_ATOMIC_WIN32
-
-#include <__config>
-#include <type_traits>
-#include <intrin.h>
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-#define _Atomic(x) x
-
-#ifdef _M_ARM
-#define _MemoryBarrier __dmb(_ARM_BARRIER_ISH)
-#endif
-
-#ifdef _M_ARM64
-#define _MemoryBarrier __dmb(_ARM64_BARRIER_ISH)
-#endif
-
-#ifdef _M_X64
-#define _MemoryBarrier __faststorefence()
-#endif
-
-#ifdef _M_IX86
-#define _MemoryBarrier _mm_mfence()
-#endif
-
-namespace __atomic {
-template <typename _Tp> _Tp __create();
-
-template <typename _Tp, typename _Td>
+#ifndef _LIBCPP_ATOMIC_WIN32
+#define _LIBCPP_ATOMIC_WIN32
+
+#include <__config>
+#include <type_traits>
+#include <intrin.h>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#define _Atomic(x) x
+
+#ifdef _M_ARM
+#define _MemoryBarrier __dmb(_ARM_BARRIER_ISH)
+#endif
+
+#ifdef _M_ARM64
+#define _MemoryBarrier __dmb(_ARM64_BARRIER_ISH)
+#endif
+
+#ifdef _M_X64
+#define _MemoryBarrier __faststorefence()
+#endif
+
+#ifdef _M_IX86
+#define _MemoryBarrier _mm_mfence()
+#endif
+
+namespace __atomic {
+template <typename _Tp> _Tp __create();
+
+template <typename _Tp, typename _Td>
enable_if_t<sizeof(__create<_Tp>() = __create<_Td>()), char>
- __test_atomic_assignable(int);
-template <typename _Tp, typename _Up>
-__two __test_atomic_assignable(...);
-
-template <typename _Tp, typename _Td>
-struct __can_assign {
- static const bool value =
- sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
-};
-} // namespace __atomic
-
-template <typename _Tp>
-static inline enable_if_t<is_assignable<volatile _Tp, _Tp>::value>
-__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) {
- *__a = __val;
-}
-
-template <typename _Tp>
-static inline enable_if_t<!is_assignable<volatile _Tp, _Tp>::value>
-__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) {
- volatile char* to = reinterpret_cast<volatile char*>(__a);
- volatile char* end = to + sizeof(_Tp);
- char* from = reinterpret_cast<char*>(&__val);
- while (to != end) {
- *to++ = *from++;
- }
-}
-
-template <typename _Tp>
-static inline void __c11_atomic_init(_Atomic(_Tp)* __a, _Tp __val) {
- *__a = __val;
-}
-
-static inline void __c11_atomic_thread_fence(int __order) {
+ __test_atomic_assignable(int);
+template <typename _Tp, typename _Up>
+__two __test_atomic_assignable(...);
+
+template <typename _Tp, typename _Td>
+struct __can_assign {
+ static const bool value =
+ sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
+};
+} // namespace __atomic
+
+template <typename _Tp>
+static inline enable_if_t<is_assignable<volatile _Tp, _Tp>::value>
+__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) {
+ *__a = __val;
+}
+
+template <typename _Tp>
+static inline enable_if_t<!is_assignable<volatile _Tp, _Tp>::value>
+__c11_atomic_init(volatile _Atomic(_Tp)* __a, _Tp __val) {
+ volatile char* to = reinterpret_cast<volatile char*>(__a);
+ volatile char* end = to + sizeof(_Tp);
+ char* from = reinterpret_cast<char*>(&__val);
+ while (to != end) {
+ *to++ = *from++;
+ }
+}
+
+template <typename _Tp>
+static inline void __c11_atomic_init(_Atomic(_Tp)* __a, _Tp __val) {
+ *__a = __val;
+}
+
+static inline void __c11_atomic_thread_fence(int __order) {
if (__order != static_cast<int>(memory_order_relaxed)) {
-#if defined(_M_IX86) || defined(_M_X64)
+#if defined(_M_IX86) || defined(_M_X64)
if (__order == static_cast<int>(memory_order_seq_cst)) {
- _MemoryBarrier;
- } else {
- _ReadWriteBarrier();
- }
-#else // ARM
- _MemoryBarrier;
-#endif
- }
-}
-
-static inline void __c11_atomic_signal_fence(int /*__order*/) {
- _ReadWriteBarrier();
-}
-
-void __msvc_lock(void* p);
-void __msvc_unlock(void* p);
-
-template<class _Out, class _Tp>
-static inline _Out __msvc_cast(_Tp __val) {
- _Out __result;
- volatile char* to = reinterpret_cast<volatile char*>(&__result);
- volatile char* end = to + sizeof(_Tp);
- char* from = reinterpret_cast<char*>(&__val);
- while (to != end) {
- *to++ = *from++;
- }
- return __result;
-}
-
-
-
-static inline void __msvc_atomic_store8(volatile char* __a, char __val,
- memory_order __order) {
- if (__order == memory_order_relaxed) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __iso_volatile_store8(__a, __val);
-#else
- *__a = __val;
-#endif
- } else if (__order == memory_order_release) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __iso_volatile_store8(__a, __val);
-#else
- _ReadWriteBarrier();
- *__a = __val;
-#endif
- } else { // __order == memory_order_seq_cst)
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __iso_volatile_store8(__a, __val);
- _MemoryBarrier;
-#else
- _InterlockedExchange8(__a, __val);
-#endif
- }
-}
-
-static inline void __msvc_atomic_store16(volatile short* __a, short __val,
- memory_order __order) {
- if (__order == memory_order_relaxed) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __iso_volatile_store16(__a, __val);
-#else
- *__a = __val;
-#endif
- } else if (__order == memory_order_release) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __iso_volatile_store16(__a, __val);
-#else
- _ReadWriteBarrier();
- *__a = __val;
-#endif
- } else { // __order == memory_order_seq_cst)
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __iso_volatile_store16(__a, __val);
- _MemoryBarrier;
-#else
- _InterlockedExchange16(__a, __val);
-#endif
+ _MemoryBarrier;
+ } else {
+ _ReadWriteBarrier();
+ }
+#else // ARM
+ _MemoryBarrier;
+#endif
+ }
+}
+
+static inline void __c11_atomic_signal_fence(int /*__order*/) {
+ _ReadWriteBarrier();
+}
+
+void __msvc_lock(void* p);
+void __msvc_unlock(void* p);
+
+template<class _Out, class _Tp>
+static inline _Out __msvc_cast(_Tp __val) {
+ _Out __result;
+ volatile char* to = reinterpret_cast<volatile char*>(&__result);
+ volatile char* end = to + sizeof(_Tp);
+ char* from = reinterpret_cast<char*>(&__val);
+ while (to != end) {
+ *to++ = *from++;
}
-}
-
-static inline void __msvc_atomic_store32(volatile long* __a, long __val,
- memory_order __order) {
- if (__order == memory_order_relaxed) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __iso_volatile_store32(__a, __val);
-#else
- *__a = __val;
-#endif
- } else if (__order == memory_order_release) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __iso_volatile_store32(__a, __val);
-#else
- _ReadWriteBarrier();
- *__a = __val;
-#endif
- } else { // __order == memory_order_seq_cst)
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __iso_volatile_store32(__a, __val);
- _MemoryBarrier;
-#else
- _InterlockedExchange(__a, __val);
-#endif
- }
-}
-
-static inline void __msvc_atomic_store64(volatile __int64* __a, __int64 __val,
- memory_order __order) {
-#if defined(_M_IX86)
- __int64 __tmp;
- do {
- __tmp = *__a;
- } while (__tmp != _InterlockedCompareExchange64(__a, __val, __tmp));
-#else
- if (__order == memory_order_relaxed) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __iso_volatile_store64(__a, __val);
-#else
- *__a = __val;
-#endif
- } else if (__order == memory_order_release) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __iso_volatile_store64(__a, __val);
-#else
- _ReadWriteBarrier();
- *__a = __val;
-#endif
- } else { // __order == memory_order_seq_cst)
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __iso_volatile_store64(__a, __val);
- _MemoryBarrier;
-#else
- _InterlockedExchange64(__a, __val);
-#endif
- }
-#endif
-}
-
-template <typename _Tp>
-static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val,
- int __order) {
- if (sizeof(_Tp) == 1) {
- __msvc_atomic_store8((volatile char*)__a, __msvc_cast<char>(__val), (memory_order)__order);
- } else if (sizeof(_Tp) == 2 && alignof(_Tp) % 2 == 0) {
- __msvc_atomic_store16((volatile short*)__a, __msvc_cast<short>(__val), (memory_order)__order);
- } else if (sizeof(_Tp) == 4 && alignof(_Tp) % 4 == 0) {
- __msvc_atomic_store32((volatile long*)__a, __msvc_cast<long>(__val), (memory_order)__order);
- } else if (sizeof(_Tp) == 8 && alignof(_Tp) % 8 == 0) {
- __msvc_atomic_store64((volatile __int64*)__a, __msvc_cast<__int64>(__val), (memory_order)__order);
- } else {
- __msvc_lock((void*)__a);
- *(_Atomic(_Tp)*)__a = __val;
- __msvc_unlock((void*)__a);
- }
-}
-
-template<typename _Tp>
-static inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val, int __order) {
- __c11_atomic_store((volatile _Atomic(_Tp)*)__a, __val, __order);
-}
-
-static inline char __msvc_atomic_load8(volatile char* __a, memory_order __order) {
- char __result;
- if (__order == memory_order_relaxed) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __result = __iso_volatile_load8(__a);
-#else
- __result = *__a;
-#endif
- } else if (__order == memory_order_acquire ||
- __order == memory_order_consume) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __result = __iso_volatile_load8(__a);
- _MemoryBarrier;
-#else
- __result = *__a;
- _ReadWriteBarrier();
-#endif
- } else { // __order == memory_order_seq_cst
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __result = __iso_volatile_load8(__a);
- _MemoryBarrier;
-#else
- _ReadWriteBarrier();
- __result = *__a;
- _ReadWriteBarrier();
+ return __result;
+}
+
+
+
+static inline void __msvc_atomic_store8(volatile char* __a, char __val,
+ memory_order __order) {
+ if (__order == memory_order_relaxed) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __iso_volatile_store8(__a, __val);
+#else
+ *__a = __val;
+#endif
+ } else if (__order == memory_order_release) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __iso_volatile_store8(__a, __val);
+#else
+ _ReadWriteBarrier();
+ *__a = __val;
+#endif
+ } else { // __order == memory_order_seq_cst)
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __iso_volatile_store8(__a, __val);
+ _MemoryBarrier;
+#else
+ _InterlockedExchange8(__a, __val);
+#endif
+ }
+}
+
+static inline void __msvc_atomic_store16(volatile short* __a, short __val,
+ memory_order __order) {
+ if (__order == memory_order_relaxed) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __iso_volatile_store16(__a, __val);
+#else
+ *__a = __val;
+#endif
+ } else if (__order == memory_order_release) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __iso_volatile_store16(__a, __val);
+#else
+ _ReadWriteBarrier();
+ *__a = __val;
+#endif
+ } else { // __order == memory_order_seq_cst)
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __iso_volatile_store16(__a, __val);
+ _MemoryBarrier;
+#else
+ _InterlockedExchange16(__a, __val);
+#endif
+ }
+}
+
+static inline void __msvc_atomic_store32(volatile long* __a, long __val,
+ memory_order __order) {
+ if (__order == memory_order_relaxed) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __iso_volatile_store32(__a, __val);
+#else
+ *__a = __val;
+#endif
+ } else if (__order == memory_order_release) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __iso_volatile_store32(__a, __val);
+#else
+ _ReadWriteBarrier();
+ *__a = __val;
+#endif
+ } else { // __order == memory_order_seq_cst)
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __iso_volatile_store32(__a, __val);
+ _MemoryBarrier;
+#else
+ _InterlockedExchange(__a, __val);
+#endif
+ }
+}
+
+static inline void __msvc_atomic_store64(volatile __int64* __a, __int64 __val,
+ memory_order __order) {
+#if defined(_M_IX86)
+ __int64 __tmp;
+ do {
+ __tmp = *__a;
+ } while (__tmp != _InterlockedCompareExchange64(__a, __val, __tmp));
+#else
+ if (__order == memory_order_relaxed) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __iso_volatile_store64(__a, __val);
+#else
+ *__a = __val;
+#endif
+ } else if (__order == memory_order_release) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __iso_volatile_store64(__a, __val);
+#else
+ _ReadWriteBarrier();
+ *__a = __val;
+#endif
+ } else { // __order == memory_order_seq_cst)
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __iso_volatile_store64(__a, __val);
+ _MemoryBarrier;
+#else
+ _InterlockedExchange64(__a, __val);
+#endif
+ }
#endif
- }
- return __result;
-}
-
-static inline short __msvc_atomic_load16(volatile short* __a, memory_order __order) {
- short __result;
- if (__order == memory_order_relaxed) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __result = __iso_volatile_load16(__a);
-#else
- __result = *__a;
-#endif
- } else if (__order == memory_order_acquire ||
- __order == memory_order_consume) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __result = __iso_volatile_load16(__a);
- _MemoryBarrier;
-#else
- __result = *__a;
- _ReadWriteBarrier();
-#endif
- } else { // __order == memory_order_seq_cst
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __result = __iso_volatile_load16(__a);
- _MemoryBarrier;
-#else
- _ReadWriteBarrier();
- __result = *__a;
- _ReadWriteBarrier();
-#endif
- }
- return __result;
-}
-
-static inline long __msvc_atomic_load32(volatile long* __a, memory_order __order) {
- long __result;
- if (__order == memory_order_relaxed) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __result = __iso_volatile_load32(__a);
-#else
- __result = *__a;
-#endif
- } else if (__order == memory_order_acquire ||
- __order == memory_order_consume) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __result = __iso_volatile_load32(__a);
- _MemoryBarrier;
-#else
- __result = *__a;
- _ReadWriteBarrier();
-#endif
- } else { // __order == memory_order_seq_cst
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __result = __iso_volatile_load32(__a);
- _MemoryBarrier;
-#else
- _ReadWriteBarrier();
- __result = *__a;
- _ReadWriteBarrier();
-#endif
- }
- return __result;
-}
-
-static inline __int64 __msvc_atomic_load64(volatile __int64* __a, memory_order __order) {
- __int64 __result;
-#if defined(_M_X86)
- do {
- __result = *__a;
- } while (__result != _InterlockedCompareExchange64(__a, __result, __result));
-#else
- if (__order == memory_order_relaxed) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __result = __iso_volatile_load64(__a);
-#else
- __result = *__a;
-#endif
- } else if (__order == memory_order_acquire ||
- __order == memory_order_consume) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- __result = __iso_volatile_load64(__a);
- _MemoryBarrier;
-#else
- __result = *__a;
- _ReadWriteBarrier();
-#endif
- } else { // __order == memory_order_seq_cst
-#if defined(_M_ARM) || defined(_M_ARM64)
- _MemoryBarrier;
- __result = __iso_volatile_load64(__a);
- _MemoryBarrier;
-#else
- _ReadWriteBarrier();
- __result = *__a;
- _ReadWriteBarrier();
-#endif
- }
-#endif
- return __result;
-}
-
-template<typename _Tp>
-static inline _Tp __c11_atomic_load(volatile _Atomic(_Tp)* __a, int __order) {
- _Tp __result;
- if (sizeof(_Tp) == 1) {
- __result = __msvc_cast<_Tp>(__msvc_atomic_load8((volatile char*)__a, (memory_order)__order));
- } else if (sizeof(_Tp) == 2 && alignof(_Tp) % 2 == 0) {
- __result = __msvc_cast<_Tp>(__msvc_atomic_load16((volatile short*)__a, (memory_order)__order));
- } else if (sizeof(_Tp) == 4 && alignof(_Tp) % 4 == 0) {
- __result = __msvc_cast<_Tp>(__msvc_atomic_load32((volatile long*)__a, (memory_order)__order));
- } else if (sizeof(_Tp) == 8 && alignof(_Tp) % 8 == 0) {
- __result = __msvc_cast<_Tp>(__msvc_atomic_load64((volatile __int64*)__a, (memory_order)__order));
- } else {
- __msvc_lock((void*)__a);
- __result = *(_Atomic(_Tp)*)__a;
- __msvc_unlock((void*)__a);
- }
- return __result;
-}
-
-template<typename _Tp>
-static inline _Tp __c11_atomic_load(_Atomic(_Tp)* __a, int __order) {
- return __c11_atomic_load((volatile _Atomic(_Tp)*)__a, __order);
-}
-
-static inline char __msvc_atomic_exchange8(volatile char* __a, char __val,
- memory_order __order) {
- char __result;
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- __result = _InterlockedExchange8_nf(__a, __val);
- } else if (__order == memory_order_acquire ||
- __order == memory_order_consume) {
- __result = _InterlockedExchange8_acq(__a, __val);
- } else if (__order == memory_order_release) {
- __result = _InterlockedExchange8_rel(__a, __val);
- } else {
- __result = _InterlockedExchange8(__a, __val);
- }
-#else
+}
+
+template <typename _Tp>
+static inline void __c11_atomic_store(volatile _Atomic(_Tp)* __a, _Tp __val,
+ int __order) {
+ if (sizeof(_Tp) == 1) {
+ __msvc_atomic_store8((volatile char*)__a, __msvc_cast<char>(__val), (memory_order)__order);
+ } else if (sizeof(_Tp) == 2 && alignof(_Tp) % 2 == 0) {
+ __msvc_atomic_store16((volatile short*)__a, __msvc_cast<short>(__val), (memory_order)__order);
+ } else if (sizeof(_Tp) == 4 && alignof(_Tp) % 4 == 0) {
+ __msvc_atomic_store32((volatile long*)__a, __msvc_cast<long>(__val), (memory_order)__order);
+ } else if (sizeof(_Tp) == 8 && alignof(_Tp) % 8 == 0) {
+ __msvc_atomic_store64((volatile __int64*)__a, __msvc_cast<__int64>(__val), (memory_order)__order);
+ } else {
+ __msvc_lock((void*)__a);
+ *(_Atomic(_Tp)*)__a = __val;
+ __msvc_unlock((void*)__a);
+ }
+}
+
+template<typename _Tp>
+static inline void __c11_atomic_store(_Atomic(_Tp)* __a, _Tp __val, int __order) {
+ __c11_atomic_store((volatile _Atomic(_Tp)*)__a, __val, __order);
+}
+
+static inline char __msvc_atomic_load8(volatile char* __a, memory_order __order) {
+ char __result;
+ if (__order == memory_order_relaxed) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __result = __iso_volatile_load8(__a);
+#else
+ __result = *__a;
+#endif
+ } else if (__order == memory_order_acquire ||
+ __order == memory_order_consume) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __result = __iso_volatile_load8(__a);
+ _MemoryBarrier;
+#else
+ __result = *__a;
+ _ReadWriteBarrier();
+#endif
+ } else { // __order == memory_order_seq_cst
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __result = __iso_volatile_load8(__a);
+ _MemoryBarrier;
+#else
+ _ReadWriteBarrier();
+ __result = *__a;
+ _ReadWriteBarrier();
+#endif
+ }
+ return __result;
+}
+
+static inline short __msvc_atomic_load16(volatile short* __a, memory_order __order) {
+ short __result;
+ if (__order == memory_order_relaxed) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __result = __iso_volatile_load16(__a);
+#else
+ __result = *__a;
+#endif
+ } else if (__order == memory_order_acquire ||
+ __order == memory_order_consume) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __result = __iso_volatile_load16(__a);
+ _MemoryBarrier;
+#else
+ __result = *__a;
+ _ReadWriteBarrier();
+#endif
+ } else { // __order == memory_order_seq_cst
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __result = __iso_volatile_load16(__a);
+ _MemoryBarrier;
+#else
+ _ReadWriteBarrier();
+ __result = *__a;
+ _ReadWriteBarrier();
+#endif
+ }
+ return __result;
+}
+
+static inline long __msvc_atomic_load32(volatile long* __a, memory_order __order) {
+ long __result;
+ if (__order == memory_order_relaxed) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __result = __iso_volatile_load32(__a);
+#else
+ __result = *__a;
+#endif
+ } else if (__order == memory_order_acquire ||
+ __order == memory_order_consume) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __result = __iso_volatile_load32(__a);
+ _MemoryBarrier;
+#else
+ __result = *__a;
+ _ReadWriteBarrier();
+#endif
+ } else { // __order == memory_order_seq_cst
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __result = __iso_volatile_load32(__a);
+ _MemoryBarrier;
+#else
+ _ReadWriteBarrier();
+ __result = *__a;
+ _ReadWriteBarrier();
+#endif
+ }
+ return __result;
+}
+
+static inline __int64 __msvc_atomic_load64(volatile __int64* __a, memory_order __order) {
+ __int64 __result;
+#if defined(_M_X86)
+ do {
+ __result = *__a;
+ } while (__result != _InterlockedCompareExchange64(__a, __result, __result));
+#else
+ if (__order == memory_order_relaxed) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __result = __iso_volatile_load64(__a);
+#else
+ __result = *__a;
+#endif
+ } else if (__order == memory_order_acquire ||
+ __order == memory_order_consume) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ __result = __iso_volatile_load64(__a);
+ _MemoryBarrier;
+#else
+ __result = *__a;
+ _ReadWriteBarrier();
+#endif
+ } else { // __order == memory_order_seq_cst
+#if defined(_M_ARM) || defined(_M_ARM64)
+ _MemoryBarrier;
+ __result = __iso_volatile_load64(__a);
+ _MemoryBarrier;
+#else
+ _ReadWriteBarrier();
+ __result = *__a;
+ _ReadWriteBarrier();
+#endif
+ }
+#endif
+ return __result;
+}
+
+template<typename _Tp>
+static inline _Tp __c11_atomic_load(volatile _Atomic(_Tp)* __a, int __order) {
+ _Tp __result;
+ if (sizeof(_Tp) == 1) {
+ __result = __msvc_cast<_Tp>(__msvc_atomic_load8((volatile char*)__a, (memory_order)__order));
+ } else if (sizeof(_Tp) == 2 && alignof(_Tp) % 2 == 0) {
+ __result = __msvc_cast<_Tp>(__msvc_atomic_load16((volatile short*)__a, (memory_order)__order));
+ } else if (sizeof(_Tp) == 4 && alignof(_Tp) % 4 == 0) {
+ __result = __msvc_cast<_Tp>(__msvc_atomic_load32((volatile long*)__a, (memory_order)__order));
+ } else if (sizeof(_Tp) == 8 && alignof(_Tp) % 8 == 0) {
+ __result = __msvc_cast<_Tp>(__msvc_atomic_load64((volatile __int64*)__a, (memory_order)__order));
+ } else {
+ __msvc_lock((void*)__a);
+ __result = *(_Atomic(_Tp)*)__a;
+ __msvc_unlock((void*)__a);
+ }
+ return __result;
+}
+
+template<typename _Tp>
+static inline _Tp __c11_atomic_load(_Atomic(_Tp)* __a, int __order) {
+ return __c11_atomic_load((volatile _Atomic(_Tp)*)__a, __order);
+}
+
+static inline char __msvc_atomic_exchange8(volatile char* __a, char __val,
+ memory_order __order) {
+ char __result;
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ __result = _InterlockedExchange8_nf(__a, __val);
+ } else if (__order == memory_order_acquire ||
+ __order == memory_order_consume) {
+ __result = _InterlockedExchange8_acq(__a, __val);
+ } else if (__order == memory_order_release) {
+ __result = _InterlockedExchange8_rel(__a, __val);
+ } else {
+ __result = _InterlockedExchange8(__a, __val);
+ }
+#else
(void)__order;
- __result = _InterlockedExchange8(__a, __val);
-#endif
- return __result;
-}
-
-static inline short __msvc_atomic_exchange16(volatile short* __a, short __val,
- memory_order __order) {
- short __result;
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- __result = _InterlockedExchange16_nf(__a, __val);
- } else if (__order == memory_order_acquire ||
- __order == memory_order_consume) {
- __result = _InterlockedExchange16_acq(__a, __val);
- } else if (__order == memory_order_release) {
- __result = _InterlockedExchange16_rel(__a, __val);
- } else {
- __result = _InterlockedExchange16(__a, __val);
- }
-#else
+ __result = _InterlockedExchange8(__a, __val);
+#endif
+ return __result;
+}
+
+static inline short __msvc_atomic_exchange16(volatile short* __a, short __val,
+ memory_order __order) {
+ short __result;
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ __result = _InterlockedExchange16_nf(__a, __val);
+ } else if (__order == memory_order_acquire ||
+ __order == memory_order_consume) {
+ __result = _InterlockedExchange16_acq(__a, __val);
+ } else if (__order == memory_order_release) {
+ __result = _InterlockedExchange16_rel(__a, __val);
+ } else {
+ __result = _InterlockedExchange16(__a, __val);
+ }
+#else
(void)__order;
- __result = _InterlockedExchange16(__a, __val);
-#endif
- return __result;
-}
-
-static inline long __msvc_atomic_exchange32(volatile long* __a, long __val,
- memory_order __order) {
- long __result;
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- __result = _InterlockedExchange_nf(__a, __val);
- } else if (__order == memory_order_acquire ||
- __order == memory_order_consume) {
- __result = _InterlockedExchange_acq(__a, __val);
- } else if (__order == memory_order_release) {
- __result = _InterlockedExchange_rel(__a, __val);
- } else {
- __result = _InterlockedExchange(__a, __val);
- }
-#else
+ __result = _InterlockedExchange16(__a, __val);
+#endif
+ return __result;
+}
+
+static inline long __msvc_atomic_exchange32(volatile long* __a, long __val,
+ memory_order __order) {
+ long __result;
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ __result = _InterlockedExchange_nf(__a, __val);
+ } else if (__order == memory_order_acquire ||
+ __order == memory_order_consume) {
+ __result = _InterlockedExchange_acq(__a, __val);
+ } else if (__order == memory_order_release) {
+ __result = _InterlockedExchange_rel(__a, __val);
+ } else {
+ __result = _InterlockedExchange(__a, __val);
+ }
+#else
(void)__order;
- __result = _InterlockedExchange(__a, __val);
-#endif
- return __result;
-}
-
-static inline __int64 __msvc_atomic_exchange64(volatile __int64* __a, __int64 __val,
- memory_order __order) {
- __int64 __result;
-#if defined(_M_IX86)
- do {
- __result = *__a;
- } while (__result != _InterlockedCompareExchange64(__a, __val, __result));
-#elif defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- __result = _InterlockedExchange64_nf(__a, __val);
- } else if (__order == memory_order_acquire ||
- __order == memory_order_consume) {
- __result = _InterlockedExchange64_acq(__a, __val);
- } else if (__order == memory_order_release) {
- __result = _InterlockedExchange64_rel(__a, __val);
- } else {
- __result = _InterlockedExchange64(__a, __val);
- }
-#else
+ __result = _InterlockedExchange(__a, __val);
+#endif
+ return __result;
+}
+
+static inline __int64 __msvc_atomic_exchange64(volatile __int64* __a, __int64 __val,
+ memory_order __order) {
+ __int64 __result;
+#if defined(_M_IX86)
+ do {
+ __result = *__a;
+ } while (__result != _InterlockedCompareExchange64(__a, __val, __result));
+#elif defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ __result = _InterlockedExchange64_nf(__a, __val);
+ } else if (__order == memory_order_acquire ||
+ __order == memory_order_consume) {
+ __result = _InterlockedExchange64_acq(__a, __val);
+ } else if (__order == memory_order_release) {
+ __result = _InterlockedExchange64_rel(__a, __val);
+ } else {
+ __result = _InterlockedExchange64(__a, __val);
+ }
+#else
(void)__order;
- __result = _InterlockedExchange64(__a, __val);
-#endif
- return __result;
-}
-
-template<typename _Tp>
-static inline _Tp __c11_atomic_exchange(volatile _Atomic(_Tp)* __a, _Tp __val,
- int __order) {
- _Tp __result;
- if (sizeof(_Tp) == 1) {
- __result = __msvc_cast<_Tp>(
- __msvc_atomic_exchange8((volatile char*)__a, __msvc_cast<char>(__val), (memory_order)__order));
- } else if (sizeof(_Tp) == 2 && alignof(_Tp) % 2 == 0) {
- __result = __msvc_cast<_Tp>(
- __msvc_atomic_exchange16((volatile short*)__a, __msvc_cast<short>(__val), (memory_order)__order));
- } else if (sizeof(_Tp) == 4 && alignof(_Tp) % 4 == 0) {
- __result = __msvc_cast<_Tp>(
- __msvc_atomic_exchange32((volatile long*)__a, __msvc_cast<long>(__val), (memory_order)__order));
- } else if (sizeof(_Tp) == 8 && alignof(_Tp) % 8 == 0) {
- __result = __msvc_cast<_Tp>(
- __msvc_atomic_exchange64((volatile __int64*)__a, __msvc_cast<__int64>(__val), (memory_order)__order));
- } else {
- __msvc_lock((void*)__a);
- __result = *(_Atomic(_Tp)*)__a;
- *(_Atomic(_Tp)*)__a = __val;
- __msvc_unlock((void*)__a);
- }
- return __result;
-}
-
-template<typename _Tp>
-static inline _Tp __c11_atomic_exchange(_Atomic(_Tp)* __a, _Tp __val,
- int __order) {
- return __c11_atomic_exchange((volatile _Atomic(_Tp)*)__a, __val, __order);
-}
-
-static inline bool __msvc_atomic_compare_exchange8(volatile char* __a, char __value, char* __expected,
- memory_order __order) {
- char __compare = *__expected;
- char __before;
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- __before = _InterlockedCompareExchange8_nf(__a, __value, __compare);
- } else if (__order == memory_order_acquire) {
- __before = _InterlockedCompareExchange8_acq(__a, __value, __compare);
- } else if (__order == memory_order_release) {
- __before = _InterlockedCompareExchange8_rel(__a, __value, __compare);
- } else {
- __before = _InterlockedCompareExchange8(__a, __value, __compare);
- }
-#else
+ __result = _InterlockedExchange64(__a, __val);
+#endif
+ return __result;
+}
+
+template<typename _Tp>
+static inline _Tp __c11_atomic_exchange(volatile _Atomic(_Tp)* __a, _Tp __val,
+ int __order) {
+ _Tp __result;
+ if (sizeof(_Tp) == 1) {
+ __result = __msvc_cast<_Tp>(
+ __msvc_atomic_exchange8((volatile char*)__a, __msvc_cast<char>(__val), (memory_order)__order));
+ } else if (sizeof(_Tp) == 2 && alignof(_Tp) % 2 == 0) {
+ __result = __msvc_cast<_Tp>(
+ __msvc_atomic_exchange16((volatile short*)__a, __msvc_cast<short>(__val), (memory_order)__order));
+ } else if (sizeof(_Tp) == 4 && alignof(_Tp) % 4 == 0) {
+ __result = __msvc_cast<_Tp>(
+ __msvc_atomic_exchange32((volatile long*)__a, __msvc_cast<long>(__val), (memory_order)__order));
+ } else if (sizeof(_Tp) == 8 && alignof(_Tp) % 8 == 0) {
+ __result = __msvc_cast<_Tp>(
+ __msvc_atomic_exchange64((volatile __int64*)__a, __msvc_cast<__int64>(__val), (memory_order)__order));
+ } else {
+ __msvc_lock((void*)__a);
+ __result = *(_Atomic(_Tp)*)__a;
+ *(_Atomic(_Tp)*)__a = __val;
+ __msvc_unlock((void*)__a);
+ }
+ return __result;
+}
+
+template<typename _Tp>
+static inline _Tp __c11_atomic_exchange(_Atomic(_Tp)* __a, _Tp __val,
+ int __order) {
+ return __c11_atomic_exchange((volatile _Atomic(_Tp)*)__a, __val, __order);
+}
+
+static inline bool __msvc_atomic_compare_exchange8(volatile char* __a, char __value, char* __expected,
+ memory_order __order) {
+ char __compare = *__expected;
+ char __before;
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ __before = _InterlockedCompareExchange8_nf(__a, __value, __compare);
+ } else if (__order == memory_order_acquire) {
+ __before = _InterlockedCompareExchange8_acq(__a, __value, __compare);
+ } else if (__order == memory_order_release) {
+ __before = _InterlockedCompareExchange8_rel(__a, __value, __compare);
+ } else {
+ __before = _InterlockedCompareExchange8(__a, __value, __compare);
+ }
+#else
(void)__order;
- __before = _InterlockedCompareExchange8(__a, __value, __compare);
-#endif
- if (__before == __compare) {
- return true;
- }
- *__expected = __before;
- return false;
-}
-
-static inline bool __msvc_atomic_compare_exchange16(volatile short* __a, short __value, short* __expected,
- memory_order __order) {
- short __compare = *__expected;
- short __before;
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- __before = _InterlockedCompareExchange16_nf(__a, __value, __compare);
- } else if (__order == memory_order_acquire) {
- __before = _InterlockedCompareExchange16_acq(__a, __value, __compare);
- } else if (__order == memory_order_release) {
- __before = _InterlockedCompareExchange16_rel(__a, __value, __compare);
- } else {
- __before = _InterlockedCompareExchange16(__a, __value, __compare);
- }
-#else
+ __before = _InterlockedCompareExchange8(__a, __value, __compare);
+#endif
+ if (__before == __compare) {
+ return true;
+ }
+ *__expected = __before;
+ return false;
+}
+
+static inline bool __msvc_atomic_compare_exchange16(volatile short* __a, short __value, short* __expected,
+ memory_order __order) {
+ short __compare = *__expected;
+ short __before;
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ __before = _InterlockedCompareExchange16_nf(__a, __value, __compare);
+ } else if (__order == memory_order_acquire) {
+ __before = _InterlockedCompareExchange16_acq(__a, __value, __compare);
+ } else if (__order == memory_order_release) {
+ __before = _InterlockedCompareExchange16_rel(__a, __value, __compare);
+ } else {
+ __before = _InterlockedCompareExchange16(__a, __value, __compare);
+ }
+#else
(void)__order;
- __before = _InterlockedCompareExchange16(__a, __value, __compare);
-#endif
- if (__before == __compare) {
- return true;
- }
- *__expected = __before;
- return false;
-}
-
-static inline bool __msvc_atomic_compare_exchange32(volatile long* __a, long __value, long* __expected,
- memory_order __order) {
- long __compare = *__expected;
- long __before;
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- __before = _InterlockedCompareExchange_nf(__a, __value, __compare);
- } else if (__order == memory_order_acquire) {
- __before = _InterlockedCompareExchange_acq(__a, __value, __compare);
- } else if (__order == memory_order_release) {
- __before = _InterlockedCompareExchange_rel(__a, __value, __compare);
- } else {
- __before = _InterlockedCompareExchange(__a, __value, __compare);
- }
-#else
+ __before = _InterlockedCompareExchange16(__a, __value, __compare);
+#endif
+ if (__before == __compare) {
+ return true;
+ }
+ *__expected = __before;
+ return false;
+}
+
+static inline bool __msvc_atomic_compare_exchange32(volatile long* __a, long __value, long* __expected,
+ memory_order __order) {
+ long __compare = *__expected;
+ long __before;
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ __before = _InterlockedCompareExchange_nf(__a, __value, __compare);
+ } else if (__order == memory_order_acquire) {
+ __before = _InterlockedCompareExchange_acq(__a, __value, __compare);
+ } else if (__order == memory_order_release) {
+ __before = _InterlockedCompareExchange_rel(__a, __value, __compare);
+ } else {
+ __before = _InterlockedCompareExchange(__a, __value, __compare);
+ }
+#else
(void)__order;
- __before = _InterlockedCompareExchange(__a, __value, __compare);
-#endif
- if (__before == __compare) {
- return true;
- }
- *__expected = __before;
- return false;
-}
-
-static inline bool __msvc_atomic_compare_exchange64(volatile __int64* __a, __int64 __value, __int64* __expected,
- memory_order __order) {
- __int64 __compare = *__expected;
- __int64 __before;
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- __before = _InterlockedCompareExchange64_nf(__a, __value, __compare);
- } else if (__order == memory_order_acquire) {
- __before = _InterlockedCompareExchange64_acq(__a, __value, __compare);
- } else if (__order == memory_order_release) {
- __before = _InterlockedCompareExchange64_rel(__a, __value, __compare);
- } else {
- __before = _InterlockedCompareExchange64(__a, __value, __compare);
- }
-#else
+ __before = _InterlockedCompareExchange(__a, __value, __compare);
+#endif
+ if (__before == __compare) {
+ return true;
+ }
+ *__expected = __before;
+ return false;
+}
+
+static inline bool __msvc_atomic_compare_exchange64(volatile __int64* __a, __int64 __value, __int64* __expected,
+ memory_order __order) {
+ __int64 __compare = *__expected;
+ __int64 __before;
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ __before = _InterlockedCompareExchange64_nf(__a, __value, __compare);
+ } else if (__order == memory_order_acquire) {
+ __before = _InterlockedCompareExchange64_acq(__a, __value, __compare);
+ } else if (__order == memory_order_release) {
+ __before = _InterlockedCompareExchange64_rel(__a, __value, __compare);
+ } else {
+ __before = _InterlockedCompareExchange64(__a, __value, __compare);
+ }
+#else
(void)__order;
- __before = _InterlockedCompareExchange64(__a, __value, __compare);
-#endif
- if (__before == __compare) {
- return true;
- }
- *__expected = __before;
- return false;
-}
-
-
-static inline memory_order constexpr __msvc_top_memory_order(memory_order __order1, memory_order __order2) {
- return
- (__order1 == memory_order_relaxed && __order2 == memory_order_relaxed) ? memory_order_relaxed :
- ((__order1 == memory_order_relaxed || __order1 == memory_order_acquire || __order1 == memory_order_consume) &&
- (__order2 == memory_order_relaxed || __order2 == memory_order_relaxed || __order2 == memory_order_consume)) ? memory_order_acquire :
- ((__order1 == memory_order_relaxed || __order1 == memory_order_release) &&
- (__order2 == memory_order_relaxed || __order2 == memory_order_release)) ? memory_order_release :
- (__order1 != memory_order_seq_cst && __order2 != memory_order_seq_cst) ? memory_order_acq_rel :
- memory_order_seq_cst;
-}
-
-template<typename _Tp>
-static inline bool __c11_atomic_compare_exchange_strong(
- volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
- int __order_success, int __order_failure) {
- memory_order __order = __msvc_top_memory_order((memory_order)__order_success, (memory_order)__order_failure);
- if (sizeof(_Tp) == 1) {
- return __msvc_atomic_compare_exchange8((volatile char*)__a, __msvc_cast<char>(__value), (char*)__expected, __order);
- } else if (sizeof(_Tp) == 2 && alignof(_Tp) % 2 == 0) {
- return __msvc_atomic_compare_exchange16((volatile short*)__a, __msvc_cast<short>(__value), (short*)__expected, __order);
- } else if (sizeof(_Tp) == 4 && alignof(_Tp) % 4 == 0) {
- return __msvc_atomic_compare_exchange32((volatile long*)__a, __msvc_cast<long>(__value), (long*)__expected, __order);
- } else if (sizeof(_Tp) == 8 && alignof(_Tp) % 8 == 0) {
- return __msvc_atomic_compare_exchange64((volatile __int64*)__a, __msvc_cast<__int64>(__value), (__int64*)__expected, __order);
- } else {
- bool __result;
- __msvc_lock((void*)__a);
- volatile char* __p_a = reinterpret_cast<volatile char*>(__a);
- volatile char* __p_a_end = __p_a + sizeof(_Atomic(_Tp));
- volatile char* __p_expected = reinterpret_cast<volatile char*>(__expected);
- bool __equal = true;
- while (__p_a != __p_a_end) {
- if (*__p_a++ != *__p_expected++) {
- __equal = false;
- break;
- }
- }
- if (__equal) {
- *(_Atomic(_Tp)*)__a = __value;
- __result = true;
- } else {
- *__expected = *(_Atomic(_Tp)*)__a;
- __result = false;
- }
- __msvc_unlock((void*)__a);
- return __result;
- }
-}
-
-template<typename _Tp>
-static inline bool __c11_atomic_compare_exchange_strong(
- _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
- int __order_success, int __order_failure) {
- return __c11_atomic_compare_exchange_strong(
- (volatile _Atomic(_Tp)*)__a, __expected, __value, __order_success, __order_failure);
-}
-
-template<typename _Tp>
-static inline bool __c11_atomic_compare_exchange_weak(
- volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
- int __order_success, int __order_failure) {
- return __c11_atomic_compare_exchange_strong(__a, __expected, __value, __order_success, __order_failure);
-}
-
-template<typename _Tp>
-static inline bool __c11_atomic_compare_exchange_weak(
- _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
- int __order_success, int __order_failure) {
- return __c11_atomic_compare_exchange_strong(__a, __expected, __value, __order_success, __order_failure);
-}
-
-template <typename _Tp>
-struct __msvc_skip { enum {value = 1}; };
-
-template <typename _Tp>
-struct __msvc_skip<_Tp*> { enum {value = sizeof(_Tp)}; };
-
-// FIXME: Haven't figured out what the spec says about using arrays with
-// atomic_fetch_add. Force a failure rather than creating bad behavior.
-template <typename _Tp>
-struct __msvc_skip<_Tp[]> { };
-template <typename _Tp, int n>
-struct __msvc_skip<_Tp[n]> { };
-
-static inline char __msvc_atomic_fetch_add8(volatile char* __a, char __delta,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedExchangeAdd8_nf(__a, __delta);
- } else if (__order == memory_order_acquire) {
- return _InterlockedExchangeAdd8_acq(__a, __delta);
- } else if (__order == memory_order_release) {
- return _InterlockedExchangeAdd8_rel(__a, __delta);
- } else {
- return _InterlockedExchangeAdd8(__a, __delta);
- }
-#else
+ __before = _InterlockedCompareExchange64(__a, __value, __compare);
+#endif
+ if (__before == __compare) {
+ return true;
+ }
+ *__expected = __before;
+ return false;
+}
+
+
+static inline memory_order constexpr __msvc_top_memory_order(memory_order __order1, memory_order __order2) {
+ return
+ (__order1 == memory_order_relaxed && __order2 == memory_order_relaxed) ? memory_order_relaxed :
+ ((__order1 == memory_order_relaxed || __order1 == memory_order_acquire || __order1 == memory_order_consume) &&
+ (__order2 == memory_order_relaxed || __order2 == memory_order_relaxed || __order2 == memory_order_consume)) ? memory_order_acquire :
+ ((__order1 == memory_order_relaxed || __order1 == memory_order_release) &&
+ (__order2 == memory_order_relaxed || __order2 == memory_order_release)) ? memory_order_release :
+ (__order1 != memory_order_seq_cst && __order2 != memory_order_seq_cst) ? memory_order_acq_rel :
+ memory_order_seq_cst;
+}
+
+template<typename _Tp>
+static inline bool __c11_atomic_compare_exchange_strong(
+ volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
+ int __order_success, int __order_failure) {
+ memory_order __order = __msvc_top_memory_order((memory_order)__order_success, (memory_order)__order_failure);
+ if (sizeof(_Tp) == 1) {
+ return __msvc_atomic_compare_exchange8((volatile char*)__a, __msvc_cast<char>(__value), (char*)__expected, __order);
+ } else if (sizeof(_Tp) == 2 && alignof(_Tp) % 2 == 0) {
+ return __msvc_atomic_compare_exchange16((volatile short*)__a, __msvc_cast<short>(__value), (short*)__expected, __order);
+ } else if (sizeof(_Tp) == 4 && alignof(_Tp) % 4 == 0) {
+ return __msvc_atomic_compare_exchange32((volatile long*)__a, __msvc_cast<long>(__value), (long*)__expected, __order);
+ } else if (sizeof(_Tp) == 8 && alignof(_Tp) % 8 == 0) {
+ return __msvc_atomic_compare_exchange64((volatile __int64*)__a, __msvc_cast<__int64>(__value), (__int64*)__expected, __order);
+ } else {
+ bool __result;
+ __msvc_lock((void*)__a);
+ volatile char* __p_a = reinterpret_cast<volatile char*>(__a);
+ volatile char* __p_a_end = __p_a + sizeof(_Atomic(_Tp));
+ volatile char* __p_expected = reinterpret_cast<volatile char*>(__expected);
+ bool __equal = true;
+ while (__p_a != __p_a_end) {
+ if (*__p_a++ != *__p_expected++) {
+ __equal = false;
+ break;
+ }
+ }
+ if (__equal) {
+ *(_Atomic(_Tp)*)__a = __value;
+ __result = true;
+ } else {
+ *__expected = *(_Atomic(_Tp)*)__a;
+ __result = false;
+ }
+ __msvc_unlock((void*)__a);
+ return __result;
+ }
+}
+
+template<typename _Tp>
+static inline bool __c11_atomic_compare_exchange_strong(
+ _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
+ int __order_success, int __order_failure) {
+ return __c11_atomic_compare_exchange_strong(
+ (volatile _Atomic(_Tp)*)__a, __expected, __value, __order_success, __order_failure);
+}
+
+template<typename _Tp>
+static inline bool __c11_atomic_compare_exchange_weak(
+ volatile _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
+ int __order_success, int __order_failure) {
+ return __c11_atomic_compare_exchange_strong(__a, __expected, __value, __order_success, __order_failure);
+}
+
+template<typename _Tp>
+static inline bool __c11_atomic_compare_exchange_weak(
+ _Atomic(_Tp)* __a, _Tp* __expected, _Tp __value,
+ int __order_success, int __order_failure) {
+ return __c11_atomic_compare_exchange_strong(__a, __expected, __value, __order_success, __order_failure);
+}
+
+template <typename _Tp>
+struct __msvc_skip { enum {value = 1}; };
+
+template <typename _Tp>
+struct __msvc_skip<_Tp*> { enum {value = sizeof(_Tp)}; };
+
+// FIXME: Haven't figured out what the spec says about using arrays with
+// atomic_fetch_add. Force a failure rather than creating bad behavior.
+template <typename _Tp>
+struct __msvc_skip<_Tp[]> { };
+template <typename _Tp, int n>
+struct __msvc_skip<_Tp[n]> { };
+
+static inline char __msvc_atomic_fetch_add8(volatile char* __a, char __delta,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedExchangeAdd8_nf(__a, __delta);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedExchangeAdd8_acq(__a, __delta);
+ } else if (__order == memory_order_release) {
+ return _InterlockedExchangeAdd8_rel(__a, __delta);
+ } else {
+ return _InterlockedExchangeAdd8(__a, __delta);
+ }
+#else
(void)__order;
- return _InterlockedExchangeAdd8(__a, __delta);
-#endif
-}
-
-static inline short __msvc_atomic_fetch_add16(volatile short* __a, short __delta,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedExchangeAdd16_nf(__a, __delta);
- } else if (__order == memory_order_acquire) {
- return _InterlockedExchangeAdd16_acq(__a, __delta);
- } else if (__order == memory_order_release) {
- return _InterlockedExchangeAdd16_rel(__a, __delta);
- } else {
- return _InterlockedExchangeAdd16(__a, __delta);
- }
-#else
+ return _InterlockedExchangeAdd8(__a, __delta);
+#endif
+}
+
+static inline short __msvc_atomic_fetch_add16(volatile short* __a, short __delta,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedExchangeAdd16_nf(__a, __delta);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedExchangeAdd16_acq(__a, __delta);
+ } else if (__order == memory_order_release) {
+ return _InterlockedExchangeAdd16_rel(__a, __delta);
+ } else {
+ return _InterlockedExchangeAdd16(__a, __delta);
+ }
+#else
(void)__order;
- return _InterlockedExchangeAdd16(__a, __delta);
-#endif
-}
-
-static inline long __msvc_atomic_fetch_add32(volatile long* __a, long __delta,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedExchangeAdd_nf(__a, __delta);
- } else if (__order == memory_order_acquire) {
- return _InterlockedExchangeAdd_acq(__a, __delta);
- } else if (__order == memory_order_release) {
- return _InterlockedExchangeAdd_rel(__a, __delta);
- } else {
- return _InterlockedExchangeAdd(__a, __delta);
- }
-#else
+ return _InterlockedExchangeAdd16(__a, __delta);
+#endif
+}
+
+static inline long __msvc_atomic_fetch_add32(volatile long* __a, long __delta,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedExchangeAdd_nf(__a, __delta);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedExchangeAdd_acq(__a, __delta);
+ } else if (__order == memory_order_release) {
+ return _InterlockedExchangeAdd_rel(__a, __delta);
+ } else {
+ return _InterlockedExchangeAdd(__a, __delta);
+ }
+#else
(void)__order;
- return _InterlockedExchangeAdd(__a, __delta);
-#endif
-}
-
-static inline __int64 __msvc_atomic_fetch_add64(volatile __int64* __a, __int64 __delta,
- memory_order __order) {
-#if defined(_M_IX86)
- __int64 __tmp;
- do {
- __tmp = *__a;
- } while (__tmp != _InterlockedCompareExchange64(__a, __tmp + __delta, __tmp));
- return __tmp;
-#elif defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedExchangeAdd64_nf(__a, __delta);
- } else if (__order == memory_order_acquire) {
- return _InterlockedExchangeAdd64_acq(__a, __delta);
- } else if (__order == memory_order_release) {
- return _InterlockedExchangeAdd64_rel(__a, __delta);
- } else {
- return _InterlockedExchangeAdd64(__a, __delta);
- }
-#else
+ return _InterlockedExchangeAdd(__a, __delta);
+#endif
+}
+
+static inline __int64 __msvc_atomic_fetch_add64(volatile __int64* __a, __int64 __delta,
+ memory_order __order) {
+#if defined(_M_IX86)
+ __int64 __tmp;
+ do {
+ __tmp = *__a;
+ } while (__tmp != _InterlockedCompareExchange64(__a, __tmp + __delta, __tmp));
+ return __tmp;
+#elif defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedExchangeAdd64_nf(__a, __delta);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedExchangeAdd64_acq(__a, __delta);
+ } else if (__order == memory_order_release) {
+ return _InterlockedExchangeAdd64_rel(__a, __delta);
+ } else {
+ return _InterlockedExchangeAdd64(__a, __delta);
+ }
+#else
(void)__order;
- return _InterlockedExchangeAdd64(__a, __delta);
-#endif
-}
-
-template <typename _Tp, typename _Td>
-static inline _Tp __c11_atomic_fetch_add(volatile _Atomic(_Tp)* __a,
- _Td __delta, int __order) {
- _Td __real_delta = __delta * __msvc_skip<_Tp>::value;
- if (sizeof(_Tp) == 1 && std::is_integral<_Tp>::value) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_add8((volatile char*)__a, (char)__real_delta, (memory_order)__order));
- } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_add16((volatile short*)__a, (short)__real_delta, (memory_order)__order));
- } else if (sizeof(_Tp) == 4 && (std::is_integral<_Tp>::value || std::is_pointer<_Tp>::value)) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_add32((volatile long*)__a, (long)__real_delta, (memory_order)__order));
- } else if (sizeof(_Tp) == 8 && (std::is_integral<_Tp>::value || std::is_pointer<_Tp>::value)) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_add64((volatile __int64*)__a, (__int64)__real_delta, (memory_order)__order));
- } else {
- __msvc_lock((void*)__a);
- _Tp __result = *(_Atomic(_Tp)*)__a;
- *(_Atomic(_Tp)*)__a += __delta;
- __msvc_unlock((void*)__a);
- return __result;
- }
-}
-
-template <typename _Tp, typename _Td>
-static inline _Tp __c11_atomic_fetch_add(_Atomic(_Tp)* __a,
- _Td __delta, int __order) {
- return __c11_atomic_fetch_add((volatile _Atomic(_Tp)*) __a, __delta, __order);
-}
-
-template <typename _Tp, typename _Td>
-static inline _Tp __c11_atomic_fetch_sub(volatile _Atomic(_Tp)* __a,
- _Td __delta, int __order) {
- _Td __real_delta = __delta * __msvc_skip<_Tp>::value;
- // Cast __real_delta to unsigned types to avoid integer overflow on negation.
- if (sizeof(_Tp) == 1 && std::is_integral<_Tp>::value) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_add8((volatile char*)__a, -(unsigned char)__real_delta, (memory_order)__order));
- } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_add16((volatile short*)__a, -(unsigned short)__real_delta, (memory_order)__order));
- } else if (sizeof(_Tp) == 4 && (std::is_integral<_Tp>::value || std::is_pointer<_Tp>::value)) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_add32((volatile long*)__a, -(unsigned long)__real_delta, (memory_order)__order));
- } else if (sizeof(_Tp) == 8 && (std::is_integral<_Tp>::value || std::is_pointer<_Tp>::value)) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_add64((volatile __int64*)__a, -(unsigned __int64)__real_delta, (memory_order)__order));
- } else {
- __msvc_lock((void*)__a);
- _Tp __result = *(_Atomic(_Tp)*)__a;
- *(_Atomic(_Tp)*)__a -= __delta;
- __msvc_unlock((void*)__a);
- return __result;
- }
-}
-
-template <typename _Tp, typename _Td>
-static inline _Tp __c11_atomic_fetch_sub(_Atomic(_Tp)* __a,
- _Td __delta, int __order) {
- return __c11_atomic_fetch_sub((volatile _Atomic(_Tp)*) __a, __delta, __order);
-}
-
-static inline char __msvc_atomic_fetch_and8(volatile char* __a, char __value,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedAnd8_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedAnd8_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedAnd8_rel(__a, __value);
- } else {
- return _InterlockedAnd8(__a, __value);
- }
-#else
+ return _InterlockedExchangeAdd64(__a, __delta);
+#endif
+}
+
+template <typename _Tp, typename _Td>
+static inline _Tp __c11_atomic_fetch_add(volatile _Atomic(_Tp)* __a,
+ _Td __delta, int __order) {
+ _Td __real_delta = __delta * __msvc_skip<_Tp>::value;
+ if (sizeof(_Tp) == 1 && std::is_integral<_Tp>::value) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_add8((volatile char*)__a, (char)__real_delta, (memory_order)__order));
+ } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_add16((volatile short*)__a, (short)__real_delta, (memory_order)__order));
+ } else if (sizeof(_Tp) == 4 && (std::is_integral<_Tp>::value || std::is_pointer<_Tp>::value)) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_add32((volatile long*)__a, (long)__real_delta, (memory_order)__order));
+ } else if (sizeof(_Tp) == 8 && (std::is_integral<_Tp>::value || std::is_pointer<_Tp>::value)) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_add64((volatile __int64*)__a, (__int64)__real_delta, (memory_order)__order));
+ } else {
+ __msvc_lock((void*)__a);
+ _Tp __result = *(_Atomic(_Tp)*)__a;
+ *(_Atomic(_Tp)*)__a += __delta;
+ __msvc_unlock((void*)__a);
+ return __result;
+ }
+}
+
+template <typename _Tp, typename _Td>
+static inline _Tp __c11_atomic_fetch_add(_Atomic(_Tp)* __a,
+ _Td __delta, int __order) {
+ return __c11_atomic_fetch_add((volatile _Atomic(_Tp)*) __a, __delta, __order);
+}
+
+template <typename _Tp, typename _Td>
+static inline _Tp __c11_atomic_fetch_sub(volatile _Atomic(_Tp)* __a,
+ _Td __delta, int __order) {
+ _Td __real_delta = __delta * __msvc_skip<_Tp>::value;
+ // Cast __real_delta to unsigned types to avoid integer overflow on negation.
+ if (sizeof(_Tp) == 1 && std::is_integral<_Tp>::value) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_add8((volatile char*)__a, -(unsigned char)__real_delta, (memory_order)__order));
+ } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_add16((volatile short*)__a, -(unsigned short)__real_delta, (memory_order)__order));
+ } else if (sizeof(_Tp) == 4 && (std::is_integral<_Tp>::value || std::is_pointer<_Tp>::value)) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_add32((volatile long*)__a, -(unsigned long)__real_delta, (memory_order)__order));
+ } else if (sizeof(_Tp) == 8 && (std::is_integral<_Tp>::value || std::is_pointer<_Tp>::value)) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_add64((volatile __int64*)__a, -(unsigned __int64)__real_delta, (memory_order)__order));
+ } else {
+ __msvc_lock((void*)__a);
+ _Tp __result = *(_Atomic(_Tp)*)__a;
+ *(_Atomic(_Tp)*)__a -= __delta;
+ __msvc_unlock((void*)__a);
+ return __result;
+ }
+}
+
+template <typename _Tp, typename _Td>
+static inline _Tp __c11_atomic_fetch_sub(_Atomic(_Tp)* __a,
+ _Td __delta, int __order) {
+ return __c11_atomic_fetch_sub((volatile _Atomic(_Tp)*) __a, __delta, __order);
+}
+
+static inline char __msvc_atomic_fetch_and8(volatile char* __a, char __value,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedAnd8_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedAnd8_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedAnd8_rel(__a, __value);
+ } else {
+ return _InterlockedAnd8(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedAnd8(__a, __value);
-#endif
-}
-
-static inline short __msvc_atomic_fetch_and16(volatile short* __a, short __value,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedAnd16_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedAnd16_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedAnd16_rel(__a, __value);
- } else {
- return _InterlockedAnd16(__a, __value);
- }
-#else
+ return _InterlockedAnd8(__a, __value);
+#endif
+}
+
+static inline short __msvc_atomic_fetch_and16(volatile short* __a, short __value,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedAnd16_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedAnd16_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedAnd16_rel(__a, __value);
+ } else {
+ return _InterlockedAnd16(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedAnd16(__a, __value);
-#endif
-}
-
-static inline long __msvc_atomic_fetch_and32(volatile long* __a, long __value,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedAnd_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedAnd_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedAnd_rel(__a, __value);
- } else {
- return _InterlockedAnd(__a, __value);
- }
-#else
+ return _InterlockedAnd16(__a, __value);
+#endif
+}
+
+static inline long __msvc_atomic_fetch_and32(volatile long* __a, long __value,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedAnd_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedAnd_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedAnd_rel(__a, __value);
+ } else {
+ return _InterlockedAnd(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedAnd(__a, __value);
-#endif
-}
-
-static inline __int64 __msvc_atomic_fetch_and64(volatile __int64* __a, __int64 __value,
- memory_order __order) {
-#if defined(_M_IX86)
- __int64 __tmp;
- do {
- __tmp = *__a;
- } while (__tmp != _InterlockedCompareExchange64(__a, __tmp & __value, __tmp));
- return __tmp;
-#elif defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedAnd64_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedAnd64_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedAnd64_rel(__a, __value);
- } else {
- return _InterlockedAnd64(__a, __value);
- }
-#else
+ return _InterlockedAnd(__a, __value);
+#endif
+}
+
+static inline __int64 __msvc_atomic_fetch_and64(volatile __int64* __a, __int64 __value,
+ memory_order __order) {
+#if defined(_M_IX86)
+ __int64 __tmp;
+ do {
+ __tmp = *__a;
+ } while (__tmp != _InterlockedCompareExchange64(__a, __tmp & __value, __tmp));
+ return __tmp;
+#elif defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedAnd64_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedAnd64_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedAnd64_rel(__a, __value);
+ } else {
+ return _InterlockedAnd64(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedAnd64(__a, __value);
-#endif
-}
-
-template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_and(volatile _Atomic(_Tp)* __a,
- _Tp __value, int __order) {
- if (sizeof(_Tp) == 1 && (std::is_integral<_Tp>::value || std::is_same<std::remove_cv_t<_Tp>, bool>::value)) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_and8((volatile char*)__a, __msvc_cast<char>(__value), (memory_order)__order));
- } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
- return (_Tp)__msvc_atomic_fetch_and16((volatile short*)__a, (short)__value, (memory_order)__order);
- } else if (sizeof(_Tp) == 4 && std::is_integral<_Tp>::value) {
- return (_Tp) __msvc_atomic_fetch_and32((volatile long*)__a, (long)__value, (memory_order)__order);
- } else if (sizeof(_Tp) == 8 && std::is_integral<_Tp>::value) {
- return (_Tp) __msvc_atomic_fetch_and64((volatile __int64*)__a, (__int64)__value, (memory_order)__order);
- } else {
- __msvc_lock((void*)__a);
- _Tp __result = *(_Atomic(_Tp)*)__a;
- *(_Atomic(_Tp)*)__a &= __value;
- __msvc_unlock((void*)__a);
- return __result;
- }
-}
-
-template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_and(_Atomic(_Tp)* __a,
- _Tp __value, int __order) {
- return __c11_atomic_fetch_and((volatile _Atomic(_Tp)*)__a, __value, __order);
-}
-
-static inline char __msvc_atomic_fetch_or8(volatile char* __a, char __value,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedOr8_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedOr8_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedOr8_rel(__a, __value);
- } else {
- return _InterlockedOr8(__a, __value);
- }
-#else
+ return _InterlockedAnd64(__a, __value);
+#endif
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_and(volatile _Atomic(_Tp)* __a,
+ _Tp __value, int __order) {
+ if (sizeof(_Tp) == 1 && (std::is_integral<_Tp>::value || std::is_same<std::remove_cv_t<_Tp>, bool>::value)) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_and8((volatile char*)__a, __msvc_cast<char>(__value), (memory_order)__order));
+ } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
+ return (_Tp)__msvc_atomic_fetch_and16((volatile short*)__a, (short)__value, (memory_order)__order);
+ } else if (sizeof(_Tp) == 4 && std::is_integral<_Tp>::value) {
+ return (_Tp) __msvc_atomic_fetch_and32((volatile long*)__a, (long)__value, (memory_order)__order);
+ } else if (sizeof(_Tp) == 8 && std::is_integral<_Tp>::value) {
+ return (_Tp) __msvc_atomic_fetch_and64((volatile __int64*)__a, (__int64)__value, (memory_order)__order);
+ } else {
+ __msvc_lock((void*)__a);
+ _Tp __result = *(_Atomic(_Tp)*)__a;
+ *(_Atomic(_Tp)*)__a &= __value;
+ __msvc_unlock((void*)__a);
+ return __result;
+ }
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_and(_Atomic(_Tp)* __a,
+ _Tp __value, int __order) {
+ return __c11_atomic_fetch_and((volatile _Atomic(_Tp)*)__a, __value, __order);
+}
+
+static inline char __msvc_atomic_fetch_or8(volatile char* __a, char __value,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedOr8_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedOr8_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedOr8_rel(__a, __value);
+ } else {
+ return _InterlockedOr8(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedOr8(__a, __value);
-#endif
-}
-
-static inline short __msvc_atomic_fetch_or16(volatile short* __a, short __value,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedOr16_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedOr16_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedOr16_rel(__a, __value);
- } else {
- return _InterlockedOr16(__a, __value);
- }
-#else
+ return _InterlockedOr8(__a, __value);
+#endif
+}
+
+static inline short __msvc_atomic_fetch_or16(volatile short* __a, short __value,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedOr16_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedOr16_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedOr16_rel(__a, __value);
+ } else {
+ return _InterlockedOr16(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedOr16(__a, __value);
-#endif
-}
-
-static inline long __msvc_atomic_fetch_or32(volatile long* __a, long __value,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedOr_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedOr_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedOr_rel(__a, __value);
- } else {
- return _InterlockedOr(__a, __value);
- }
-#else
+ return _InterlockedOr16(__a, __value);
+#endif
+}
+
+static inline long __msvc_atomic_fetch_or32(volatile long* __a, long __value,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedOr_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedOr_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedOr_rel(__a, __value);
+ } else {
+ return _InterlockedOr(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedOr(__a, __value);
-#endif
-}
-
-static inline __int64 __msvc_atomic_fetch_or64(volatile __int64* __a, __int64 __value,
- memory_order __order) {
-#if defined(_M_IX86)
- __int64 __tmp;
- do {
- __tmp = *__a;
- } while (__tmp != _InterlockedCompareExchange64(__a, __tmp | __value, __tmp));
- return __tmp;
-#elif defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedOr64_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedOr64_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedOr64_rel(__a, __value);
- } else {
- return _InterlockedOr64(__a, __value);
- }
-#else
+ return _InterlockedOr(__a, __value);
+#endif
+}
+
+static inline __int64 __msvc_atomic_fetch_or64(volatile __int64* __a, __int64 __value,
+ memory_order __order) {
+#if defined(_M_IX86)
+ __int64 __tmp;
+ do {
+ __tmp = *__a;
+ } while (__tmp != _InterlockedCompareExchange64(__a, __tmp | __value, __tmp));
+ return __tmp;
+#elif defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedOr64_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedOr64_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedOr64_rel(__a, __value);
+ } else {
+ return _InterlockedOr64(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedOr64(__a, __value);
-#endif
-}
-
-template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_or(volatile _Atomic(_Tp)* __a,
- _Tp __value, int __order) {
- if (sizeof(_Tp) == 1 && (std::is_integral<_Tp>::value || std::is_same<std::remove_cv_t<_Tp>, bool>::value)) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_or8((volatile char*)__a, __msvc_cast<char>(__value), (memory_order)__order));
- } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
- return (_Tp)__msvc_atomic_fetch_or16((volatile short*)__a, (short)__value, (memory_order)__order);
- } else if (sizeof(_Tp) == 4 && std::is_integral<_Tp>::value) {
- return (_Tp) __msvc_atomic_fetch_or32((volatile long*)__a, (long)__value, (memory_order)__order);
- } else if (sizeof(_Tp) == 8 && std::is_integral<_Tp>::value) {
- return (_Tp) __msvc_atomic_fetch_or64((volatile __int64*)__a, (__int64)__value, (memory_order)__order);
- } else {
- __msvc_lock((void*)__a);
- _Tp __result = *(_Atomic(_Tp)*)__a;
- *(_Atomic(_Tp)*)__a |= __value;
- __msvc_unlock((void*)__a);
- return __result;
- }
-}
-
-template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_or(_Atomic(_Tp)* __a,
- _Tp __value, int __order) {
- return __c11_atomic_fetch_or((volatile _Atomic(_Tp)*)__a, __value, __order);
-}
-
-static inline char __msvc_atomic_fetch_xor8(volatile char* __a, char __value,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedXor8_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedXor8_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedXor8_rel(__a, __value);
- } else {
- return _InterlockedXor8(__a, __value);
- }
-#else
+ return _InterlockedOr64(__a, __value);
+#endif
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_or(volatile _Atomic(_Tp)* __a,
+ _Tp __value, int __order) {
+ if (sizeof(_Tp) == 1 && (std::is_integral<_Tp>::value || std::is_same<std::remove_cv_t<_Tp>, bool>::value)) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_or8((volatile char*)__a, __msvc_cast<char>(__value), (memory_order)__order));
+ } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
+ return (_Tp)__msvc_atomic_fetch_or16((volatile short*)__a, (short)__value, (memory_order)__order);
+ } else if (sizeof(_Tp) == 4 && std::is_integral<_Tp>::value) {
+ return (_Tp) __msvc_atomic_fetch_or32((volatile long*)__a, (long)__value, (memory_order)__order);
+ } else if (sizeof(_Tp) == 8 && std::is_integral<_Tp>::value) {
+ return (_Tp) __msvc_atomic_fetch_or64((volatile __int64*)__a, (__int64)__value, (memory_order)__order);
+ } else {
+ __msvc_lock((void*)__a);
+ _Tp __result = *(_Atomic(_Tp)*)__a;
+ *(_Atomic(_Tp)*)__a |= __value;
+ __msvc_unlock((void*)__a);
+ return __result;
+ }
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_or(_Atomic(_Tp)* __a,
+ _Tp __value, int __order) {
+ return __c11_atomic_fetch_or((volatile _Atomic(_Tp)*)__a, __value, __order);
+}
+
+static inline char __msvc_atomic_fetch_xor8(volatile char* __a, char __value,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedXor8_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedXor8_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedXor8_rel(__a, __value);
+ } else {
+ return _InterlockedXor8(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedXor8(__a, __value);
-#endif
-}
-
-static inline short __msvc_atomic_fetch_xor16(volatile short* __a, short __value,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedXor16_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedXor16_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedXor16_rel(__a, __value);
- } else {
- return _InterlockedXor16(__a, __value);
- }
-#else
+ return _InterlockedXor8(__a, __value);
+#endif
+}
+
+static inline short __msvc_atomic_fetch_xor16(volatile short* __a, short __value,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedXor16_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedXor16_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedXor16_rel(__a, __value);
+ } else {
+ return _InterlockedXor16(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedXor16(__a, __value);
-#endif
-}
-
-static inline long __msvc_atomic_fetch_xor32(volatile long* __a, long __value,
- memory_order __order) {
-#if defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedXor_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedXor_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedXor_rel(__a, __value);
- } else {
- return _InterlockedXor(__a, __value);
- }
-#else
+ return _InterlockedXor16(__a, __value);
+#endif
+}
+
+static inline long __msvc_atomic_fetch_xor32(volatile long* __a, long __value,
+ memory_order __order) {
+#if defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedXor_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedXor_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedXor_rel(__a, __value);
+ } else {
+ return _InterlockedXor(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedXor(__a, __value);
-#endif
-}
-
-static inline __int64 __msvc_atomic_fetch_xor64(volatile __int64* __a, __int64 __value,
- memory_order __order) {
-#if defined(_M_IX86)
- __int64 __tmp;
- do {
- __tmp = *__a;
- } while (__tmp != _InterlockedCompareExchange64(__a, __tmp ^ __value, __tmp));
- return __tmp;
-#elif defined(_M_ARM) || defined(_M_ARM64)
- if (__order == memory_order_relaxed) {
- return _InterlockedXor64_nf(__a, __value);
- } else if (__order == memory_order_acquire) {
- return _InterlockedXor64_acq(__a, __value);
- } else if (__order == memory_order_release) {
- return _InterlockedXor64_rel(__a, __value);
- } else {
- return _InterlockedXor64(__a, __value);
- }
-#else
+ return _InterlockedXor(__a, __value);
+#endif
+}
+
+static inline __int64 __msvc_atomic_fetch_xor64(volatile __int64* __a, __int64 __value,
+ memory_order __order) {
+#if defined(_M_IX86)
+ __int64 __tmp;
+ do {
+ __tmp = *__a;
+ } while (__tmp != _InterlockedCompareExchange64(__a, __tmp ^ __value, __tmp));
+ return __tmp;
+#elif defined(_M_ARM) || defined(_M_ARM64)
+ if (__order == memory_order_relaxed) {
+ return _InterlockedXor64_nf(__a, __value);
+ } else if (__order == memory_order_acquire) {
+ return _InterlockedXor64_acq(__a, __value);
+ } else if (__order == memory_order_release) {
+ return _InterlockedXor64_rel(__a, __value);
+ } else {
+ return _InterlockedXor64(__a, __value);
+ }
+#else
(void)__order;
- return _InterlockedXor64(__a, __value);
-#endif
-}
-
-template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_xor(volatile _Atomic(_Tp)* __a,
- _Tp __value, int __order) {
- if (sizeof(_Tp) == 1 && (std::is_integral<_Tp>::value || std::is_same<std::remove_cv_t<_Tp>, bool>::value)) {
- return __msvc_cast<_Tp>(__msvc_atomic_fetch_xor8((volatile char*)__a, __msvc_cast<char>(__value), (memory_order)__order));
- } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
- return (_Tp)__msvc_atomic_fetch_xor16((volatile short*)__a, (short)__value, (memory_order)__order);
- } else if (sizeof(_Tp) == 4 && std::is_integral<_Tp>::value) {
- return (_Tp) __msvc_atomic_fetch_xor32((volatile long*)__a, (long)__value, (memory_order)__order);
- } else if (sizeof(_Tp) == 8 && std::is_integral<_Tp>::value) {
- return (_Tp) __msvc_atomic_fetch_xor64((volatile __int64*)__a, (__int64)__value, (memory_order)__order);
- } else {
- __msvc_lock((void*)__a);
- _Tp __result = *(_Atomic(_Tp)*)__a;
- *(_Atomic(_Tp)*)__a ^= __value;
- __msvc_unlock((void*)__a);
- return __result;
- }
-}
-
-template <typename _Tp>
-static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a,
- _Tp __value, int __order) {
- return __c11_atomic_fetch_xor((volatile _Atomic(_Tp)*)__a, __value, __order);
-}
-
-static constexpr bool __atomic_is_lock_free(size_t __size, void*) {
- return __size <= 8;
-}
-
-static constexpr bool __atomic_always_lock_free(size_t __size, void*) {
- return __size <= 8;
-}
-
-#define __CLANG_ATOMIC_BOOL_LOCK_FREE 2
-#define __CLANG_ATOMIC_CHAR_LOCK_FREE 2
-#define __CLANG_ATOMIC_CHAR8_T_LOCK_FREE 2
-#define __CLANG_ATOMIC_CHAR16_T_LOCK_FREE 2
-#define __CLANG_ATOMIC_CHAR32_T_LOCK_FREE 2
-#define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2
-#define __CLANG_ATOMIC_SHORT_LOCK_FREE 2
-#define __CLANG_ATOMIC_INT_LOCK_FREE 2
-#define __CLANG_ATOMIC_LONG_LOCK_FREE 2
-#define __CLANG_ATOMIC_LLONG_LOCK_FREE 2
-#define __CLANG_ATOMIC_POINTER_LOCK_FREE 2
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif
+ return _InterlockedXor64(__a, __value);
+#endif
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_xor(volatile _Atomic(_Tp)* __a,
+ _Tp __value, int __order) {
+ if (sizeof(_Tp) == 1 && (std::is_integral<_Tp>::value || std::is_same<std::remove_cv_t<_Tp>, bool>::value)) {
+ return __msvc_cast<_Tp>(__msvc_atomic_fetch_xor8((volatile char*)__a, __msvc_cast<char>(__value), (memory_order)__order));
+ } else if (sizeof(_Tp) == 2 && std::is_integral<_Tp>::value) {
+ return (_Tp)__msvc_atomic_fetch_xor16((volatile short*)__a, (short)__value, (memory_order)__order);
+ } else if (sizeof(_Tp) == 4 && std::is_integral<_Tp>::value) {
+ return (_Tp) __msvc_atomic_fetch_xor32((volatile long*)__a, (long)__value, (memory_order)__order);
+ } else if (sizeof(_Tp) == 8 && std::is_integral<_Tp>::value) {
+ return (_Tp) __msvc_atomic_fetch_xor64((volatile __int64*)__a, (__int64)__value, (memory_order)__order);
+ } else {
+ __msvc_lock((void*)__a);
+ _Tp __result = *(_Atomic(_Tp)*)__a;
+ *(_Atomic(_Tp)*)__a ^= __value;
+ __msvc_unlock((void*)__a);
+ return __result;
+ }
+}
+
+template <typename _Tp>
+static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a,
+ _Tp __value, int __order) {
+ return __c11_atomic_fetch_xor((volatile _Atomic(_Tp)*)__a, __value, __order);
+}
+
+static constexpr bool __atomic_is_lock_free(size_t __size, void*) {
+ return __size <= 8;
+}
+
+static constexpr bool __atomic_always_lock_free(size_t __size, void*) {
+ return __size <= 8;
+}
+
+#define __CLANG_ATOMIC_BOOL_LOCK_FREE 2
+#define __CLANG_ATOMIC_CHAR_LOCK_FREE 2
+#define __CLANG_ATOMIC_CHAR8_T_LOCK_FREE 2
+#define __CLANG_ATOMIC_CHAR16_T_LOCK_FREE 2
+#define __CLANG_ATOMIC_CHAR32_T_LOCK_FREE 2
+#define __CLANG_ATOMIC_WCHAR_T_LOCK_FREE 2
+#define __CLANG_ATOMIC_SHORT_LOCK_FREE 2
+#define __CLANG_ATOMIC_INT_LOCK_FREE 2
+#define __CLANG_ATOMIC_LONG_LOCK_FREE 2
+#define __CLANG_ATOMIC_LLONG_LOCK_FREE 2
+#define __CLANG_ATOMIC_POINTER_LOCK_FREE 2
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/win32/limits_msvc_win32.h b/contrib/libs/cxxsupp/libcxx/include/__support/win32/limits_msvc_win32.h
index d0903357da..7fc7397eb5 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/win32/limits_msvc_win32.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/win32/limits_msvc_win32.h
@@ -1,70 +1,70 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H
-#define _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H
-
-#if !defined(_LIBCPP_MSVCRT)
-#error "This header complements the Microsoft C Runtime library, and should not be included otherwise."
-#endif
-#if defined(__clang__)
-#error "This header should only be included when using Microsofts C1XX frontend"
-#endif
-
-#include <float.h> // limit constants
-#include <limits.h> // CHAR_BIT
-#include <math.h> // HUGE_VAL
-
-#define __CHAR_BIT__ CHAR_BIT
-
-#define __FLT_MANT_DIG__ FLT_MANT_DIG
-#define __FLT_DIG__ FLT_DIG
-#define __FLT_RADIX__ FLT_RADIX
-#define __FLT_MIN_EXP__ FLT_MIN_EXP
-#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
-#define __FLT_MAX_EXP__ FLT_MAX_EXP
-#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
-#define __FLT_MIN__ FLT_MIN
-#define __FLT_MAX__ FLT_MAX
-#define __FLT_EPSILON__ FLT_EPSILON
-// predefined by MinGW GCC
-#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
-
-#define __DBL_MANT_DIG__ DBL_MANT_DIG
-#define __DBL_DIG__ DBL_DIG
-#define __DBL_RADIX__ DBL_RADIX
-#define __DBL_MIN_EXP__ DBL_MIN_EXP
-#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
-#define __DBL_MAX_EXP__ DBL_MAX_EXP
-#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
-#define __DBL_MIN__ DBL_MIN
-#define __DBL_MAX__ DBL_MAX
-#define __DBL_EPSILON__ DBL_EPSILON
-// predefined by MinGW GCC
-#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
-
-#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
-#define __LDBL_DIG__ LDBL_DIG
-#define __LDBL_RADIX__ LDBL_RADIX
-#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
-#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
-#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
-#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
-#define __LDBL_MIN__ LDBL_MIN
-#define __LDBL_MAX__ LDBL_MAX
-#define __LDBL_EPSILON__ LDBL_EPSILON
-// predefined by MinGW GCC
-#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
-
-// __builtin replacements/workarounds
-#define __builtin_huge_vall() ((long double)__builtin_huge_val())
-#define __builtin_nanl(__dummy) ((long double)__builtin_nan(__dummy))
-#define __builtin_nansl(__dummy) ((long double)__builtin_nans(__dummy))
-
-#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H
+#define _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H
+
+#if !defined(_LIBCPP_MSVCRT)
+#error "This header complements the Microsoft C Runtime library, and should not be included otherwise."
+#endif
+#if defined(__clang__)
+#error "This header should only be included when using Microsofts C1XX frontend"
+#endif
+
+#include <float.h> // limit constants
+#include <limits.h> // CHAR_BIT
+#include <math.h> // HUGE_VAL
+
+#define __CHAR_BIT__ CHAR_BIT
+
+#define __FLT_MANT_DIG__ FLT_MANT_DIG
+#define __FLT_DIG__ FLT_DIG
+#define __FLT_RADIX__ FLT_RADIX
+#define __FLT_MIN_EXP__ FLT_MIN_EXP
+#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
+#define __FLT_MAX_EXP__ FLT_MAX_EXP
+#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
+#define __FLT_MIN__ FLT_MIN
+#define __FLT_MAX__ FLT_MAX
+#define __FLT_EPSILON__ FLT_EPSILON
+// predefined by MinGW GCC
+#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
+
+#define __DBL_MANT_DIG__ DBL_MANT_DIG
+#define __DBL_DIG__ DBL_DIG
+#define __DBL_RADIX__ DBL_RADIX
+#define __DBL_MIN_EXP__ DBL_MIN_EXP
+#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
+#define __DBL_MAX_EXP__ DBL_MAX_EXP
+#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
+#define __DBL_MIN__ DBL_MIN
+#define __DBL_MAX__ DBL_MAX
+#define __DBL_EPSILON__ DBL_EPSILON
+// predefined by MinGW GCC
+#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
+
+#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
+#define __LDBL_DIG__ LDBL_DIG
+#define __LDBL_RADIX__ LDBL_RADIX
+#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
+#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
+#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
+#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
+#define __LDBL_MIN__ LDBL_MIN
+#define __LDBL_MAX__ LDBL_MAX
+#define __LDBL_EPSILON__ LDBL_EPSILON
+// predefined by MinGW GCC
+#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
+
+// __builtin replacements/workarounds
+#define __builtin_huge_vall() ((long double)__builtin_huge_val())
+#define __builtin_nanl(__dummy) ((long double)__builtin_nan(__dummy))
+#define __builtin_nansl(__dummy) ((long double)__builtin_nans(__dummy))
+
+#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H
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 69491bf746..2bab0dab9d 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/win32/locale_win32.h
@@ -1,259 +1,259 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
-#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
-
-#include <__config>
-#include <__nullptr>
-#include <locale.h> // _locale_t
-#include <stdio.h>
-
-#define _X_ALL LC_ALL
-#define _X_COLLATE LC_COLLATE
-#define _X_CTYPE LC_CTYPE
-#define _X_MONETARY LC_MONETARY
-#define _X_NUMERIC LC_NUMERIC
-#define _X_TIME LC_TIME
-#define _X_MAX LC_MAX
-#define _X_MESSAGES 6
-#define _NCAT (_X_MESSAGES + 1)
-
-#define _CATMASK(n) ((1 << (n)) >> 1)
-#define _M_COLLATE _CATMASK(_X_COLLATE)
-#define _M_CTYPE _CATMASK(_X_CTYPE)
-#define _M_MONETARY _CATMASK(_X_MONETARY)
-#define _M_NUMERIC _CATMASK(_X_NUMERIC)
-#define _M_TIME _CATMASK(_X_TIME)
-#define _M_MESSAGES _CATMASK(_X_MESSAGES)
-#define _M_ALL (_CATMASK(_NCAT) - 1)
-
-#define LC_COLLATE_MASK _M_COLLATE
-#define LC_CTYPE_MASK _M_CTYPE
-#define LC_MONETARY_MASK _M_MONETARY
-#define LC_NUMERIC_MASK _M_NUMERIC
-#define LC_TIME_MASK _M_TIME
-#define LC_MESSAGES_MASK _M_MESSAGES
-#define LC_MESSAGES _X_MESSAGES
-#define LC_ALL_MASK _M_ALL
-
-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;
- }
-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;
-};
-
-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) {}
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
+#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
+
+#include <__config>
+#include <__nullptr>
+#include <locale.h> // _locale_t
+#include <stdio.h>
+
+#define _X_ALL LC_ALL
+#define _X_COLLATE LC_COLLATE
+#define _X_CTYPE LC_CTYPE
+#define _X_MONETARY LC_MONETARY
+#define _X_NUMERIC LC_NUMERIC
+#define _X_TIME LC_TIME
+#define _X_MAX LC_MAX
+#define _X_MESSAGES 6
+#define _NCAT (_X_MESSAGES + 1)
+
+#define _CATMASK(n) ((1 << (n)) >> 1)
+#define _M_COLLATE _CATMASK(_X_COLLATE)
+#define _M_CTYPE _CATMASK(_X_CTYPE)
+#define _M_MONETARY _CATMASK(_X_MONETARY)
+#define _M_NUMERIC _CATMASK(_X_NUMERIC)
+#define _M_TIME _CATMASK(_X_TIME)
+#define _M_MESSAGES _CATMASK(_X_MESSAGES)
+#define _M_ALL (_CATMASK(_NCAT) - 1)
+
+#define LC_COLLATE_MASK _M_COLLATE
+#define LC_CTYPE_MASK _M_CTYPE
+#define LC_MONETARY_MASK _M_MONETARY
+#define LC_NUMERIC_MASK _M_NUMERIC
+#define LC_TIME_MASK _M_TIME
+#define LC_MESSAGES_MASK _M_MESSAGES
+#define LC_MESSAGES _X_MESSAGES
+#define LC_ALL_MASK _M_ALL
+
+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;
+ }
+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;
+};
+
+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();
- }
-private:
- _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 );
-// 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 );
-
-// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
-#define mbtowc_l _mbtowc_l
-#define strtoll_l _strtoi64_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
-#else
-_LIBCPP_FUNC_VIS float strtof_l(const char*, char**, locale_t);
-_LIBCPP_FUNC_VIS long double strtold_l(const char*, char**, locale_t);
-#endif
-#define isupper_l _isupper_l
-#define islower_l _islower_l
-#define isblank_l _isblank_l
-#define isdigit_l _isdigit_l
-#define isxdigit_l _isxdigit_l
-#define strcoll_l _strcoll_l
-#define strxfrm_l _strxfrm_l
-#define wcscoll_l _wcscoll_l
-#define wcsxfrm_l _wcsxfrm_l
-#define toupper_l _toupper_l
-#define tolower_l _tolower_l
-#define iswspace_l _iswspace_l
-#define iswprint_l _iswprint_l
-#define iswcntrl_l _iswcntrl_l
-#define iswupper_l _iswupper_l
-#define iswlower_l _iswlower_l
-#define iswblank_l _iswblank_l
-#define iswalpha_l _iswalpha_l
-#define iswdigit_l _iswdigit_l
-#define iswpunct_l _iswpunct_l
-#define iswxdigit_l _iswxdigit_l
-#define towupper_l _towupper_l
-#define towlower_l _towlower_l
-#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
-_LIBCPP_FUNC_VIS 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
-#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__ )
-#define snprintf_l(__s, __n, __l, __f, ...) _snprintf_l( __s, __n, __f, __l, ##__VA_ARGS__ )
-_LIBCPP_FUNC_VIS int asprintf_l( char **__ret, locale_t __loc, const char *__format, ... );
-_LIBCPP_FUNC_VIS int vasprintf_l( char **__ret, locale_t __loc, const char *__format, va_list __ap );
-
-#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
+ : __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 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 );
+// 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 );
+
+// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
+#define mbtowc_l _mbtowc_l
+#define strtoll_l _strtoi64_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
+#else
+_LIBCPP_FUNC_VIS float strtof_l(const char*, char**, locale_t);
+_LIBCPP_FUNC_VIS long double strtold_l(const char*, char**, locale_t);
+#endif
+#define isupper_l _isupper_l
+#define islower_l _islower_l
+#define isblank_l _isblank_l
+#define isdigit_l _isdigit_l
+#define isxdigit_l _isxdigit_l
+#define strcoll_l _strcoll_l
+#define strxfrm_l _strxfrm_l
+#define wcscoll_l _wcscoll_l
+#define wcsxfrm_l _wcsxfrm_l
+#define toupper_l _toupper_l
+#define tolower_l _tolower_l
+#define iswspace_l _iswspace_l
+#define iswprint_l _iswprint_l
+#define iswcntrl_l _iswcntrl_l
+#define iswupper_l _iswupper_l
+#define iswlower_l _iswlower_l
+#define iswblank_l _iswblank_l
+#define iswalpha_l _iswalpha_l
+#define iswdigit_l _iswdigit_l
+#define iswpunct_l _iswpunct_l
+#define iswxdigit_l _iswxdigit_l
+#define towupper_l _towupper_l
+#define towlower_l _towlower_l
+#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800
+_LIBCPP_FUNC_VIS 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
+#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__ )
+#define snprintf_l(__s, __n, __l, __f, ...) _snprintf_l( __s, __n, __f, __l, ##__VA_ARGS__ )
+_LIBCPP_FUNC_VIS int asprintf_l( char **__ret, locale_t __loc, const char *__format, ... );
+_LIBCPP_FUNC_VIS int vasprintf_l( char **__ret, locale_t __loc, const char *__format, va_list __ap );
+
+#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 57b18842ff..f0889ea562 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
@@ -1,51 +1,51 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H
-#define _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Patch over lack of extended locale support
-typedef void *locale_t;
-static inline locale_t duplocale(locale_t) {
- return NULL;
-}
-
-static inline void freelocale(locale_t) {
-}
-
-static inline locale_t newlocale(int, const char *, locale_t) {
- return NULL;
-}
-
-static inline locale_t uselocale(locale_t) {
- return NULL;
-}
-
-#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)
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif // _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H
+#define _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Patch over lack of extended locale support
+typedef void *locale_t;
+static inline locale_t duplocale(locale_t) {
+ return NULL;
+}
+
+static inline void freelocale(locale_t) {
+}
+
+static inline locale_t newlocale(int, const char *, locale_t) {
+ return NULL;
+}
+
+static inline locale_t uselocale(locale_t) {
+ return NULL;
+}
+
+#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)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _LIBCPP_SUPPORT_XLOCALE_NOP_LOCALE_MGMT_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h
index 00d69d19e8..ac8fa4c3c8 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__posix_l_fallback.h
@@ -1,164 +1,164 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-// These are reimplementations of some extended locale functions ( *_l ) that
-// are normally part of POSIX. This shared implementation provides parts of the
-// extended locale support for libc's that normally don't have any (like
-// Android's bionic and Newlib).
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
-#define _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-inline _LIBCPP_INLINE_VISIBILITY int isalnum_l(int c, locale_t) {
- return ::isalnum(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int isalpha_l(int c, locale_t) {
- return ::isalpha(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int isblank_l(int c, locale_t) {
- return ::isblank(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iscntrl_l(int c, locale_t) {
- return ::iscntrl(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int isdigit_l(int c, locale_t) {
- return ::isdigit(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int isgraph_l(int c, locale_t) {
- return ::isgraph(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int islower_l(int c, locale_t) {
- return ::islower(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int isprint_l(int c, locale_t) {
- return ::isprint(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int ispunct_l(int c, locale_t) {
- return ::ispunct(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int isspace_l(int c, locale_t) {
- return ::isspace(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int isupper_l(int c, locale_t) {
- return ::isupper(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int isxdigit_l(int c, locale_t) {
- return ::isxdigit(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswalnum_l(wint_t c, locale_t) {
- return ::iswalnum(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswalpha_l(wint_t c, locale_t) {
- return ::iswalpha(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswblank_l(wint_t c, locale_t) {
- return ::iswblank(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswcntrl_l(wint_t c, locale_t) {
- return ::iswcntrl(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswdigit_l(wint_t c, locale_t) {
- return ::iswdigit(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswgraph_l(wint_t c, locale_t) {
- return ::iswgraph(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswlower_l(wint_t c, locale_t) {
- return ::iswlower(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswprint_l(wint_t c, locale_t) {
- return ::iswprint(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswpunct_l(wint_t c, locale_t) {
- return ::iswpunct(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswspace_l(wint_t c, locale_t) {
- return ::iswspace(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswupper_l(wint_t c, locale_t) {
- return ::iswupper(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int iswxdigit_l(wint_t c, locale_t) {
- return ::iswxdigit(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int toupper_l(int c, locale_t) {
- return ::toupper(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int tolower_l(int c, locale_t) {
- return ::tolower(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY wint_t towupper_l(wint_t c, locale_t) {
- return ::towupper(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY wint_t towlower_l(wint_t c, locale_t) {
- return ::towlower(c);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY int strcoll_l(const char *s1, const char *s2,
+//
+//===----------------------------------------------------------------------===//
+// These are reimplementations of some extended locale functions ( *_l ) that
+// are normally part of POSIX. This shared implementation provides parts of the
+// extended locale support for libc's that normally don't have any (like
+// Android's bionic and Newlib).
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
+#define _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+inline _LIBCPP_INLINE_VISIBILITY int isalnum_l(int c, locale_t) {
+ return ::isalnum(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int isalpha_l(int c, locale_t) {
+ return ::isalpha(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int isblank_l(int c, locale_t) {
+ return ::isblank(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iscntrl_l(int c, locale_t) {
+ return ::iscntrl(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int isdigit_l(int c, locale_t) {
+ return ::isdigit(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int isgraph_l(int c, locale_t) {
+ return ::isgraph(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int islower_l(int c, locale_t) {
+ return ::islower(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int isprint_l(int c, locale_t) {
+ return ::isprint(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int ispunct_l(int c, locale_t) {
+ return ::ispunct(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int isspace_l(int c, locale_t) {
+ return ::isspace(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int isupper_l(int c, locale_t) {
+ return ::isupper(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int isxdigit_l(int c, locale_t) {
+ return ::isxdigit(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswalnum_l(wint_t c, locale_t) {
+ return ::iswalnum(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswalpha_l(wint_t c, locale_t) {
+ return ::iswalpha(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswblank_l(wint_t c, locale_t) {
+ return ::iswblank(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswcntrl_l(wint_t c, locale_t) {
+ return ::iswcntrl(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswdigit_l(wint_t c, locale_t) {
+ return ::iswdigit(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswgraph_l(wint_t c, locale_t) {
+ return ::iswgraph(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswlower_l(wint_t c, locale_t) {
+ return ::iswlower(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswprint_l(wint_t c, locale_t) {
+ return ::iswprint(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswpunct_l(wint_t c, locale_t) {
+ return ::iswpunct(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswspace_l(wint_t c, locale_t) {
+ return ::iswspace(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswupper_l(wint_t c, locale_t) {
+ return ::iswupper(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int iswxdigit_l(wint_t c, locale_t) {
+ return ::iswxdigit(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int toupper_l(int c, locale_t) {
+ return ::toupper(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int tolower_l(int c, locale_t) {
+ return ::tolower(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY wint_t towupper_l(wint_t c, locale_t) {
+ return ::towupper(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY wint_t towlower_l(wint_t c, locale_t) {
+ return ::towlower(c);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int strcoll_l(const char *s1, const char *s2,
locale_t) {
- return ::strcoll(s1, s2);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY size_t strxfrm_l(char *dest, const char *src,
+ return ::strcoll(s1, s2);
+}
+
+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_INLINE_VISIBILITY size_t strftime_l(char *s, size_t max,
+ return ::strxfrm(dest, src, n);
+}
+
+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_INLINE_VISIBILITY int wcscoll_l(const wchar_t *ws1,
+ return ::strftime(s, max, format, tm);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int wcscoll_l(const wchar_t *ws1,
const wchar_t *ws2, locale_t) {
- return ::wcscoll(ws1, ws2);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src,
+ return ::wcscoll(ws1, ws2);
+}
+
+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);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
+ return ::wcsxfrm(dest, src, n);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _LIBCPP_SUPPORT_XLOCALE_POSIX_L_FALLBACK_H
diff --git a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h
index 1172a5d572..a734b8ac8a 100644
--- a/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h
+++ b/contrib/libs/cxxsupp/libcxx/include/__support/xlocale/__strtonum_fallback.h
@@ -1,66 +1,66 @@
-// -*- C++ -*-
-//===-----------------------------------------------------------------------===//
-//
+// -*- C++ -*-
+//===-----------------------------------------------------------------------===//
+//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-// These are reimplementations of some extended locale functions ( *_l ) that
-// aren't part of POSIX. They are widely available though (GLIBC, BSD, maybe
-// others). The unifying aspect in this case is that all of these functions
-// convert strings to some numeric type.
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
-#define _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char *nptr,
+//
+//===----------------------------------------------------------------------===//
+// These are reimplementations of some extended locale functions ( *_l ) that
+// aren't part of POSIX. They are widely available though (GLIBC, BSD, maybe
+// others). The unifying aspect in this case is that all of these functions
+// convert strings to some numeric type.
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
+#define _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
+
+#ifdef __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,
+ 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 double strtold_l(const char *nptr,
+ return ::strtod(nptr, endptr);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY long double strtold_l(const char *nptr,
char **endptr, locale_t) {
- return ::strtold(nptr, endptr);
-}
-
-inline _LIBCPP_INLINE_VISIBILITY long long
-strtoll_l(const char *nptr, char **endptr, int base, locale_t) {
- return ::strtoll(nptr, endptr, base);
-}
-
-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_INLINE_VISIBILITY long long
-wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
- return ::wcstoll(nptr, endptr, base);
-}
-
-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_INLINE_VISIBILITY long double wcstold_l(const wchar_t *nptr,
+ return ::strtold(nptr, endptr);
+}
+
+inline _LIBCPP_INLINE_VISIBILITY long long
+strtoll_l(const char *nptr, char **endptr, int base, locale_t) {
+ return ::strtoll(nptr, endptr, base);
+}
+
+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_INLINE_VISIBILITY long long
+wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
+ return ::wcstoll(nptr, endptr, base);
+}
+
+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_INLINE_VISIBILITY long double wcstold_l(const wchar_t *nptr,
wchar_t **endptr, locale_t) {
- return ::wcstold(nptr, endptr);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
+ return ::wcstold(nptr, endptr);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H