[libc++][RFC] Always define internal feature test macros (#89178)

Currently, the library-internal feature test macros are only defined if
the feature is not available, and always have the prefix
`_LIBCPP_HAS_NO_`. This patch changes that, so that they are always
defined and have the prefix `_LIBCPP_HAS_` instead. This changes the
canonical use of these macros to `#if _LIBCPP_HAS_FEATURE`, which means
that using an undefined macro (e.g. due to a missing include) is
diagnosed now. While this is rather unlikely currently, a similar change
in `<__configuration/availability.h>` caught a few bugs. This also
improves readability, since it removes the double-negation of `#ifndef
_LIBCPP_HAS_NO_FEATURE`.

The current patch only touches the macros defined in `<__config>`. If
people are happy with this approach, I'll make a follow-up PR to also
change the macros defined in `<__config_site>`.
This commit is contained in:
Nikolas Klauser 2024-10-12 09:49:52 +02:00 committed by GitHub
parent dbd197118d
commit ba87515fea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
136 changed files with 1003 additions and 813 deletions

View File

@ -37,7 +37,7 @@ using atomic_long = atomic<long>;
using atomic_ulong = atomic<unsigned long>;
using atomic_llong = atomic<long long>;
using atomic_ullong = atomic<unsigned long long>;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
using atomic_char8_t = atomic<char8_t>;
#endif
using atomic_char16_t = atomic<char16_t>;

View File

@ -18,7 +18,7 @@
#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE)
# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE
# endif
# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
@ -32,7 +32,7 @@
#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE
# endif
# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE

View File

@ -32,7 +32,7 @@ template <integral _Tp>
return __builtin_bswap32(__val);
} else if constexpr (sizeof(_Tp) == 8) {
return __builtin_bswap64(__val);
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
} else if constexpr (sizeof(_Tp) == 16) {
# if __has_builtin(__builtin_bswap128)
return __builtin_bswap128(__val);
@ -40,7 +40,7 @@ template <integral _Tp>
return static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val))) << 64 |
static_cast<_Tp>(byteswap(static_cast<uint64_t>(__val >> 64)));
# endif // __has_builtin(__builtin_bswap128)
# endif // _LIBCPP_HAS_NO_INT128
# endif // _LIBCPP_HAS_INT128
} else {
static_assert(sizeof(_Tp) == 0, "byteswap is unimplemented for integral types of this size");
}

View File

@ -39,7 +39,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
return __builtin_clzll(__x);
}
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x) _NOEXCEPT {
# if __has_builtin(__builtin_clzg)
return __builtin_clzg(__x);
@ -57,7 +57,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x)
: __builtin_clzll(static_cast<unsigned long long>(__x >> 64));
# endif
}
#endif // _LIBCPP_HAS_NO_INT128
#endif // _LIBCPP_HAS_INT128
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _NOEXCEPT {

View File

@ -95,7 +95,7 @@ inline constexpr uint64_t __pow10_64[20] = {
UINT64_C(1000000000000000000),
UINT64_C(10000000000000000000)};
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
inline constexpr int __pow10_128_offset = 0;
inline constexpr __uint128_t __pow10_128[40] = {
UINT64_C(0),

View File

@ -124,7 +124,7 @@ __base_10_u64(char* __buffer, uint64_t __value) noexcept {
return __itoa::__append10(__buffer, __value);
}
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
/// \returns 10^\a exp
///
/// \pre \a exp [19, 39]

View File

@ -71,7 +71,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) {
return {__last, errc::value_too_large};
}
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
template <>
inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) {

View File

@ -88,7 +88,7 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(uin
}
};
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
template <typename _Tp>
struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__uint128_t)> > {
using type = __uint128_t;

View File

@ -73,7 +73,7 @@ private:
template <class _Duration>
[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_nonexistent_local_time(
[[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw nonexistent_local_time(__time, __info);
# else
_LIBCPP_VERBOSE_ABORT("nonexistent_local_time was thrown in -fno-exceptions mode");
@ -117,7 +117,7 @@ private:
template <class _Duration>
[[noreturn]] _LIBCPP_AVAILABILITY_TZDB _LIBCPP_HIDE_FROM_ABI void __throw_ambiguous_local_time(
[[maybe_unused]] const local_time<_Duration>& __time, [[maybe_unused]] const local_info& __info) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw ambiguous_local_time(__time, __info);
# else
_LIBCPP_VERBOSE_ABORT("ambiguous_local_time was thrown in -fno-exceptions mode");

View File

@ -47,7 +47,7 @@ _LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
struct _FilesystemClock {
# if !defined(_LIBCPP_HAS_NO_INT128)
# if _LIBCPP_HAS_INT128
typedef __int128_t rep;
typedef nano period;
# else

View File

@ -45,7 +45,7 @@ class _LIBCPP_EXPORTED_FROM_ABI condition_variable {
public:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR condition_variable() _NOEXCEPT = default;
# ifdef _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
# if _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
~condition_variable() = default;
# else
~condition_variable();
@ -83,7 +83,7 @@ public:
private:
void
__do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
# if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
# if _LIBCPP_HAS_COND_CLOCKWAIT
_LIBCPP_HIDE_FROM_ABI void
__do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<chrono::steady_clock, chrono::nanoseconds>) _NOEXCEPT;
# endif
@ -180,7 +180,7 @@ cv_status condition_variable::wait_for(unique_lock<mutex>& __lk, const chrono::d
using __ns_rep = nanoseconds::rep;
steady_clock::time_point __c_now = steady_clock::now();
# if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
# if _LIBCPP_HAS_COND_CLOCKWAIT
using __clock_tp_ns = time_point<steady_clock, nanoseconds>;
__ns_rep __now_count_ns = std::__safe_nanosecond_cast(__c_now.time_since_epoch()).count();
# else
@ -205,7 +205,7 @@ condition_variable::wait_for(unique_lock<mutex>& __lk, const chrono::duration<_R
return wait_until(__lk, chrono::steady_clock::now() + __d, std::move(__pred));
}
# if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
# if _LIBCPP_HAS_COND_CLOCKWAIT
inline void condition_variable::__do_timed_wait(
unique_lock<mutex>& __lk, chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) _NOEXCEPT {
using namespace chrono;

View File

@ -225,9 +225,14 @@ _LIBCPP_HARDENING_MODE_DEBUG
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
# endif
# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
# define _LIBCPP_HAS_BITSCAN64
# define _LIBCPP_HAS_BITSCAN64 1
# else
# define _LIBCPP_HAS_BITSCAN64 0
# endif
# define _LIBCPP_HAS_OPEN_WITH_WCHAR
# define _LIBCPP_HAS_OPEN_WITH_WCHAR 1
# else
# define _LIBCPP_HAS_OPEN_WITH_WCHAR 0
# define _LIBCPP_HAS_BITSCAN64 0
# endif // defined(_WIN32)
# if defined(_AIX) && !defined(__64BIT__)
@ -318,23 +323,33 @@ typedef __char32_t char32_t;
// Objective-C++ features (opt-in)
# if __has_feature(objc_arc)
# define _LIBCPP_HAS_OBJC_ARC
# define _LIBCPP_HAS_OBJC_ARC 1
# else
# define _LIBCPP_HAS_OBJC_ARC 0
# endif
# if __has_feature(objc_arc_weak)
# define _LIBCPP_HAS_OBJC_ARC_WEAK
# define _LIBCPP_HAS_OBJC_ARC_WEAK 1
# else
# define _LIBCPP_HAS_OBJC_ARC_WEAK 0
# endif
# if __has_extension(blocks)
# define _LIBCPP_HAS_EXTENSION_BLOCKS
# define _LIBCPP_HAS_EXTENSION_BLOCKS 1
# else
# define _LIBCPP_HAS_EXTENSION_BLOCKS 0
# endif
# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__)
# define _LIBCPP_HAS_BLOCKS_RUNTIME
# if _LIBCPP_HAS_EXTENSION_BLOCKS && defined(__APPLE__)
# define _LIBCPP_HAS_BLOCKS_RUNTIME 1
# else
# define _LIBCPP_HAS_BLOCKS_RUNTIME 0
# endif
# if !__has_feature(address_sanitizer)
# define _LIBCPP_HAS_NO_ASAN
# if __has_feature(address_sanitizer)
# define _LIBCPP_HAS_ASAN 1
# else
# define _LIBCPP_HAS_ASAN 0
# endif
# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
@ -457,7 +472,7 @@ typedef __char32_t char32_t;
# define _LIBCPP_HARDENING_SIG n // "none"
# endif
# ifdef _LIBCPP_HAS_NO_EXCEPTIONS
# if !_LIBCPP_HAS_EXCEPTIONS
# define _LIBCPP_EXCEPTIONS_SIG n
# else
# define _LIBCPP_EXCEPTIONS_SIG e
@ -597,7 +612,9 @@ typedef __char32_t char32_t;
# endif
# if !defined(__SIZEOF_INT128__) || defined(_MSC_VER)
# define _LIBCPP_HAS_NO_INT128
# define _LIBCPP_HAS_INT128 0
# else
# define _LIBCPP_HAS_INT128 1
# endif
# ifdef _LIBCPP_CXX03_LANG
@ -629,33 +646,39 @@ typedef __char32_t char32_t;
// If we are getting operator new from the MSVC CRT, then allocation overloads
// for align_val_t were added in 19.12, aka VS 2017 version 15.3.
# if defined(_LIBCPP_MSVCRT) && defined(_MSC_VER) && _MSC_VER < 1912
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
# elif defined(_LIBCPP_ABI_VCRUNTIME) && !defined(__cpp_aligned_new)
// We're deferring to Microsoft's STL to provide aligned new et al. We don't
// have it unless the language feature test macro is defined.
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
# elif defined(__MVS__)
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 0
# else
# define _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION 1
# endif
# if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
# if !_LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606)
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 0
# else
# define _LIBCPP_HAS_ALIGNED_ALLOCATION 1
# endif
// It is not yet possible to use aligned_alloc() on all Apple platforms since
// 10.15 was the first version to ship an implementation of aligned_alloc().
# if defined(__APPLE__)
# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500)
# define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC
# endif
# if (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000)
# define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 0
# else
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 1
# endif
# elif defined(__ANDROID__) && __ANDROID_API__ < 28
// Android only provides aligned_alloc when targeting API 28 or higher.
# define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 0
# else
# define _LIBCPP_HAS_C11_ALIGNED_ALLOC 1
# endif
# if defined(__APPLE__) || defined(__FreeBSD__)
@ -667,7 +690,9 @@ typedef __char32_t char32_t;
# endif
# if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t)
# define _LIBCPP_HAS_NO_CHAR8_T
# define _LIBCPP_HAS_CHAR8_T 0
# else
# define _LIBCPP_HAS_CHAR8_T 1
# endif
// Deprecation macros.
@ -726,7 +751,7 @@ typedef __char32_t char32_t;
# define _LIBCPP_DEPRECATED_IN_CXX26
# endif
# if !defined(_LIBCPP_HAS_NO_CHAR8_T)
# if _LIBCPP_HAS_CHAR8_T
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED
# else
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
@ -821,12 +846,18 @@ typedef __char32_t char32_t;
# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
# if defined(__ANDROID__) && __ANDROID_API__ >= 30
# define _LIBCPP_HAS_COND_CLOCKWAIT
# define _LIBCPP_HAS_COND_CLOCKWAIT 1
# elif defined(_LIBCPP_GLIBC_PREREQ)
# if _LIBCPP_GLIBC_PREREQ(2, 30)
# define _LIBCPP_HAS_COND_CLOCKWAIT
# define _LIBCPP_HAS_COND_CLOCKWAIT 1
# else
# define _LIBCPP_HAS_COND_CLOCKWAIT 0
# endif
# else
# define _LIBCPP_HAS_COND_CLOCKWAIT 0
# endif
# else
# define _LIBCPP_HAS_COND_CLOCKWAIT 0
# endif
# if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
@ -863,7 +894,9 @@ typedef __char32_t char32_t;
(defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || \
defined(_LIBCPP_HAS_THREAD_API_WIN32)
// clang-format on
# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION 1
# else
# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION 0
# endif
// Destroying a condvar is a nop on Windows.
@ -875,7 +908,9 @@ typedef __char32_t char32_t;
// TODO(EricWF): This is potentially true for some pthread implementations
// as well.
# if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || defined(_LIBCPP_HAS_THREAD_API_WIN32)
# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 1
# else
# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 0
# endif
# if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \
@ -891,8 +926,9 @@ typedef __char32_t char32_t;
# if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \
!defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)
# define _LIBCPP_HAS_NO_ATOMIC_HEADER
# define _LIBCPP_HAS_ATOMIC_HEADER 0
# else
# define _LIBCPP_HAS_ATOMIC_HEADER 1
# ifndef _LIBCPP_ATOMIC_FLAG_TYPE
# define _LIBCPP_ATOMIC_FLAG_TYPE bool
# endif
@ -904,19 +940,18 @@ typedef __char32_t char32_t;
# define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
# endif
# if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
# if defined(__clang__) && __has_attribute(acquire_capability)
// Work around the attribute handling in clang. When both __declspec and
// __attribute__ are present, the processing goes awry preventing the definition
// of the types. In MinGW mode, __declspec evaluates to __attribute__, and thus
// combining the two does work.
# if !defined(_MSC_VER)
# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
# endif
# endif
# if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) && \
__has_attribute(acquire_capability) && !defined(_MSC_VER)
# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS 1
# else
# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS 0
# endif
# ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
# if _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x))
# else
# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x)
@ -997,7 +1032,7 @@ typedef __char32_t char32_t;
// functions is gradually being added to existing C libraries. The conditions
// below check for known C library versions and conditions under which these
// functions are declared by the C library.
# define _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8
//
// GNU libc 2.36 and newer declare c8rtomb() and mbrtoc8() in C++ modes if
// __cpp_char8_t is defined or if C2X extensions are enabled. Determining
// the latter depends on internal GNU libc details that are not appropriate
@ -1005,8 +1040,12 @@ typedef __char32_t char32_t;
// defined are ignored.
# if defined(_LIBCPP_GLIBC_PREREQ)
# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t)
# undef _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
# else
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
# endif
# else
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
# endif
// There are a handful of public standard library types that are intended to
@ -1188,7 +1227,9 @@ typedef __char32_t char32_t;
// Clang-18 has support for deducing this, but it does not set the FTM.
# if defined(__cpp_explicit_this_parameter) || (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1800)
# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER 1
# else
# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER 0
# endif
#endif // __cplusplus

View File

@ -409,10 +409,10 @@
#define _LIBCPP_AVAILABILITY_HAS_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19
#define _LIBCPP_AVAILABILITY_BAD_EXPECTED_ACCESS_KEY_FUNCTION _LIBCPP_INTRODUCED_IN_LLVM_19_ATTRIBUTE
// Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS.
// Define availability attributes that depend on _LIBCPP_HAS_EXCEPTIONS.
// Those are defined in terms of the availability attributes above, and
// should not be vendor-specific.
#if defined(_LIBCPP_HAS_NO_EXCEPTIONS)
#if !_LIBCPP_HAS_EXCEPTIONS
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
@ -423,8 +423,8 @@
#endif
// Define availability attributes that depend on both
// _LIBCPP_HAS_NO_EXCEPTIONS and _LIBCPP_HAS_NO_RTTI.
#if defined(_LIBCPP_HAS_NO_EXCEPTIONS) || defined(_LIBCPP_HAS_NO_RTTI)
// _LIBCPP_HAS_EXCEPTIONS and _LIBCPP_HAS_RTTI.
#if !_LIBCPP_HAS_EXCEPTIONS || !_LIBCPP_HAS_RTTI
# undef _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION
# undef _LIBCPP_AVAILABILITY_INIT_PRIMARY_EXCEPTION
# define _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION 0

View File

@ -35,12 +35,16 @@
#endif // __cplusplus
// NOLINTEND(libcpp-cpp-version-check)
#if !defined(__cpp_rtti) || __cpp_rtti < 199711L
# define _LIBCPP_HAS_NO_RTTI
#if defined(__cpp_rtti) && __cpp_rtti >= 199711L
# define _LIBCPP_HAS_RTTI 1
#else
# define _LIBCPP_HAS_RTTI 0
#endif
#if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L
# define _LIBCPP_HAS_NO_EXCEPTIONS
#if defined(__cpp_exceptions) && __cpp_exceptions >= 199711L
# define _LIBCPP_HAS_EXCEPTIONS 1
#else
# define _LIBCPP_HAS_EXCEPTIONS 0
#endif
#endif // _LIBCPP___CONFIGURATION_LANGUAGE_H

View File

@ -17,7 +17,7 @@
# pragma GCC system_header
#endif
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
extern "C" {
_LIBCPP_EXPORTED_FROM_ABI void
@ -28,12 +28,12 @@ _LIBCPP_EXPORTED_FROM_ABI int
__sanitizer_verify_double_ended_contiguous_container(const void*, const void*, const void*, const void*);
}
#endif // _LIBCPP_HAS_NO_ASAN
#endif // _LIBCPP_HAS_ASAN
_LIBCPP_BEGIN_NAMESPACE_STD
// ASan choices
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
# define _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS 1
#endif
@ -57,7 +57,7 @@ _LIBCPP_HIDE_FROM_ABI void __annotate_double_ended_contiguous_container(
const void* __last_old_contained,
const void* __first_new_contained,
const void* __last_new_contained) {
#ifdef _LIBCPP_HAS_NO_ASAN
#if !_LIBCPP_HAS_ASAN
(void)__first_storage;
(void)__last_storage;
(void)__first_old_contained;
@ -86,7 +86,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __annotate_contiguous_c
const void* __last_storage,
const void* __old_last_contained,
const void* __new_last_contained) {
#ifdef _LIBCPP_HAS_NO_ASAN
#if !_LIBCPP_HAS_ASAN
(void)__first_storage;
(void)__last_storage;
(void)__old_last_contained;

View File

@ -92,7 +92,7 @@ public:
template <class _Ep>
_LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
# if _LIBCPP_AVAILABILITY_HAS_INIT_PRIMARY_EXCEPTION && __cplusplus >= 201103L
using _Ep2 = __decay_t<_Ep>;

View File

@ -49,7 +49,7 @@ struct __nested : public _Tp, public nested_exception {
_LIBCPP_HIDE_FROM_ABI explicit __nested(const _Tp& __t) : _Tp(__t) {}
};
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
template <class _Tp, class _Up, bool>
struct __throw_with_nested;
@ -68,7 +68,7 @@ struct __throw_with_nested<_Tp, _Up, false> {
template <class _Tp>
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
using _Up = __decay_t<_Tp>;
static_assert(is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible");
__throw_with_nested<_Tp,

View File

@ -73,7 +73,7 @@ struct __expected_construct_unexpected_from_invoke_tag {};
template <class _Err, class _Arg>
_LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw bad_expected_access<_Err>(std::forward<_Arg>(__arg));
# else
(void)__arg;

View File

@ -67,7 +67,7 @@ private:
shared_ptr<_Storage> __storage_;
};
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
template <class... _Args>
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY void
__throw_filesystem_error(_Args&&... __args) {

View File

@ -60,7 +60,7 @@ struct __can_convert_char<wchar_t> {
static const bool value = true;
using __char_type = wchar_t;
};
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
template <>
struct __can_convert_char<char8_t> {
static const bool value = true;
@ -87,7 +87,7 @@ _LIBCPP_HIDE_FROM_ABI bool __is_separator(_ECharT __e) {
# endif
}
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
typedef u8string __u8_string;
# else
typedef string __u8_string;
@ -366,7 +366,7 @@ struct _PathExport<char16_t> {
}
};
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
template <>
struct _PathExport<char8_t> {
typedef __narrow_to_utf8<sizeof(wchar_t) * __CHAR_BIT__> _Narrower;
@ -376,7 +376,7 @@ struct _PathExport<char8_t> {
_Narrower()(back_inserter(__dest), __src.data(), __src.data() + __src.size());
}
};
# endif /* !_LIBCPP_HAS_NO_CHAR8_T */
# endif // _LIBCPP_HAS_CHAR8_T
# endif /* _LIBCPP_WIN32API */
class _LIBCPP_EXPORTED_FROM_ABI path {
@ -730,7 +730,7 @@ public:
# else /* _LIBCPP_WIN32API */
_LIBCPP_HIDE_FROM_ABI std::string string() const { return __pn_; }
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
_LIBCPP_HIDE_FROM_ABI std::u8string u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
# else
_LIBCPP_HIDE_FROM_ABI std::string u8string() const { return __pn_; }
@ -756,7 +756,7 @@ public:
// generic format observers
_LIBCPP_HIDE_FROM_ABI std::string generic_string() const { return __pn_; }
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
_LIBCPP_HIDE_FROM_ABI std::u8string generic_u8string() const { return std::u8string(__pn_.begin(), __pn_.end()); }
# else
_LIBCPP_HIDE_FROM_ABI std::string generic_u8string() const { return __pn_; }

View File

@ -34,7 +34,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _InputIt __l) {
static_assert(
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
# endif
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
@ -56,7 +56,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f,
template <class _InputIt, __enable_if_t<__is_pathable<_InputIt>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f, _NullSentinel) {
static_assert(
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
# endif
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
@ -77,7 +77,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(_InputIt __f,
template <class _Source, __enable_if_t<__is_pathable<_Source>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_WITH_CHAR8_T path u8path(const _Source& __s) {
static_assert(
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
# endif
is_same<typename __is_pathable<_Source>::__char_type, char>::value,

View File

@ -113,7 +113,7 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_
case __format::__arg_t::__long_long:
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__long_long_);
case __format::__arg_t::__i128:
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__i128_);
# else
__libcpp_unreachable();
@ -123,7 +123,7 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_
case __format::__arg_t::__unsigned_long_long:
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__unsigned_long_long_);
case __format::__arg_t::__u128:
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
return std::invoke(std::forward<_Visitor>(__vis), __arg.__value_.__u128_);
# else
__libcpp_unreachable();
@ -148,7 +148,7 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_
__libcpp_unreachable();
}
# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
template <class _Rp, class _Visitor, class _Context>
_LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
@ -164,7 +164,7 @@ _LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<
case __format::__arg_t::__long_long:
return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__long_long_);
case __format::__arg_t::__i128:
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__i128_);
# else
__libcpp_unreachable();
@ -174,7 +174,7 @@ _LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<
case __format::__arg_t::__unsigned_long_long:
return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__unsigned_long_long_);
case __format::__arg_t::__u128:
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), __arg.__value_.__u128_);
# else
__libcpp_unreachable();
@ -199,7 +199,7 @@ _LIBCPP_HIDE_FROM_ABI _Rp __visit_format_arg(_Visitor&& __vis, basic_format_arg<
__libcpp_unreachable();
}
# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
/// Contains the values used in basic_format_arg.
///
@ -237,7 +237,7 @@ public:
unsigned __unsigned_;
long long __long_long_;
unsigned long long __unsigned_long_long_;
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
__int128_t __i128_;
__uint128_t __u128_;
# endif
@ -261,7 +261,7 @@ public:
_LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(long long __value) noexcept : __long_long_(__value) {}
_LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(unsigned long long __value) noexcept
: __unsigned_long_long_(__value) {}
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
_LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(__int128_t __value) noexcept : __i128_(__value) {}
_LIBCPP_HIDE_FROM_ABI __basic_format_arg_value(__uint128_t __value) noexcept : __u128_(__value) {}
# endif
@ -284,14 +284,14 @@ public:
_LIBCPP_HIDE_FROM_ABI explicit operator bool() const noexcept { return __type_ != __format::__arg_t::__none; }
# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
// This function is user facing, so it must wrap the non-standard types of
// the "variant" in a handle to stay conforming. See __arg_t for more details.
template <class _Visitor>
_LIBCPP_HIDE_FROM_ABI decltype(auto) visit(this basic_format_arg __arg, _Visitor&& __vis) {
switch (__arg.__type_) {
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
case __format::__arg_t::__i128: {
typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_};
return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
@ -312,7 +312,7 @@ public:
template <class _Rp, class _Visitor>
_LIBCPP_HIDE_FROM_ABI _Rp visit(this basic_format_arg __arg, _Visitor&& __vis) {
switch (__arg.__type_) {
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
case __format::__arg_t::__i128: {
typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_};
return std::invoke_r<_Rp>(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
@ -328,7 +328,7 @@ public:
}
}
# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
private:
using char_type = typename _Context::char_type;
@ -370,13 +370,13 @@ private:
// This function is user facing, so it must wrap the non-standard types of
// the "variant" in a handle to stay conforming. See __arg_t for more details.
template <class _Visitor, class _Context>
# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
_LIBCPP_DEPRECATED_IN_CXX26
# endif
_LIBCPP_HIDE_FROM_ABI decltype(auto)
visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) {
switch (__arg.__type_) {
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
case __format::__arg_t::__i128: {
typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__i128_};
return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
@ -386,7 +386,7 @@ _LIBCPP_DEPRECATED_IN_CXX26
typename __basic_format_arg_value<_Context>::__handle __h{__arg.__value_.__u128_};
return std::invoke(std::forward<_Visitor>(__vis), typename basic_format_arg<_Context>::handle{__h});
}
# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
default:
return std::__visit_format_arg(std::forward<_Visitor>(__vis), __arg);
}

View File

@ -64,7 +64,7 @@ consteval __arg_t __determine_arg_t() {
return __arg_t::__int;
else if constexpr (sizeof(_Tp) <= sizeof(long long))
return __arg_t::__long_long;
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
else if constexpr (sizeof(_Tp) == sizeof(__int128_t))
return __arg_t::__i128;
# endif
@ -79,7 +79,7 @@ consteval __arg_t __determine_arg_t() {
return __arg_t::__unsigned;
else if constexpr (sizeof(_Tp) <= sizeof(unsigned long long))
return __arg_t::__unsigned_long_long;
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
else if constexpr (sizeof(_Tp) == sizeof(__uint128_t))
return __arg_t::__u128;
# endif

View File

@ -181,13 +181,13 @@ public:
__format::__determine_arg_t<basic_format_context, decltype(__arg)>(),
__basic_format_arg_value<basic_format_context>(__arg)};
};
# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
return static_cast<_Context*>(__c)->arg(__id).visit(std::move(__visitor));
# else
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
return std::visit_format_arg(std::move(__visitor), static_cast<_Context*>(__c)->arg(__id));
_LIBCPP_SUPPRESS_DEPRECATED_POP
# endif // _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
# endif // _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
}) {
}

View File

@ -36,7 +36,7 @@ public:
_LIBCPP_DIAGNOSTIC_POP
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw format_error(__s);
# else
_LIBCPP_VERBOSE_ABORT("format_error was thrown in -fno-exceptions mode with message \"%s\"", __s);

View File

@ -206,7 +206,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(
case __arg_t::__long_long:
return __format::__compile_time_validate_argument<_CharT, long long>(__parse_ctx, __ctx);
case __arg_t::__i128:
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
return __format::__compile_time_validate_argument<_CharT, __int128_t>(__parse_ctx, __ctx);
# else
std::__throw_format_error("Invalid argument");
@ -217,7 +217,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_visit_format_arg(
case __arg_t::__unsigned_long_long:
return __format::__compile_time_validate_argument<_CharT, unsigned long long>(__parse_ctx, __ctx);
case __arg_t::__u128:
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
return __format::__compile_time_validate_argument<_CharT, __uint128_t>(__parse_ctx, __ctx);
# else
std::__throw_format_error("Invalid argument");

View File

@ -67,7 +67,7 @@ template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<long, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<long long, _CharT> : public __formatter_integer<_CharT> {};
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<__int128_t, _CharT> : public __formatter_integer<_CharT> {};
# endif
@ -83,7 +83,7 @@ template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long, _CharT> : public __formatter_integer<_CharT> {};
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long long, _CharT> : public __formatter_integer<_CharT> {};
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
template <__fmt_char_type _CharT>
struct _LIBCPP_TEMPLATE_VIS formatter<__uint128_t, _CharT> : public __formatter_integer<_CharT> {};
# endif
@ -99,7 +99,7 @@ template <>
inline constexpr bool enable_nonlocking_formatter_optimization<long> = true;
template <>
inline constexpr bool enable_nonlocking_formatter_optimization<long long> = true;
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
template <>
inline constexpr bool enable_nonlocking_formatter_optimization<__int128_t> = true;
# endif
@ -114,7 +114,7 @@ template <>
inline constexpr bool enable_nonlocking_formatter_optimization<unsigned long> = true;
template <>
inline constexpr bool enable_nonlocking_formatter_optimization<unsigned long long> = true;
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
template <>
inline constexpr bool enable_nonlocking_formatter_optimization<__uint128_t> = true;
# endif

View File

@ -79,7 +79,7 @@ public:
_LIBCPP_DIAGNOSTIC_POP
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_function_call() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw bad_function_call();
# else
_LIBCPP_VERBOSE_ABORT("bad_function_call was thrown in -fno-exceptions mode");
@ -123,7 +123,7 @@ _LIBCPP_HIDE_FROM_ABI bool __not_null(function<_Fp> const& __f) {
return !!__f;
}
# ifdef _LIBCPP_HAS_EXTENSION_BLOCKS
# if _LIBCPP_HAS_EXTENSION_BLOCKS
template <class _Rp, class... _Args>
_LIBCPP_HIDE_FROM_ABI bool __not_null(_Rp (^__p)(_Args...)) {
return __p;
@ -244,10 +244,10 @@ public:
virtual void destroy() _NOEXCEPT = 0;
virtual void destroy_deallocate() _NOEXCEPT = 0;
virtual _Rp operator()(_ArgTypes&&...) = 0;
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
virtual const void* target(const type_info&) const _NOEXCEPT = 0;
virtual const std::type_info& target_type() const _NOEXCEPT = 0;
# endif // _LIBCPP_HAS_NO_RTTI
# endif // _LIBCPP_HAS_RTTI
};
// __func implements __base for a given functor type.
@ -273,10 +273,10 @@ public:
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy_deallocate() _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual _Rp operator()(_ArgTypes&&... __arg);
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(const type_info&) const _NOEXCEPT;
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT;
# endif // _LIBCPP_HAS_NO_RTTI
# endif // _LIBCPP_HAS_RTTI
};
template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
@ -314,7 +314,7 @@ _Rp __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&&... __arg) {
return __f_(std::forward<_ArgTypes>(__arg)...);
}
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
template <class _Fp, class _Alloc, class _Rp, class... _ArgTypes>
const void* __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT {
@ -328,7 +328,7 @@ const std::type_info& __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() cons
return typeid(_Fp);
}
# endif // _LIBCPP_HAS_NO_RTTI
# endif // _LIBCPP_HAS_RTTI
// __value_func creates a value-type from a __func.
@ -465,7 +465,7 @@ public:
_LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __f_ != nullptr; }
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
_LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT {
if (__f_ == nullptr)
return typeid(void);
@ -478,7 +478,7 @@ public:
return nullptr;
return (const _Tp*)__f_->target(typeid(_Tp));
}
# endif // _LIBCPP_HAS_NO_RTTI
# endif // _LIBCPP_HAS_RTTI
};
// Storage for a functor object, to be used with __policy to manage copy and
@ -521,7 +521,7 @@ struct __policy {
nullptr,
nullptr,
true,
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
&typeid(void)
# else
nullptr
@ -548,7 +548,7 @@ private:
&__large_clone<_Fun>,
&__large_destroy<_Fun>,
false,
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
&typeid(typename _Fun::_Target)
# else
nullptr
@ -563,7 +563,7 @@ private:
nullptr,
nullptr,
false,
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
&typeid(typename _Fun::_Target)
# else
nullptr
@ -725,7 +725,7 @@ public:
_LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return !__policy_->__is_null; }
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
_LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT { return *__policy_->__type_info; }
template <typename _Tp>
@ -737,10 +737,10 @@ public:
else
return reinterpret_cast<const _Tp*>(&__buf_.__small);
}
# endif // _LIBCPP_HAS_NO_RTTI
# endif // _LIBCPP_HAS_RTTI
};
# if defined(_LIBCPP_HAS_BLOCKS_RUNTIME)
# if _LIBCPP_HAS_BLOCKS_RUNTIME
extern "C" void* _Block_copy(const void*);
extern "C" void _Block_release(const void*);
@ -752,7 +752,7 @@ class __func<_Rp1 (^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)> : public __base
public:
_LIBCPP_HIDE_FROM_ABI explicit __func(__block_type const& __f)
# ifdef _LIBCPP_HAS_OBJC_ARC
# if _LIBCPP_HAS_OBJC_ARC
: __f_(__f)
# else
: __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
@ -763,7 +763,7 @@ public:
// [TODO] add && to save on a retain
_LIBCPP_HIDE_FROM_ABI explicit __func(__block_type __f, const _Alloc& /* unused */)
# ifdef _LIBCPP_HAS_OBJC_ARC
# if _LIBCPP_HAS_OBJC_ARC
: __f_(__f)
# else
: __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
@ -785,7 +785,7 @@ public:
}
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual void destroy() _NOEXCEPT {
# ifndef _LIBCPP_HAS_OBJC_ARC
# if !_LIBCPP_HAS_OBJC_ARC
if (__f_)
_Block_release(__f_);
# endif
@ -804,7 +804,7 @@ public:
return std::__invoke(__f_, std::forward<_ArgTypes>(__arg)...);
}
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const void* target(type_info const& __ti) const _NOEXCEPT {
if (__ti == typeid(__func::__block_type))
return &__f_;
@ -814,7 +814,7 @@ public:
_LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual const std::type_info& target_type() const _NOEXCEPT {
return typeid(__func::__block_type);
}
# endif // _LIBCPP_HAS_NO_RTTI
# endif // _LIBCPP_HAS_RTTI
};
# endif // _LIBCPP_HAS_EXTENSION_BLOCKS
@ -906,14 +906,14 @@ public:
// function invocation:
_LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
// function target access:
_LIBCPP_HIDE_FROM_ABI const std::type_info& target_type() const _NOEXCEPT;
template <typename _Tp>
_LIBCPP_HIDE_FROM_ABI _Tp* target() _NOEXCEPT;
template <typename _Tp>
_LIBCPP_HIDE_FROM_ABI const _Tp* target() const _NOEXCEPT;
# endif // _LIBCPP_HAS_NO_RTTI
# endif // _LIBCPP_HAS_RTTI
};
# if _LIBCPP_STD_VER >= 17
@ -990,7 +990,7 @@ _Rp function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const {
return __f_(std::forward<_ArgTypes>(__arg)...);
}
# ifndef _LIBCPP_HAS_NO_RTTI
# if _LIBCPP_HAS_RTTI
template <class _Rp, class... _ArgTypes>
const std::type_info& function<_Rp(_ArgTypes...)>::target_type() const _NOEXCEPT {
@ -1009,7 +1009,7 @@ const _Tp* function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT {
return __f_.template target<_Tp>();
}
# endif // _LIBCPP_HAS_NO_RTTI
# endif // _LIBCPP_HAS_RTTI
template <class _Rp, class... _ArgTypes>
inline _LIBCPP_HIDE_FROM_ABI bool operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {

View File

@ -356,12 +356,12 @@ struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public __unary_function<unsign
_LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
template <>
struct _LIBCPP_TEMPLATE_VIS hash<char8_t> : public __unary_function<char8_t, size_t> {
_LIBCPP_HIDE_FROM_ABI size_t operator()(char8_t __v) const _NOEXCEPT { return static_cast<size_t>(__v); }
};
#endif // !_LIBCPP_HAS_NO_CHAR8_T
#endif // _LIBCPP_HAS_CHAR8_T
template <>
struct _LIBCPP_TEMPLATE_VIS hash<char16_t> : public __unary_function<char16_t, size_t> {
@ -416,7 +416,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long long> : public __scalar_hash<long long> {}
template <>
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long> : public __scalar_hash<unsigned long long> {};
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
template <>
struct _LIBCPP_TEMPLATE_VIS hash<__int128_t> : public __scalar_hash<__int128_t> {};

View File

@ -24,7 +24,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits;
template <>
struct char_traits<char>;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
template <>
struct char_traits<char8_t>;
#endif
@ -48,7 +48,7 @@ using string = basic_string<char>;
using wstring = basic_string<wchar_t>;
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
using u8string = basic_string<char8_t>;
#endif
@ -67,7 +67,7 @@ using string _LIBCPP_AVAILABILITY_PMR = basic_string<char>;
using wstring _LIBCPP_AVAILABILITY_PMR = basic_string<wchar_t>;
# endif
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
using u8string _LIBCPP_AVAILABILITY_PMR = basic_string<char8_t>;
# endif
@ -83,7 +83,7 @@ class _LIBCPP_PREFERRED_NAME(string)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_PREFERRED_NAME(wstring)
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
_LIBCPP_PREFERRED_NAME(u8string)
#endif
_LIBCPP_PREFERRED_NAME(u16string)
@ -93,7 +93,7 @@ class _LIBCPP_PREFERRED_NAME(string)
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_PREFERRED_NAME(pmr::wstring)
# endif
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
_LIBCPP_PREFERRED_NAME(pmr::u8string)
# endif
_LIBCPP_PREFERRED_NAME(pmr::u16string)

View File

@ -23,7 +23,7 @@ template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TEMPLATE_VIS basic_string_view;
typedef basic_string_view<char> string_view;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
typedef basic_string_view<char8_t> u8string_view;
#endif
typedef basic_string_view<char16_t> u16string_view;
@ -38,7 +38,7 @@ class _LIBCPP_PREFERRED_NAME(string_view)
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
_LIBCPP_PREFERRED_NAME(wstring_view)
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
_LIBCPP_PREFERRED_NAME(u8string_view)
#endif
_LIBCPP_PREFERRED_NAME(u16string_view)

View File

@ -1210,9 +1210,9 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(__hash_table& __u,
max_load_factor() = __u.max_load_factor();
if (bucket_count() != 0) {
__next_pointer __cache = __detach();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
const_iterator __i = __u.begin();
while (__cache != nullptr && __u.size() != 0) {
__cache->__upcast()->__get_value() = std::move(__u.remove(__i++)->__get_value());
@ -1220,12 +1220,12 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(__hash_table& __u,
__node_insert_multi(__cache->__upcast());
__cache = __next;
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__deallocate_node(__cache);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__deallocate_node(__cache);
}
const_iterator __i = __u.begin();
@ -1256,21 +1256,21 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __
if (bucket_count() != 0) {
__next_pointer __cache = __detach();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (; __cache != nullptr && __first != __last; ++__first) {
__cache->__upcast()->__get_value() = *__first;
__next_pointer __next = __cache->__next_;
__node_insert_unique(__cache->__upcast());
__cache = __next;
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__deallocate_node(__cache);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__deallocate_node(__cache);
}
for (; __first != __last; ++__first)
@ -1288,21 +1288,21 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __f
" or the nodes value type");
if (bucket_count() != 0) {
__next_pointer __cache = __detach();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (; __cache != nullptr && __first != __last; ++__first) {
__cache->__upcast()->__get_value() = *__first;
__next_pointer __next = __cache->__next_;
__node_insert_multi(__cache->__upcast());
__cache = __next;
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__deallocate_node(__cache);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__deallocate_node(__cache);
}
for (; __first != __last; ++__first)

View File

@ -132,7 +132,7 @@ public:
_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator++(int) {
_LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end.");
--__count_;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
return __current_++;
} catch (...) {
@ -141,7 +141,7 @@ public:
}
# else
return __current_++;
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
_LIBCPP_HIDE_FROM_ABI constexpr counted_iterator operator++(int)

View File

@ -982,7 +982,7 @@ protected:
virtual int do_max_length() const _NOEXCEPT;
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
// template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20
@ -1145,7 +1145,7 @@ protected:
virtual int do_max_length() const _NOEXCEPT;
};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20
@ -1255,7 +1255,7 @@ extern template class _LIBCPP_DEPRECATED_IN_CXX20
_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>; // deprecated in C++20
extern template class _LIBCPP_DEPRECATED_IN_CXX20
_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>; // deprecated in C++20
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>; // C++20
extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>; // C++20
#endif

View File

@ -23,7 +23,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI _Tp* a
return __builtin_addressof(__x);
}
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
#if _LIBCPP_HAS_OBJC_ARC && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
// Objective-C++ Automatic Reference Counting uses qualified pointers
// that require special addressof() signatures. When
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
@ -33,7 +33,7 @@ inline _LIBCPP_HIDE_FROM_ABI __strong _Tp* addressof(__strong _Tp& __x) _NOEXCEP
return &__x;
}
# ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
# if _LIBCPP_HAS_OBJC_ARC_WEAK
template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI __weak _Tp* addressof(__weak _Tp& __x) _NOEXCEPT {
return &__x;

View File

@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
// Low-level helpers to call the aligned allocation and deallocation functions
// on the target platform. This is used to implement libc++'s own memory
@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
# if defined(_LIBCPP_MSVCRT_LIKE)
return ::_aligned_malloc(__size, __alignment);
# elif _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC)
# elif _LIBCPP_STD_VER >= 17 && _LIBCPP_HAS_C11_ALIGNED_ALLOC
// aligned_alloc() requires that __size is a multiple of __alignment,
// but for C++ [new.delete.general], only states "if the value of an
// alignment argument passed to any of these functions is not a valid
@ -57,7 +57,7 @@ inline _LIBCPP_HIDE_FROM_ABI void __libcpp_aligned_free(void* __ptr) {
# endif
}
#endif // !_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
#endif // _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
_LIBCPP_END_NAMESPACE_STD

View File

@ -54,7 +54,7 @@
#include <cstddef>
#include <new>
#include <typeinfo>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
#if _LIBCPP_HAS_ATOMIC_HEADER
# include <__atomic/memory_order.h>
#endif
@ -70,10 +70,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
// should be sufficient for thread safety.
// See https://llvm.org/PR22803
#if defined(__clang__) && __has_builtin(__atomic_add_fetch) && defined(__ATOMIC_RELAXED) && defined(__ATOMIC_ACQ_REL)
# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
#elif defined(_LIBCPP_COMPILER_GCC)
# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
#if (defined(__clang__) && __has_builtin(__atomic_add_fetch) && defined(__ATOMIC_RELAXED) && \
defined(__ATOMIC_ACQ_REL)) || \
defined(_LIBCPP_COMPILER_GCC)
# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT 1
#else
# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT 0
#endif
template <class _ValueType>
@ -98,7 +100,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const*
template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT {
#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
#if _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT && !defined(_LIBCPP_HAS_NO_THREADS)
return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED);
#else
return __t += 1;
@ -107,7 +109,7 @@ inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _N
template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT {
#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
#if _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT && !defined(_LIBCPP_HAS_NO_THREADS)
return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL);
#else
return __t -= 1;
@ -124,7 +126,7 @@ public:
};
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw bad_weak_ptr();
#else
_LIBCPP_VERBOSE_ABORT("bad_weak_ptr was thrown in -fno-exceptions mode");
@ -206,7 +208,7 @@ public:
_LIBCPP_HIDE_FROM_ABI __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
: __ptr_(__p), __deleter_(std::move(__d)), __alloc_(std::move(__a)) {}
#ifndef _LIBCPP_HAS_NO_RTTI
#if _LIBCPP_HAS_RTTI
_LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info&) const _NOEXCEPT override;
#endif
@ -215,14 +217,14 @@ private:
_LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override;
};
#ifndef _LIBCPP_HAS_NO_RTTI
#if _LIBCPP_HAS_RTTI
template <class _Tp, class _Dp, class _Alloc>
const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT {
return __t == typeid(_Dp) ? std::addressof(__deleter_) : nullptr;
}
#endif // _LIBCPP_HAS_NO_RTTI
#endif // _LIBCPP_HAS_RTTI
template <class _Tp, class _Dp, class _Alloc>
void __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__on_zero_shared() _NOEXCEPT {
@ -455,9 +457,9 @@ public:
template <class _Yp, class _Dp, __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
#ifndef _LIBCPP_CXX03_LANG
@ -466,12 +468,12 @@ public:
__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
#endif // not _LIBCPP_CXX03_LANG
__enable_weak_this(__p, __p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__d(__p);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Yp,
@ -479,9 +481,9 @@ public:
class _Alloc,
__enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
typedef __allocator_destructor<_A2> _D2;
@ -495,12 +497,12 @@ public:
#endif // not _LIBCPP_CXX03_LANG
__cntrl_ = std::addressof(*__hold2.release());
__enable_weak_this(__p, __p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__d(__p);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Dp>
@ -509,9 +511,9 @@ public:
_Dp __d,
__enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
: __ptr_(nullptr) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk;
#ifndef _LIBCPP_CXX03_LANG
@ -519,12 +521,12 @@ public:
#else
__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
#endif // not _LIBCPP_CXX03_LANG
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__d(__p);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Dp, class _Alloc>
@ -534,9 +536,9 @@ public:
_Alloc __a,
__enable_if_t<__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
: __ptr_(nullptr) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
typedef __allocator_destructor<_A2> _D2;
@ -549,12 +551,12 @@ public:
_CntrlBlk(__p, __d, __a);
#endif // not _LIBCPP_CXX03_LANG
__cntrl_ = std::addressof(*__hold2.release());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__d(__p);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Yp>
@ -767,12 +769,12 @@ public:
}
#endif
#ifndef _LIBCPP_HAS_NO_RTTI
#if _LIBCPP_HAS_RTTI
template <class _Dp>
_LIBCPP_HIDE_FROM_ABI _Dp* __get_deleter() const _NOEXCEPT {
return static_cast<_Dp*>(__cntrl_ ? const_cast<void*>(__cntrl_->__get_deleter(typeid(_Dp))) : nullptr);
}
#endif // _LIBCPP_HAS_NO_RTTI
#endif // _LIBCPP_HAS_RTTI
template <class _Yp, class _CntrlBlk>
_LIBCPP_HIDE_FROM_ABI static shared_ptr<_Tp> __create_with_control_block(_Yp* __p, _CntrlBlk* __cntrl) _NOEXCEPT {
@ -1297,14 +1299,14 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(shared_ptr<_Up>&&
}
#endif
#ifndef _LIBCPP_HAS_NO_RTTI
#if _LIBCPP_HAS_RTTI
template <class _Dp, class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _Dp* get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT {
return __p.template __get_deleter<_Dp>();
}
#endif // _LIBCPP_HAS_NO_RTTI
#endif // _LIBCPP_HAS_RTTI
template <class _Tp>
class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS weak_ptr {

View File

@ -59,12 +59,12 @@ template <class _ValueType, class _InputIterator, class _Sentinel1, class _Forwa
inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_copy(
_InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
_ForwardIterator __idx = __ofirst;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif
for (; __ifirst != __ilast && !__stop_copying(__idx); ++__ifirst, (void)++__idx)
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__ofirst, __idx);
throw;
@ -89,12 +89,12 @@ template <class _ValueType, class _InputIterator, class _Size, class _ForwardIte
inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator>
__uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) {
_ForwardIterator __idx = __ofirst;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif
for (; __n > 0 && !__stop_copying(__idx); ++__ifirst, (void)++__idx, (void)--__n)
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(*__ifirst);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__ofirst, __idx);
throw;
@ -119,12 +119,12 @@ template <class _ValueType, class _ForwardIterator, class _Sentinel, class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
__uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) {
_ForwardIterator __idx = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif
for (; __idx != __last; ++__idx)
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__x);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__first, __idx);
throw;
@ -147,12 +147,12 @@ template <class _ValueType, class _ForwardIterator, class _Size, class _Tp>
inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
__uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) {
_ForwardIterator __idx = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif
for (; __n > 0; ++__idx, (void)--__n)
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__x);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__first, __idx);
throw;
@ -177,12 +177,12 @@ template <class _ValueType, class _ForwardIterator, class _Sentinel>
inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
__uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) {
auto __idx = __first;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
for (; __idx != __last; ++__idx)
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__first, __idx);
throw;
@ -203,12 +203,12 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterat
template <class _ValueType, class _ForwardIterator, class _Size>
inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) {
auto __idx = __first;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
for (; __n > 0; ++__idx, (void)--__n)
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__first, __idx);
throw;
@ -230,12 +230,12 @@ template <class _ValueType, class _ForwardIterator, class _Sentinel>
inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator
__uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) {
auto __idx = __first;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
for (; __idx != __last; ++__idx)
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__first, __idx);
throw;
@ -256,12 +256,12 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator
template <class _ValueType, class _ForwardIterator, class _Size>
inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) {
auto __idx = __first;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
for (; __n > 0; ++__idx, (void)--__n)
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__first, __idx);
throw;
@ -292,13 +292,13 @@ inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitiali
_EndPredicate __stop_moving,
_IterMove __iter_move) {
auto __idx = __ofirst;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void)++__ifirst) {
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__iter_move(__ifirst));
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__ofirst, __idx);
throw;
@ -330,12 +330,12 @@ template <class _ValueType,
inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move_n(
_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_moving, _IterMove __iter_move) {
auto __idx = __ofirst;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
for (; __n > 0 && !__stop_moving(__idx); ++__idx, (void)++__ifirst, --__n)
::new (static_cast<void*>(std::addressof(*__idx))) _ValueType(__iter_move(__ifirst));
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
std::__destroy(__ofirst, __idx);
throw;
@ -627,7 +627,7 @@ __uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _
std::__make_exception_guard(_AllocatorDestroyRangeReverse<_Alloc, _Tp*>(__alloc, __destruct_first, __result));
auto __iter = __first;
while (__iter != __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
allocator_traits<_Alloc>::construct(__alloc, __result, std::move_if_noexcept(*__iter));
#else
allocator_traits<_Alloc>::construct(__alloc, __result, std::move(*__iter));

View File

@ -62,7 +62,7 @@ __allocate_unique_temporary_buffer(ptrdiff_t __count) {
if (__count > __max_count)
__count = __max_count;
while (__count > 0) {
#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
#if _LIBCPP_HAS_ALIGNED_ALLOCATION
if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) {
align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp));
__ptr = static_cast<_Tp*>(::operator new(__count * sizeof(_Tp), __al, nothrow));

View File

@ -30,7 +30,7 @@ public:
mutex(const mutex&) = delete;
mutex& operator=(const mutex&) = delete;
# if defined(_LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION)
# if _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
_LIBCPP_HIDE_FROM_ABI ~mutex() = default;
# else
~mutex() _NOEXCEPT;

View File

@ -156,15 +156,15 @@ basic_ostream<_CharT, _Traits>::sentry::sentry(basic_ostream<_CharT, _Traits>& _
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>::sentry::~sentry() {
if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) && uncaught_exceptions() == 0) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (__os_.rdbuf()->pubsync() == -1)
__os_.setstate(ios_base::badbit);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -185,15 +185,15 @@ basic_ostream<_CharT, _Traits>::~basic_ostream() {}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
if (__sb) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
_Ip __i(__sb);
@ -207,27 +207,27 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
}
if (__c == 0)
this->setstate(ios_base::failbit);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_failbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
} else
this->setstate(ios_base::badbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -235,19 +235,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
@ -262,19 +262,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short
.failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -282,19 +282,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsig
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
@ -309,19 +309,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int _
.failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -329,19 +329,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsig
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -349,19 +349,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -369,19 +369,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsig
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long long __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -389,19 +389,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -409,19 +409,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsig
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -429,19 +429,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -449,19 +449,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(doubl
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -469,19 +469,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
@ -489,20 +489,20 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
__put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str, size_t __len) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
@ -516,11 +516,11 @@ __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __s
.failed())
__os.setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__os.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return __os;
}
@ -531,9 +531,9 @@ _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) {
_CharT __c = __os.widen(__cn);
@ -548,11 +548,11 @@ _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_
.failed())
__os.setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__os.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return __os;
}
@ -580,9 +580,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str) {
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
@ -609,11 +609,11 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) {
.failed())
__os.setstate(ios_base::badbit | ios_base::failbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__os.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return __os;
}
@ -638,9 +638,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str) {
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::put(char_type __c) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __s(*this);
if (__s) {
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
@ -649,37 +649,37 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::put(char_type __
if (__o.failed())
this->setstate(ios_base::badbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
sentry __sen(*this);
if (__sen && __n) {
if (this->rdbuf()->sputn(__s, __n) != __n)
this->setstate(ios_base::badbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::flush() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (this->rdbuf()) {
sentry __s(*this);
if (__s) {
@ -687,11 +687,11 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::flush() {
this->setstate(ios_base::badbit);
}
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return *this;
}
@ -823,7 +823,7 @@ basic_ostream<wchar_t, _Traits>& operator<<(basic_ostream<wchar_t, _Traits>&, co
# endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
template <class _Traits>
basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, char8_t) = delete;

View File

@ -52,9 +52,9 @@ __vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args, bool _
const char* __str = __o.data();
size_t __len = __o.size();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typedef ostreambuf_iterator<char> _Ip;
if (std::__pad_and_output(
_Ip(__os),
@ -66,11 +66,11 @@ __vprint_nonunicode(ostream& __os, string_view __fmt, format_args __args, bool _
.failed())
__os.setstate(ios_base::badbit | ios_base::failbit);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__os.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -115,9 +115,9 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo
// This is the path for the native API, start with flushing.
__os.flush();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
ostream::sentry __s(__os);
if (__s) {
# ifndef _LIBCPP_WIN32API
@ -129,11 +129,11 @@ _LIBCPP_HIDE_FROM_ABI void __vprint_unicode(ostream& __os, string_view __fmt, fo
# endif
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__os.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
# endif // _LIBCPP_AVAILABILITY_HAS_PRINT
}

View File

@ -142,11 +142,11 @@ struct __cpu_traits<__libdispatch_backend_tag> {
unique_ptr<__merge_range_t[], decltype(__destroy)> __ranges(
[&]() -> __merge_range_t* {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
return std::allocator<__merge_range_t>().allocate(__n_ranges);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (const std::bad_alloc&) {
return nullptr;
}

View File

@ -66,12 +66,12 @@ struct __libcpp_random_is_valid_inttype<unsigned long> : true_type {};
template <>
struct __libcpp_random_is_valid_inttype<unsigned long long> : true_type {};
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
template <>
struct __libcpp_random_is_valid_inttype<__int128_t> : true_type {}; // extension
template <>
struct __libcpp_random_is_valid_inttype<__uint128_t> : true_type {}; // extension
#endif // _LIBCPP_HAS_NO_INT128
#endif // _LIBCPP_HAS_INT128
// [rand.req.urng]/3:
// A class G meets the uniform random bit generator requirements if G models

View File

@ -48,7 +48,7 @@ struct __lce_alg_picker {
: _Schrage ? _LCE_Schrage
: _LCE_Promote;
#ifdef _LIBCPP_HAS_NO_INT128
#if !_LIBCPP_HAS_INT128
static_assert(_Mp != (unsigned long long)(-1) || _Full || _Part || _Schrage,
"The current values for a, c, and m are not currently supported on platforms without __int128");
#endif
@ -63,7 +63,7 @@ struct __lce_ta;
// 64
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
template <unsigned long long _Ap, unsigned long long _Cp, unsigned long long _Mp>
struct __lce_ta<_Ap, _Cp, _Mp, (unsigned long long)(-1), _LCE_Promote> {
typedef unsigned long long result_type;

View File

@ -38,7 +38,7 @@ struct __log2_imp<unsigned long long, 0, _Rp> {
static const size_t value = _Rp + 1;
};
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
template <__uint128_t _Xp, size_t _Rp>
struct __log2_imp<__uint128_t, _Xp, _Rp> {
@ -47,16 +47,16 @@ struct __log2_imp<__uint128_t, _Xp, _Rp> {
: __log2_imp<unsigned long long, _Xp, 63>::value;
};
#endif // _LIBCPP_HAS_NO_INT128
#endif // _LIBCPP_HAS_INT128
template <class _UIntType, _UIntType _Xp>
struct __log2 {
static const size_t value = __log2_imp<
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
__conditional_t<sizeof(_UIntType) <= sizeof(unsigned long long), unsigned long long, __uint128_t>,
#else
unsigned long long,
#endif // _LIBCPP_HAS_NO_INT128
#endif // _LIBCPP_HAS_INT128
_Xp,
sizeof(_UIntType) * __CHAR_BIT__ - 1>::value;
};

View File

@ -440,9 +440,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::reserve(size
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
if (capacity() > size()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_));
__t.__end_ = __t.__begin_ + (__end_ - __begin_);
@ -450,10 +450,10 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fi
std::swap(__begin_, __t.__begin_);
std::swap(__end_, __t.__end_);
std::swap(__end_cap(), __t.__end_cap());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}

View File

@ -257,7 +257,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> : __char_traits_base<wchar_t, w
};
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
template <>
struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
@ -277,7 +277,7 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
}
};
#endif // _LIBCPP_HAS_NO_CHAR8_T
#endif // _LIBCPP_HAS_CHAR8_T
template <>
struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t>

View File

@ -43,7 +43,7 @@ inline const bool __is_char_type = false;
template <>
inline const bool __is_char_type<char> = true;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
template <>
inline const bool __is_char_type<char8_t> = true;
#endif

View File

@ -41,7 +41,7 @@ public:
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_system_error(int __ev, const char* __what_arg);
[[__noreturn__]] _LIBCPP_HIDE_FROM_ABI inline void __throw_system_error(error_code __ec, const char* __what_arg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw system_error(__ec, __what_arg);
#else
_LIBCPP_VERBOSE_ABORT(

View File

@ -28,7 +28,7 @@ template <> struct __libcpp_is_integral<unsigned char> { enum { va
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
template <> struct __libcpp_is_integral<wchar_t> { enum { value = 1 }; };
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
template <> struct __libcpp_is_integral<char8_t> { enum { value = 1 }; };
#endif
template <> struct __libcpp_is_integral<char16_t> { enum { value = 1 }; };
@ -41,7 +41,7 @@ template <> struct __libcpp_is_integral<long> { enum { va
template <> struct __libcpp_is_integral<unsigned long> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<long long> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<unsigned long long> { enum { value = 1 }; };
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
template <> struct __libcpp_is_integral<__int128_t> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<__uint128_t> { enum { value = 1 }; };
#endif

View File

@ -40,7 +40,7 @@ template <class _Tp>
struct __libcpp_remove_objc_qualifiers {
typedef _Tp type;
};
# if defined(_LIBCPP_HAS_OBJC_ARC)
# if _LIBCPP_HAS_OBJC_ARC
// clang-format off
template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __strong> { typedef _Tp type; };
template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __weak> { typedef _Tp type; };

View File

@ -37,7 +37,7 @@ inline constexpr bool is_scalar_v = __is_scalar(_Tp);
template <class _Tp>
struct __is_block : false_type {};
# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS)
# if _LIBCPP_HAS_EXTENSION_BLOCKS
template <class _Rp, class... _Args>
struct __is_block<_Rp (^)(_Args...)> : true_type {};
# endif

View File

@ -25,7 +25,7 @@ template <> struct __libcpp_is_signed_integer<signed short> : publi
template <> struct __libcpp_is_signed_integer<signed int> : public true_type {};
template <> struct __libcpp_is_signed_integer<signed long> : public true_type {};
template <> struct __libcpp_is_signed_integer<signed long long> : public true_type {};
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
template <> struct __libcpp_is_signed_integer<__int128_t> : public true_type {};
#endif
// clang-format on

View File

@ -25,7 +25,7 @@ template <> struct __libcpp_is_unsigned_integer<unsigned short> : p
template <> struct __libcpp_is_unsigned_integer<unsigned int> : public true_type {};
template <> struct __libcpp_is_unsigned_integer<unsigned long> : public true_type {};
template <> struct __libcpp_is_unsigned_integer<unsigned long long> : public true_type {};
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
template <> struct __libcpp_is_unsigned_integer<__uint128_t> : public true_type {};
#endif
// clang-format on

View File

@ -35,7 +35,7 @@ using __make_32_64_or_128_bit_t =
__copy_unsigned_t<_Tp,
__conditional_t<sizeof(_Tp) <= sizeof(int32_t), int32_t,
__conditional_t<sizeof(_Tp) <= sizeof(int64_t), int64_t,
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
__conditional_t<sizeof(_Tp) <= sizeof(__int128_t), __int128_t,
/* else */ void>
#else

View File

@ -35,11 +35,11 @@ typedef __type_list<signed char,
__type_list<signed int,
__type_list<signed long,
__type_list<signed long long,
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
__type_list<__int128_t,
# endif
__nat
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
>
# endif
> > > > > __signed_types;
@ -63,7 +63,7 @@ template <> struct __make_signed< signed long, true> {typedef long ty
template <> struct __make_signed<unsigned long, true> {typedef long type;};
template <> struct __make_signed< signed long long, true> {typedef long long type;};
template <> struct __make_signed<unsigned long long, true> {typedef long long type;};
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;};
template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;};
# endif

View File

@ -37,11 +37,11 @@ typedef __type_list<unsigned char,
__type_list<unsigned int,
__type_list<unsigned long,
__type_list<unsigned long long,
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
__type_list<__uint128_t,
# endif
__nat
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
>
# endif
> > > > > __unsigned_types;
@ -65,7 +65,7 @@ template <> struct __make_unsigned< signed long, true> {typedef unsigned l
template <> struct __make_unsigned<unsigned long, true> {typedef unsigned long type;};
template <> struct __make_unsigned< signed long long, true> {typedef unsigned long long type;};
template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned long long type;};
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;};
template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;};
# endif

View File

@ -39,7 +39,7 @@ class __promote {
static double __test(unsigned long);
static double __test(long long);
static double __test(unsigned long long);
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
static double __test(__int128_t);
static double __test(__uint128_t);
# endif
@ -63,7 +63,7 @@ struct __numeric_type {
static double __test(unsigned long);
static double __test(long long);
static double __test(unsigned long long);
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
static double __test(__int128_t);
static double __test(__uint128_t);
# endif

View File

@ -42,7 +42,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long long __convert_to_integral(_
return __val;
}
#ifndef _LIBCPP_HAS_NO_INT128
#if _LIBCPP_HAS_INT128
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __int128_t __convert_to_integral(__int128_t __val) { return __val; }
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __uint128_t __convert_to_integral(__uint128_t __val) { return __val; }

View File

@ -44,7 +44,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// less common, especially one that tries to catch an exception through -fno-exceptions code.
//
// __exception_guard can help greatly simplify code that would normally be cluttered by
// `#if _LIBCPP_HAS_NO_EXCEPTIONS`. For example:
// `#if _LIBCPP_HAS_EXCEPTIONS`. For example:
//
// template <class Iterator, class Size, class OutputIterator>
// Iterator uninitialized_copy_n(Iterator iter, Size n, OutputIterator out) {
@ -124,7 +124,7 @@ private:
_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__exception_guard_noexceptions);
#ifdef _LIBCPP_HAS_NO_EXCEPTIONS
#if !_LIBCPP_HAS_EXCEPTIONS
template <class _Rollback>
using __exception_guard = __exception_guard_noexceptions<_Rollback>;
#else

View File

@ -128,7 +128,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw bad_any_cast();
# else
_LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode");
@ -176,7 +176,7 @@ inline _LIBCPP_HIDE_FROM_ABI constexpr const void* __get_fallback_typeid() {
template <class _Tp>
inline _LIBCPP_HIDE_FROM_ABI bool __compare_typeid(type_info const* __id, const void* __fallback_id) {
# if !defined(_LIBCPP_HAS_NO_RTTI)
# if _LIBCPP_HAS_RTTI
if (__id && *__id == typeid(_Tp))
return true;
# endif
@ -266,7 +266,7 @@ public:
// 6.3.4 any observers
_LIBCPP_HIDE_FROM_ABI bool has_value() const _NOEXCEPT { return __h_ != nullptr; }
# if !defined(_LIBCPP_HAS_NO_RTTI)
# if _LIBCPP_HAS_RTTI
_LIBCPP_HIDE_FROM_ABI const type_info& type() const _NOEXCEPT {
if (__h_) {
return *static_cast<type_info const*>(this->__call(_Action::_TypeInfo));
@ -372,7 +372,7 @@ private:
}
_LIBCPP_HIDE_FROM_ABI static void* __type_info() {
# if !defined(_LIBCPP_HAS_NO_RTTI)
# if _LIBCPP_HAS_RTTI
return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
# else
return nullptr;
@ -444,7 +444,7 @@ private:
}
_LIBCPP_HIDE_FROM_ABI static void* __type_info() {
# if !defined(_LIBCPP_HAS_NO_RTTI)
# if _LIBCPP_HAS_RTTI
return const_cast<void*>(static_cast<void const*>(&typeid(_Tp)));
# else
return nullptr;
@ -579,7 +579,7 @@ _LIBCPP_HIDE_FROM_ABI add_pointer_t<_ValueType> any_cast(any* __any) _NOEXCEPT {
void* __p = __any->__call(
_Action::_Get,
nullptr,
# if !defined(_LIBCPP_HAS_NO_RTTI)
# if _LIBCPP_HAS_RTTI
&typeid(_ValueType),
# else
nullptr,

View File

@ -613,7 +613,7 @@ template <class T>
# pragma GCC system_header
#endif
#ifdef _LIBCPP_HAS_NO_ATOMIC_HEADER
#if !_LIBCPP_HAS_ATOMIC_HEADER
# error <atomic> is not implemented
#endif

View File

@ -59,7 +59,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
# if !defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8)
# if _LIBCPP_HAS_C8RTOMB_MBRTOC8
using ::mbrtoc8 _LIBCPP_USING_IF_EXISTS;
using ::c8rtomb _LIBCPP_USING_IF_EXISTS;
# endif

View File

@ -918,7 +918,7 @@ private:
(void)__end;
(void)__annotation_type;
(void)__place;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
// __beg - index of the first item to annotate
// __end - index behind the last item to annotate (so last item + 1)
// __annotation_type - __asan_unposion or __asan_poison
@ -1011,23 +1011,23 @@ private:
std::__annotate_double_ended_contiguous_container<_Allocator>(
__mem_beg, __mem_end, __old_beg, __old_end, __new_beg, __new_end);
}
#endif // !_LIBCPP_HAS_NO_ASAN
#endif // _LIBCPP_HAS_ASAN
}
_LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
(void)__current_size;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
if (__current_size == 0)
__annotate_from_to(0, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
else {
__annotate_from_to(0, __start_, __asan_poison, __asan_front_moved);
__annotate_from_to(__start_ + __current_size, __map_.size() * __block_size, __asan_poison, __asan_back_moved);
}
#endif
#endif // _LIBCPP_HAS_ASAN
}
_LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
if (empty()) {
for (size_t __i = 0; __i < __map_.size(); ++__i) {
__annotate_whole_block(__i, __asan_unposion);
@ -1036,19 +1036,19 @@ private:
__annotate_from_to(0, __start_, __asan_unposion, __asan_front_moved);
__annotate_from_to(__start_ + size(), __map_.size() * __block_size, __asan_unposion, __asan_back_moved);
}
#endif
#endif // _LIBCPP_HAS_ASAN
}
_LIBCPP_HIDE_FROM_ABI void __annotate_increase_front(size_type __n) const _NOEXCEPT {
(void)__n;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__annotate_from_to(__start_ - __n, __start_, __asan_unposion, __asan_front_moved);
#endif
}
_LIBCPP_HIDE_FROM_ABI void __annotate_increase_back(size_type __n) const _NOEXCEPT {
(void)__n;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__annotate_from_to(__start_ + size(), __start_ + size() + __n, __asan_unposion, __asan_back_moved);
#endif
}
@ -1056,7 +1056,7 @@ private:
_LIBCPP_HIDE_FROM_ABI void __annotate_shrink_front(size_type __old_size, size_type __old_start) const _NOEXCEPT {
(void)__old_size;
(void)__old_start;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__annotate_from_to(__old_start, __old_start + (__old_size - size()), __asan_poison, __asan_front_moved);
#endif
}
@ -1064,7 +1064,7 @@ private:
_LIBCPP_HIDE_FROM_ABI void __annotate_shrink_back(size_type __old_size, size_type __old_start) const _NOEXCEPT {
(void)__old_size;
(void)__old_start;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__annotate_from_to(__old_start + size(), __old_start + __old_size, __asan_poison, __asan_back_moved);
#endif
}
@ -1077,7 +1077,7 @@ private:
__annotate_whole_block(size_t __block_index, __asan_annotation_type __annotation_type) const _NOEXCEPT {
(void)__block_index;
(void)__annotation_type;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__map_const_iterator __block_it = __map_.begin() + __block_index;
const void* __block_start = std::__to_address(*__block_it);
const void* __block_end = std::__to_address(*__block_it + __block_size);
@ -1090,7 +1090,7 @@ private:
}
#endif
}
#if !defined(_LIBCPP_HAS_NO_ASAN)
#if _LIBCPP_HAS_ASAN
public:
_LIBCPP_HIDE_FROM_ABI bool __verify_asan_annotations() const _NOEXCEPT {
@ -1152,7 +1152,7 @@ public:
}
private:
#endif // _LIBCPP_VERIFY_ASAN_DEQUE_ANNOTATIONS
#endif // _LIBCPP_HAS_ASAN
_LIBCPP_HIDE_FROM_ABI bool __maybe_remove_front_spare(bool __keep_one = true) {
if (__front_spare_blocks() >= 2 || (!__keep_one && __front_spare_blocks())) {
__annotate_whole_block(0, __asan_unposion);
@ -2123,22 +2123,22 @@ void deque<_Tp, _Allocator>::__add_front_capacity(size_type __n) {
size_type __ds = (__nb + __back_capacity) * __block_size - __map_.empty();
__split_buffer<pointer, __pointer_allocator&> __buf(
std::max<size_type>(2 * __map_.capacity(), __nb + __map_.size()), 0, __map_.__alloc());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (; __nb > 0; --__nb) {
__buf.push_back(__alloc_traits::allocate(__a, __block_size));
// ASan: this is empty container, we have to poison whole block
__annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__annotate_delete();
for (__map_pointer __i = __buf.begin(); __i != __buf.end(); ++__i)
__alloc_traits::deallocate(__a, *__i, __block_size);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (; __back_capacity > 0; --__back_capacity) {
__buf.push_back(__map_.back());
__map_.pop_back();
@ -2248,22 +2248,22 @@ void deque<_Tp, _Allocator>::__add_back_capacity(size_type __n) {
std::max<size_type>(2 * __map_.capacity(), __nb + __map_.size()),
__map_.size() - __front_capacity,
__map_.__alloc());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (; __nb > 0; --__nb) {
__buf.push_back(__alloc_traits::allocate(__a, __block_size));
// ASan: this is an empty container, we have to poison the whole block
__annotate_poison_block(std::__to_address(__buf.back()), std::__to_address(__buf.back() + __block_size));
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__annotate_delete();
for (__map_pointer __i = __buf.begin(); __i != __buf.end(); ++__i)
__alloc_traits::deallocate(__a, *__i, __block_size);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (; __front_capacity > 0; --__front_capacity) {
__buf.push_back(__map_.front());
__map_.pop_front();

View File

@ -47,7 +47,7 @@ _LIBCPP_HIDE_FROM_ABI auto __choose_mask_type() {
} else if constexpr (sizeof(_Tp) == 8) {
return uint64_t{};
}
# ifndef _LIBCPP_HAS_NO_INT128
# if _LIBCPP_HAS_INT128
else if constexpr (sizeof(_Tp) == 16) {
return __uint128_t{};
}

View File

@ -1122,13 +1122,13 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n, const
if (__n > 0) {
__node_pointer __first = this->__create_node(/* next = */ nullptr, __v);
__node_pointer __last = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (--__n; __n != 0; --__n, __last = __last->__next_) {
__last->__next_ = this->__create_node(/* next = */ nullptr, __v);
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
while (__first != nullptr) {
__node_pointer __next = __first->__next_;
@ -1137,7 +1137,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n, const
}
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__last->__next_ = __r->__next_;
__r->__next_ = __first;
__r = static_cast<__begin_node_pointer>(__last);
@ -1162,13 +1162,13 @@ forward_list<_Tp, _Alloc>::__insert_after_with_sentinel(const_iterator __p, _Inp
__node_pointer __first = this->__create_node(/* next = */ nullptr, *__f);
__node_pointer __last = __first;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_))) {
__last->__next_ = this->__create_node(/* next = */ nullptr, *__f);
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
while (__first != nullptr) {
__node_pointer __next = __first->__next_;
@ -1177,7 +1177,7 @@ forward_list<_Tp, _Alloc>::__insert_after_with_sentinel(const_iterator __p, _Inp
}
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__last->__next_ = __r->__next_;
__r->__next_ = __first;

View File

@ -211,8 +211,10 @@ typedef basic_fstream<wchar_t> wfstream;
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
#if defined(_LIBCPP_MSVCRT) || defined(_NEWLIB_VERSION)
# define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS
#if !defined(_LIBCPP_MSVCRT) && !defined(_NEWLIB_VERSION)
# define _LIBCPP_HAS_OFF_T_FUNCTIONS 1
#else
# define _LIBCPP_HAS_OFF_T_FUNCTIONS 0
#endif
#if !defined(_LIBCPP_HAS_NO_FILESYSTEM) && !defined(_LIBCPP_HAS_NO_LOCALIZATION)
@ -254,7 +256,7 @@ public:
// 27.9.1.4 Members:
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
basic_filebuf* open(const char* __s, ios_base::openmode __mode);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode);
# endif
_LIBCPP_HIDE_FROM_ABI basic_filebuf* open(const string& __s, ios_base::openmode __mode);
@ -281,7 +283,7 @@ public:
# endif // _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI inline static const char* __make_mdstring(ios_base::openmode __mode) _NOEXCEPT;
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
_LIBCPP_HIDE_FROM_ABI inline static const wchar_t* __make_mdwstring(ios_base::openmode __mode) _NOEXCEPT;
# endif
@ -485,14 +487,14 @@ inline basic_filebuf<_CharT, _Traits>& basic_filebuf<_CharT, _Traits>::operator=
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::~basic_filebuf() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
close();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (__owns_eb_)
delete[] __extbuf_;
if (__owns_ib_)
@ -630,7 +632,7 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(ios_base::openmode _
__libcpp_unreachable();
}
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
const wchar_t* basic_filebuf<_CharT, _Traits>::__make_mdwstring(ios_base::openmode __mode) _NOEXCEPT {
switch (__mode & ~ios_base::ate) {
@ -705,7 +707,7 @@ inline basic_filebuf<_CharT, _Traits>* basic_filebuf<_CharT, _Traits>::__open(in
return __do_open(fdopen(__fd, __mdstr), __mode);
}
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
// This is basically the same as the char* overload except that it uses _wfopen
// and long mode strings.
template <class _CharT, class _Traits>
@ -929,7 +931,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
default:
return pos_type(off_type(-1));
}
# if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
# if !_LIBCPP_HAS_OFF_T_FUNCTIONS
if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
return pos_type(off_type(-1));
pos_type __r = ftell(__file_);
@ -947,7 +949,7 @@ typename basic_filebuf<_CharT, _Traits>::pos_type
basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode) {
if (__file_ == nullptr || sync())
return pos_type(off_type(-1));
# if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
# if !_LIBCPP_HAS_OFF_T_FUNCTIONS
if (fseek(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1));
# else
@ -1000,7 +1002,7 @@ int basic_filebuf<_CharT, _Traits>::sync() {
}
}
}
# if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
# if !_LIBCPP_HAS_OFF_T_FUNCTIONS
if (fseek(__file_, -__c, SEEK_CUR))
return -1;
# else
@ -1098,7 +1100,7 @@ public:
_LIBCPP_HIDE_FROM_ABI basic_ifstream();
_LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
_LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
# endif
_LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
@ -1118,7 +1120,7 @@ public:
# endif
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
void open(const char* __s, ios_base::openmode __mode = ios_base::in);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
# endif
void open(const string& __s, ios_base::openmode __mode = ios_base::in);
@ -1147,7 +1149,7 @@ inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base
this->setstate(ios_base::failbit);
}
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
inline basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode)
: basic_istream<char_type, traits_type>(std::addressof(__sb_)) {
@ -1206,7 +1208,7 @@ void basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode _
this->setstate(ios_base::failbit);
}
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
void basic_ifstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
if (__sb_.open(__s, __mode | ios_base::in))
@ -1254,7 +1256,7 @@ public:
_LIBCPP_HIDE_FROM_ABI basic_ofstream();
_LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
_LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
# endif
_LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
@ -1276,7 +1278,7 @@ public:
# endif
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
# endif
void open(const string& __s, ios_base::openmode __mode = ios_base::out);
@ -1306,7 +1308,7 @@ inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base
this->setstate(ios_base::failbit);
}
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
inline basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode)
: basic_ostream<char_type, traits_type>(std::addressof(__sb_)) {
@ -1365,7 +1367,7 @@ void basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode _
this->setstate(ios_base::failbit);
}
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
void basic_ofstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
if (__sb_.open(__s, __mode | ios_base::out))
@ -1414,7 +1416,7 @@ public:
_LIBCPP_HIDE_FROM_ABI basic_fstream();
_LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const char* __s,
ios_base::openmode __mode = ios_base::in | ios_base::out);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
_LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const wchar_t* __s,
ios_base::openmode __mode = ios_base::in | ios_base::out);
# endif
@ -1440,7 +1442,7 @@ public:
# endif
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
_LIBCPP_HIDE_FROM_ABI void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
# endif
_LIBCPP_HIDE_FROM_ABI void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
@ -1469,7 +1471,7 @@ inline basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::
this->setstate(ios_base::failbit);
}
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
inline basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode)
: basic_iostream<char_type, traits_type>(std::addressof(__sb_)) {
@ -1528,7 +1530,7 @@ void basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __
this->setstate(ios_base::failbit);
}
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
# if _LIBCPP_HAS_OPEN_WITH_WCHAR
template <class _CharT, class _Traits>
void basic_fstream<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode) {
if (__sb_.open(__s, __mode))

View File

@ -500,7 +500,7 @@ public:
// Declared above std::future_error
void __throw_future_error(future_errc __ev) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw future_error(make_error_code(__ev));
# else
(void)__ev;
@ -779,15 +779,15 @@ inline __deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f) : __f
template <class _Rp, class _Fp>
void __deferred_assoc_state<_Rp, _Fp>::__execute() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
this->set_value(__func_());
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->set_exception(current_exception());
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Fp>
@ -809,16 +809,16 @@ inline __deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f) : __
template <class _Fp>
void __deferred_assoc_state<void, _Fp>::__execute() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__func_();
this->set_value();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->set_exception(current_exception());
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Rp, class _Fp>
@ -840,15 +840,15 @@ inline __async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f) : __func_(s
template <class _Rp, class _Fp>
void __async_assoc_state<_Rp, _Fp>::__execute() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
this->set_value(__func_());
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->set_exception(current_exception());
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Rp, class _Fp>
@ -876,16 +876,16 @@ inline __async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f) : __func_(
template <class _Fp>
void __async_assoc_state<void, _Fp>::__execute() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__func_();
this->set_value();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->set_exception(current_exception());
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Fp>
@ -1656,15 +1656,15 @@ void packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args) {
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
__throw_future_error(future_errc::promise_already_satisfied);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__p_.set_value(__f_(std::forward<_ArgTypes>(__args)...));
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__p_.set_exception(current_exception());
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Rp, class... _ArgTypes>
@ -1673,15 +1673,15 @@ void packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
__throw_future_error(future_errc::promise_already_satisfied);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__p_.set_value_at_thread_exit(__f_(std::forward<_ArgTypes>(__args)...));
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__p_.set_exception_at_thread_exit(current_exception());
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Rp, class... _ArgTypes>
@ -1758,16 +1758,16 @@ void packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args) {
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
__throw_future_error(future_errc::promise_already_satisfied);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__f_(std::forward<_ArgTypes>(__args)...);
__p_.set_value();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__p_.set_exception(current_exception());
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class... _ArgTypes>
@ -1776,16 +1776,16 @@ void packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... _
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
__throw_future_error(future_errc::promise_already_satisfied);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__f_(std::forward<_ArgTypes>(__args)...);
__p_.set_value_at_thread_exit();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__p_.set_exception_at_thread_exit(current_exception());
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class... _ArgTypes>
@ -1857,13 +1857,13 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) {
typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF;
typedef typename _BF::_Rp _Rp;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
if (__does_policy_contain(__policy, launch::async))
return std::__make_async_assoc_state<_Rp>(
_BF(_LIBCPP_AUTO_CAST(std::forward<_Fp>(__f)), _LIBCPP_AUTO_CAST(std::forward<_Args>(__args))...));
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
if (__policy == launch::async)
throw;

View File

@ -236,9 +236,9 @@ public:
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s) {
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
@ -248,11 +248,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) {
__mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
__is.setstate(__err);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__is.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return __is;
}
@ -285,9 +285,9 @@ public:
template <class _CharT, class _Traits, class _MoneyT>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) {
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
@ -296,11 +296,11 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) {
if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
__os.setstate(ios_base::badbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__os.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return __os;
}
@ -333,9 +333,9 @@ public:
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s) {
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
@ -345,11 +345,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) {
__tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_, __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
__is.setstate(__err);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__is.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return __is;
}
@ -382,9 +382,9 @@ public:
template <class _CharT, class _Traits>
_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) {
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
@ -394,11 +394,11 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) {
.failed())
__os.setstate(ios_base::badbit);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__os.__set_badbit_and_consider_rethrow();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
return __os;
}

View File

@ -232,7 +232,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
// [ios.syn]
# include <iosfwd>
# if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# if _LIBCPP_HAS_ATOMIC_HEADER
# include <__atomic/atomic.h> // for __xindex_
# endif
@ -441,7 +441,7 @@ public:
};
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw ios_base::failure(__msg);
# else
_LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg);

View File

@ -134,7 +134,7 @@ typedef fpos<mbstate_t> streampos;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
typedef fpos<mbstate_t> wstreampos;
#endif
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
typedef fpos<mbstate_t> u8streampos;
#endif
typedef fpos<mbstate_t> u16streampos;

View File

@ -357,13 +357,13 @@ __input_arithmetic(basic_istream<_CharT, _Traits>& __is, _Tp& __n) {
ios_base::iostate __state = ios_base::goodbit;
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef num_get<_CharT, _Ip> _Fp;
std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
__is.__setstate_nothrow(__state);
@ -438,9 +438,9 @@ __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp
ios_base::iostate __state = ios_base::goodbit;
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef num_get<_CharT, _Ip> _Fp;
long __temp;
@ -454,7 +454,7 @@ __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp
} else {
__n = static_cast<_Tp>(__temp);
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
__is.__setstate_nothrow(__state);
@ -462,7 +462,7 @@ __input_arithmetic_with_numeric_limits(basic_istream<_CharT, _Traits>& __is, _Tp
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__is.setstate(__state);
}
return __is;
@ -484,7 +484,7 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
ios_base::iostate __state = ios_base::goodbit;
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
_CharT* __s = __p;
@ -505,7 +505,7 @@ __input_c_string(basic_istream<_CharT, _Traits>& __is, _CharT* __p, size_t __n)
__is.width(0);
if (__s == __p)
__state |= ios_base::failbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
__is.__setstate_nothrow(__state);
@ -572,7 +572,7 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_
ios_base::iostate __state = ios_base::goodbit;
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
@ -580,7 +580,7 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_
__state |= ios_base::eofbit | ios_base::failbit;
else
__c = _Traits::to_char_type(__i);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
__is.__setstate_nothrow(__state);
@ -614,9 +614,9 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
sentry __s(*this, true);
if (__s) {
if (__sb) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
while (true) {
typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, _Traits::eof())) {
@ -630,7 +630,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
}
if (__gc_ == 0)
__state |= ios_base::failbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
if (__gc_ == 0)
@ -641,7 +641,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
} else {
__state |= ios_base::failbit;
}
@ -657,7 +657,7 @@ typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>
int_type __r = traits_type::eof();
sentry __s(*this, true);
if (__s) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
__r = this->rdbuf()->sbumpc();
@ -665,7 +665,7 @@ typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>
__state |= ios_base::failbit | ios_base::eofbit;
else
__gc_ = 1;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__setstate_nothrow(this->rdstate() | ios_base::badbit);
if (this->exceptions() & ios_base::badbit) {
@ -685,7 +685,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(char_type* _
sentry __sen(*this, true);
if (__sen) {
if (__n > 0) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
while (__gc_ < __n - 1) {
@ -703,7 +703,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(char_type* _
}
if (__gc_ == 0)
__state |= ios_base::failbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -734,9 +734,9 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
__gc_ = 0;
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
while (true) {
typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof())) {
@ -751,12 +751,12 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
__inc_gcount();
this->rdbuf()->sbumpc();
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
// according to the spec, exceptions here are caught but not rethrown
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (__gc_ == 0)
__state |= ios_base::failbit;
this->setstate(__state);
@ -771,9 +771,9 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
__gc_ = 0;
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
while (true) {
typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof())) {
@ -794,7 +794,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
this->rdbuf()->sbumpc();
__inc_gcount();
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -806,7 +806,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
if (__n > 0)
*__s = char_type();
@ -822,9 +822,9 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsiz
__gc_ = 0;
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (__n == numeric_limits<streamsize>::max()) {
while (true) {
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
@ -848,7 +848,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsiz
break;
}
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -856,7 +856,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore(streamsiz
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
this->setstate(__state);
}
return *this;
@ -869,13 +869,13 @@ typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>
int_type __r = traits_type::eof();
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__r = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__r, traits_type::eof()))
__state |= ios_base::eofbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -883,7 +883,7 @@ typename basic_istream<_CharT, _Traits>::int_type basic_istream<_CharT, _Traits>
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
this->setstate(__state);
}
return __r;
@ -895,13 +895,13 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::read(char_type*
__gc_ = 0;
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__gc_ = this->rdbuf()->sgetn(__s, __n);
if (__gc_ != __n)
__state |= ios_base::failbit | ios_base::eofbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -909,7 +909,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::read(char_type*
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
} else {
__state |= ios_base::failbit;
}
@ -923,9 +923,9 @@ streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize _
__gc_ = 0;
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
streamsize __c = this->rdbuf()->in_avail();
switch (__c) {
case -1:
@ -940,7 +940,7 @@ streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize _
__state |= ios_base::failbit | ios_base::eofbit;
break;
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -948,7 +948,7 @@ streamsize basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize _
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
} else {
__state |= ios_base::failbit;
}
@ -963,12 +963,12 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::putback(char_typ
this->clear(__state);
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof())
__state |= ios_base::badbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -976,7 +976,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::putback(char_typ
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
} else {
__state |= ios_base::failbit;
}
@ -991,12 +991,12 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
this->clear(__state);
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof())
__state |= ios_base::badbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -1004,7 +1004,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::unget() {
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
} else {
__state |= ios_base::failbit;
}
@ -1021,14 +1021,14 @@ int basic_istream<_CharT, _Traits>::sync() {
int __r = 0;
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (this->rdbuf()->pubsync() == -1) {
__state |= ios_base::badbit;
__r = -1;
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -1036,7 +1036,7 @@ int basic_istream<_CharT, _Traits>::sync() {
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
this->setstate(__state);
}
return __r;
@ -1048,11 +1048,11 @@ typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits>
pos_type __r(-1);
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -1060,7 +1060,7 @@ typename basic_istream<_CharT, _Traits>::pos_type basic_istream<_CharT, _Traits>
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
this->setstate(__state);
}
return __r;
@ -1072,12 +1072,12 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(pos_type _
this->clear(__state);
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
__state |= ios_base::failbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -1085,7 +1085,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(pos_type _
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
this->setstate(__state);
}
return *this;
@ -1097,12 +1097,12 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(off_type _
this->clear(__state);
sentry __sen(*this, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
__state |= ios_base::failbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
this->__setstate_nothrow(__state);
@ -1110,7 +1110,7 @@ basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::seekg(off_type _
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
this->setstate(__state);
}
return *this;
@ -1121,9 +1121,9 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _
ios_base::iostate __state = ios_base::goodbit;
typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc());
while (true) {
typename _Traits::int_type __i = __is.rdbuf()->sgetc();
@ -1135,7 +1135,7 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _
break;
__is.rdbuf()->sbumpc();
}
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
__is.__setstate_nothrow(__state);
@ -1143,7 +1143,7 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& ws(basic_istream<_CharT, _
throw;
}
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__is.setstate(__state);
}
return __is;
@ -1211,7 +1211,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _
ios_base::iostate __state = ios_base::goodbit;
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
__str.clear();
@ -1243,7 +1243,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _
__is.width(0);
if (__c == 0)
__state |= ios_base::failbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
__is.__setstate_nothrow(__state);
@ -1263,7 +1263,7 @@ getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _All
ios_base::iostate __state = ios_base::goodbit;
typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
__str.clear();
@ -1286,7 +1286,7 @@ getline(basic_istream<_CharT, _Traits>& __is, basic_string<_CharT, _Traits, _All
}
if (__extr == 0)
__state |= ios_base::failbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
__is.__setstate_nothrow(__state);
@ -1324,7 +1324,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) {
ios_base::iostate __state = ios_base::goodbit;
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
basic_string<_CharT, _Traits> __str;
@ -1348,7 +1348,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x) {
__x = bitset<_Size>(__str);
if (_Size > 0 && __c == 0)
__state |= ios_base::failbit;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__state |= ios_base::badbit;
__is.__setstate_nothrow(__state);

View File

@ -1157,13 +1157,13 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
++__ds;
__r = iterator(__node->__as_link());
iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
__e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
while (true) {
__base_pointer __prev = __e.__ptr_->__prev_;
@ -1175,7 +1175,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
}
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
base::__sz() += __ds;
}
@ -1199,13 +1199,13 @@ list<_Tp, _Alloc>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Se
++__ds;
__r = iterator(__node->__as_link());
iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (++__f; __f != __l; ++__f, (void)++__e, ++__ds) {
__e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, *__f)->__as_link();
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
while (true) {
__base_pointer __prev = __e.__ptr_->__prev_;
@ -1217,7 +1217,7 @@ list<_Tp, _Alloc>::__insert_with_sentinel(const_iterator __p, _Iterator __f, _Se
}
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
base::__sz() += __ds;
}
@ -1370,13 +1370,13 @@ void list<_Tp, _Alloc>::resize(size_type __n) {
++__ds;
iterator __r = iterator(__node->__as_link());
iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
__e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr)->__as_link();
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
while (true) {
__base_pointer __prev = __e.__ptr_->__prev_;
@ -1388,7 +1388,7 @@ void list<_Tp, _Alloc>::resize(size_type __n) {
}
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__link_nodes_at_back(__r.__ptr_, __e.__ptr_);
base::__sz() += __ds;
}
@ -1406,13 +1406,13 @@ void list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) {
__base_pointer __nl = __node->__as_link();
iterator __r = iterator(__nl);
iterator __e = __r;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (--__n; __n != 0; --__n, (void)++__e, ++__ds) {
__e.__ptr_->__next_ = this->__create_node(/* prev = */ __e.__ptr_, /* next = */ nullptr, __x)->__as_link();
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
while (true) {
__base_pointer __prev = __e.__ptr_->__prev_;
@ -1424,7 +1424,7 @@ void list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x) {
}
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_);
base::__sz() += __ds;
}

View File

@ -223,7 +223,11 @@ template <class charT> class messages_byname;
# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__)
# define _LIBCPP_HAS_CATOPEN 1
# include <nl_types.h>
# else
# define _LIBCPP_HAS_CATOPEN 0
# endif
# else
# define _LIBCPP_HAS_CATOPEN 0
# endif
# ifdef _LIBCPP_LOCALE__L_EXTENSIONS
@ -3074,7 +3078,7 @@ locale::id messages<_CharT>::id;
template <class _CharT>
typename messages<_CharT>::catalog messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const {
# ifdef _LIBCPP_HAS_CATOPEN
# if _LIBCPP_HAS_CATOPEN
return (catalog)catopen(__nm.c_str(), NL_CAT_LOCALE);
# else // !_LIBCPP_HAS_CATOPEN
(void)__nm;
@ -3085,7 +3089,7 @@ typename messages<_CharT>::catalog messages<_CharT>::do_open(const basic_string<
template <class _CharT>
typename messages<_CharT>::string_type
messages<_CharT>::do_get(catalog __c, int __set, int __msgid, const string_type& __dflt) const {
# ifdef _LIBCPP_HAS_CATOPEN
# if _LIBCPP_HAS_CATOPEN
string __ndflt;
__narrow_to_utf8<sizeof(char_type) * __CHAR_BIT__>()(
std::back_inserter(__ndflt), __dflt.c_str(), __dflt.c_str() + __dflt.size());
@ -3105,7 +3109,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid, const string_type&
template <class _CharT>
void messages<_CharT>::do_close(catalog __c) const {
# ifdef _LIBCPP_HAS_CATOPEN
# if _LIBCPP_HAS_CATOPEN
catclose((nl_catd)__c);
# else // !_LIBCPP_HAS_CATOPEN
(void)__c;

View File

@ -103,16 +103,22 @@ void operator delete[](void* ptr, void*) noexcept;
# pragma GCC system_header
#endif
#if !defined(__cpp_sized_deallocation) || __cpp_sized_deallocation < 201309L
# define _LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION
#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L
# define _LIBCPP_HAS_LANGUAGE_SIZED_DEALLOCATION 1
#else
# define _LIBCPP_HAS_LANGUAGE_SIZED_DEALLOCATION 0
#endif
#if !defined(_LIBCPP_BUILDING_LIBRARY) && _LIBCPP_STD_VER < 14 && defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
# define _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
#if _LIBCPP_STD_VER >= 14 || _LIBCPP_HAS_LANGUAGE_SIZED_DEALLOCATION
# define _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION 1
#else
# define _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION 0
#endif
#if defined(_LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION) || defined(_LIBCPP_HAS_NO_LANGUAGE_SIZED_DEALLOCATION)
# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
#if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION && _LIBCPP_HAS_LANGUAGE_SIZED_DEALLOCATION
# define _LIBCPP_HAS_SIZED_DEALLOCATION 1
#else
# define _LIBCPP_HAS_SIZED_DEALLOCATION 0
#endif
namespace std // purposefully not using versioning namespace
@ -169,14 +175,14 @@ public:
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw bad_array_new_length();
#else
_LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode");
#endif
}
#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) && !defined(_LIBCPP_ABI_VCRUNTIME)
#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION && !defined(_LIBCPP_ABI_VCRUNTIME)
# ifndef _LIBCPP_CXX03_LANG
enum class align_val_t : size_t {};
# else
@ -208,7 +214,7 @@ inline constexpr destroying_delete_t destroying_delete{};
_LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
# if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
# endif
@ -217,17 +223,17 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _
_LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
# if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
# endif
# ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
# if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION
[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void*
operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
# if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
# endif
@ -237,7 +243,7 @@ operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
# ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION
# if _LIBCPP_HAS_LIBRARY_SIZED_DEALLOCATION
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
# endif
# endif
@ -284,7 +290,7 @@ _LIBCPP_HIDE_FROM_ABI void __libcpp_operator_delete(_Args... __args) {
}
inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_allocate(size_t __size, size_t __align) {
#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
#if _LIBCPP_HAS_ALIGNED_ALLOCATION
if (__is_overaligned_for_new(__align)) {
const align_val_t __align_val = static_cast<align_val_t>(__align);
return __libcpp_operator_new(__size, __align_val);
@ -297,7 +303,7 @@ inline _LIBCPP_HIDE_FROM_ABI void* __libcpp_allocate(size_t __size, size_t __ali
template <class... _Args>
_LIBCPP_HIDE_FROM_ABI void __do_deallocate_handle_size(void* __ptr, size_t __size, _Args... __args) {
#ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
#if !_LIBCPP_HAS_SIZED_DEALLOCATION
(void)__size;
return std::__libcpp_operator_delete(__ptr, __args...);
#else
@ -306,7 +312,7 @@ _LIBCPP_HIDE_FROM_ABI void __do_deallocate_handle_size(void* __ptr, size_t __siz
}
inline _LIBCPP_HIDE_FROM_ABI void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) {
#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
#if !_LIBCPP_HAS_ALIGNED_ALLOCATION
(void)__align;
return __do_deallocate_handle_size(__ptr, __size);
#else
@ -320,7 +326,7 @@ inline _LIBCPP_HIDE_FROM_ABI void __libcpp_deallocate(void* __ptr, size_t __size
}
inline _LIBCPP_HIDE_FROM_ABI void __libcpp_deallocate_unsized(void* __ptr, size_t __align) {
#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
#if !_LIBCPP_HAS_ALIGNED_ALLOCATION
(void)__align;
return __libcpp_operator_delete(__ptr);
#else

View File

@ -260,7 +260,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void
__throw_bad_optional_access() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw bad_optional_access();
# else
_LIBCPP_VERBOSE_ABORT("bad_optional_access was thrown in -fno-exceptions mode");

View File

@ -984,7 +984,7 @@ public:
template <regex_constants::error_type _Ev>
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_regex_error() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw regex_error(_Ev);
#else
_LIBCPP_VERBOSE_ABORT("regex_error was thrown in -fno-exceptions mode");

View File

@ -786,9 +786,9 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c) {
if (this->pptr() == this->epptr()) {
if (!(__mode_ & ios_base::out))
return traits_type::eof();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
ptrdiff_t __nout = this->pptr() - this->pbase();
ptrdiff_t __hm = __hm_ - this->pbase();
__str_.push_back(char_type());
@ -797,11 +797,11 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c) {
this->setp(__p, __p + __str_.size());
this->__pbump(__nout);
__hm_ = this->pbase() + __hm;
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
return traits_type::eof();
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
__hm_ = std::max(this->pptr() + 1, __hm_);
if (__mode_ & ios_base::in) {

View File

@ -156,7 +156,7 @@ using std::atomic_long _LIBCPP_USING_IF_EXISTS;
using std::atomic_ulong _LIBCPP_USING_IF_EXISTS;
using std::atomic_llong _LIBCPP_USING_IF_EXISTS;
using std::atomic_ullong _LIBCPP_USING_IF_EXISTS;
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
using std::atomic_char8_t _LIBCPP_USING_IF_EXISTS;
# endif
using std::atomic_char16_t _LIBCPP_USING_IF_EXISTS;

View File

@ -212,7 +212,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_runtime_error(const char*);
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_logic_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw logic_error(__msg);
#else
_LIBCPP_VERBOSE_ABORT("logic_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
@ -220,7 +220,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
}
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_domain_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw domain_error(__msg);
#else
_LIBCPP_VERBOSE_ABORT("domain_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
@ -228,7 +228,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
}
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_invalid_argument(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw invalid_argument(__msg);
#else
_LIBCPP_VERBOSE_ABORT("invalid_argument was thrown in -fno-exceptions mode with message \"%s\"", __msg);
@ -236,7 +236,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
}
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_length_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw length_error(__msg);
#else
_LIBCPP_VERBOSE_ABORT("length_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
@ -244,7 +244,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
}
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_out_of_range(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw out_of_range(__msg);
#else
_LIBCPP_VERBOSE_ABORT("out_of_range was thrown in -fno-exceptions mode with message \"%s\"", __msg);
@ -252,7 +252,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
}
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_range_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw range_error(__msg);
#else
_LIBCPP_VERBOSE_ABORT("range_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
@ -260,7 +260,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
}
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_overflow_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw overflow_error(__msg);
#else
_LIBCPP_VERBOSE_ABORT("overflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);
@ -268,7 +268,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
}
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_underflow_error(const char* __msg) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw underflow_error(__msg);
#else
_LIBCPP_VERBOSE_ABORT("underflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg);

View File

@ -672,7 +672,7 @@ basic_string<char32_t> operator""s( const char32_t *str, size_t len );
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
#if _LIBCPP_HAS_ASAN && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
# define _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS __attribute__((__no_sanitize__("address")))
// This macro disables AddressSanitizer (ASan) instrumentation for a specific function,
// allowing memory accesses that would normally trigger ASan errors to proceed without crashing.
@ -785,7 +785,7 @@ public:
//
// This string implementation doesn't contain any references into itself. It only contains a bit that says whether
// it is in small or large string mode, so the entire structure is trivially relocatable if its members are.
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
#if _LIBCPP_HAS_ASAN && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
// When compiling with AddressSanitizer (ASan), basic_string cannot be trivially
// relocatable. Because the object's memory might be poisoned when its content
// is kept inside objects memory (short string optimization), instead of in allocated
@ -799,7 +799,8 @@ public:
basic_string,
void>;
#endif
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
#if _LIBCPP_HAS_ASAN && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pointer __asan_volatile_wrapper(pointer const& __ptr) const {
if (__libcpp_is_constant_evaluated())
return __ptr;
@ -2018,7 +2019,7 @@ private:
__annotate_contiguous_container(const void* __old_mid, const void* __new_mid) const {
(void)__old_mid;
(void)__new_mid;
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
#if _LIBCPP_HAS_ASAN && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
# if defined(__APPLE__)
// TODO: remove after addressing issue #96099 (https://github.com/llvm/llvm-project/issues/96099)
if (!__is_long())
@ -2030,14 +2031,14 @@ private:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_new(size_type __current_size) const _NOEXCEPT {
(void)__current_size;
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
#if _LIBCPP_HAS_ASAN && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
if (!__libcpp_is_constant_evaluated())
__annotate_contiguous_container(data() + capacity() + 1, data() + __current_size + 1);
#endif
}
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_delete() const _NOEXCEPT {
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
#if _LIBCPP_HAS_ASAN && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
if (!__libcpp_is_constant_evaluated())
__annotate_contiguous_container(data() + size() + 1, data() + capacity() + 1);
#endif
@ -2045,7 +2046,7 @@ private:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_increase(size_type __n) const _NOEXCEPT {
(void)__n;
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
#if _LIBCPP_HAS_ASAN && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
if (!__libcpp_is_constant_evaluated())
__annotate_contiguous_container(data() + size() + 1, data() + size() + 1 + __n);
#endif
@ -2053,7 +2054,7 @@ private:
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
(void)__old_size;
#if !defined(_LIBCPP_HAS_NO_ASAN) && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
#if _LIBCPP_HAS_ASAN && defined(_LIBCPP_INSTRUMENTED_WITH_ASAN)
if (!__libcpp_is_constant_evaluated())
__annotate_contiguous_container(data() + __old_size + 1, data() + size() + 1);
#endif
@ -2416,19 +2417,19 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_sentinel(_InputIterator _
__rep_ = __rep();
__annotate_new(0);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (; __first != __last; ++__first)
push_back(*__first);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__annotate_delete();
if (__is_long())
__alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _CharT, class _Traits, class _Allocator>
@ -2463,18 +2464,18 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __fir
__set_long_size(__sz);
}
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
auto __end = __copy_non_overlapping_range(__first, __last, std::__to_address(__p));
traits_type::assign(*__end, value_type());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
if (__is_long())
__alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap());
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__annotate_new(__sz);
}
@ -3376,9 +3377,9 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
// Shrink
// - called from shrink_to_fit should not throw.
// - called from reserve may throw but is not required to.
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
auto __allocation = std::__allocate_at_least(__alloc_, __target_capacity + 1);
// The Standard mandates shrink_to_fit() does not increase the capacity.
@ -3391,11 +3392,11 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
}
__new_data = __allocation.ptr;
__target_capacity = __allocation.count - 1;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
return;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
__begin_lifetime(__new_data, __target_capacity + 1);
__now_long = true;
@ -4234,7 +4235,7 @@ struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<
template <class _Allocator>
struct hash<basic_string<char, char_traits<char>, _Allocator> > : __string_hash<char, _Allocator> {};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
template <class _Allocator>
struct hash<basic_string<char8_t, char_traits<char8_t>, _Allocator> > : __string_hash<char8_t, _Allocator> {};
#endif
@ -4308,7 +4309,7 @@ operator""s(const wchar_t* __str, size_t __len) {
}
# endif
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string<char8_t> operator""s(const char8_t* __str, size_t __len) {
return basic_string<char8_t>(__str, __len);
}

View File

@ -901,7 +901,7 @@ struct __string_view_hash : public __unary_function<basic_string_view<_CharT, ch
template <>
struct hash<basic_string_view<char, char_traits<char> > > : __string_view_hash<char> {};
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
template <>
struct hash<basic_string_view<char8_t, char_traits<char8_t> > > : __string_view_hash<char8_t> {};
#endif
@ -931,7 +931,7 @@ operator""sv(const wchar_t* __str, size_t __len) noexcept {
}
# endif
# ifndef _LIBCPP_HAS_NO_CHAR8_T
# if _LIBCPP_HAS_CHAR8_T
inline _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<char8_t>
operator""sv(const char8_t* __str, size_t __len) noexcept {
return basic_string_view<char8_t>(__str, __len);

View File

@ -273,14 +273,14 @@ public:
}
_LIBCPP_HIDE_FROM_ABI ~basic_syncbuf() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
emit();
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
__dec_reference();
}
@ -337,7 +337,7 @@ protected:
return traits_type::not_eof(__c);
if (this->pptr() == this->epptr()) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
size_t __size = __str_.size();
@ -348,7 +348,7 @@ protected:
this->setp(__p, __p + __str_.size());
this->pbump(__size);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
return traits_type::eof();
}
@ -480,13 +480,13 @@ public:
// TODO validate other unformatted output functions.
typename basic_ostream<char_type, traits_type>::sentry __s(*this);
if (__s) {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif
if (__sb_.emit() == false)
this->setstate(ios::badbit);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
this->__set_badbit_and_consider_rethrow();
}

View File

@ -374,7 +374,7 @@ private:
_LIBCPP_BEGIN_NAMESPACE_STD
[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_cast() {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
throw bad_cast();
#else
_LIBCPP_VERBOSE_ABORT("bad_cast was thrown in -fno-exceptions mode");

View File

@ -1984,17 +1984,17 @@ template <class _Tp>
inline valarray<_Tp>::valarray(size_t __n) : __begin_(nullptr), __end_(nullptr) {
if (__n) {
__begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
::new ((void*)__end_) value_type();
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__clear(__n);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -2007,17 +2007,17 @@ template <class _Tp>
valarray<_Tp>::valarray(const value_type* __p, size_t __n) : __begin_(nullptr), __end_(nullptr) {
if (__n) {
__begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
::new ((void*)__end_) value_type(*__p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__clear(__n);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -2025,17 +2025,17 @@ template <class _Tp>
valarray<_Tp>::valarray(const valarray& __v) : __begin_(nullptr), __end_(nullptr) {
if (__v.size()) {
__begin_ = __end_ = allocator<value_type>().allocate(__v.size());
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
::new ((void*)__end_) value_type(*__p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__clear(__v.size());
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -2051,18 +2051,18 @@ valarray<_Tp>::valarray(initializer_list<value_type> __il) : __begin_(nullptr),
const size_t __n = __il.size();
if (__n) {
__begin_ = __end_ = allocator<value_type>().allocate(__n);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
try {
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
size_t __n_left = __n;
for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
::new ((void*)__end_) value_type(*__p);
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__clear(__n);
throw;
}
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
# endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -2073,18 +2073,18 @@ valarray<_Tp>::valarray(const slice_array<value_type>& __sa) : __begin_(nullptr)
const size_t __n = __sa.__size_;
if (__n) {
__begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
size_t __n_left = __n;
for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
::new ((void*)__end_) value_type(*__p);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__clear(__n);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -2093,19 +2093,19 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga) : __begin_(nullptr
const size_t __n = __ga.__1d_.size();
if (__n) {
__begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
typedef const size_t* _Ip;
const value_type* __s = __ga.__vp_;
for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; __i != __e; ++__i, ++__end_)
::new ((void*)__end_) value_type(__s[*__i]);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__clear(__n);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -2114,19 +2114,19 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma) : __begin_(nullptr),
const size_t __n = __ma.__1d_.size();
if (__n) {
__begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
typedef const size_t* _Ip;
const value_type* __s = __ma.__vp_;
for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; __i != __e; ++__i, ++__end_)
::new ((void*)__end_) value_type(__s[*__i]);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__clear(__n);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -2135,19 +2135,19 @@ valarray<_Tp>::valarray(const indirect_array<value_type>& __ia) : __begin_(nullp
const size_t __n = __ia.__1d_.size();
if (__n) {
__begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
typedef const size_t* _Ip;
const value_type* __s = __ia.__vp_;
for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; __i != __e; ++__i, ++__end_)
::new ((void*)__end_) value_type(__s[*__i]);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__clear(__n);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -2636,17 +2636,17 @@ void valarray<_Tp>::resize(size_t __n, value_type __x) {
__clear(size());
if (__n) {
__begin_ = __end_ = allocator<value_type>().allocate(__n);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
::new ((void*)__end_) value_type(__x);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
__clear(__n);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}

View File

@ -307,7 +307,7 @@ struct __farray {
[[noreturn]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void
__throw_bad_variant_access() {
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
throw bad_variant_access();
# else
_LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode");
@ -1062,7 +1062,7 @@ public:
std::swap(__lhs, __rhs);
}
__impl __tmp(std::move(*__rhs));
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
# if _LIBCPP_HAS_EXCEPTIONS
if constexpr (__all<is_nothrow_move_constructible_v<_Types>...>::value) {
this->__generic_construct(*__rhs, std::move(*__lhs));
} else {
@ -1300,7 +1300,7 @@ public:
__impl_.__swap(__that.__impl_);
}
# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_HAS_EXPLICIT_THIS_PARAMETER)
# if _LIBCPP_STD_VER >= 26 && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER
// Helper class to implement [variant.visit]/10
// Constraints: The call to visit does not use an explicit template-argument-list
// that begins with a type template-argument.

View File

@ -917,27 +917,27 @@ private:
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_new(size_type __current_size) const _NOEXCEPT {
(void)__current_size;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__annotate_contiguous_container(data() + capacity(), data() + __current_size);
#endif
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_delete() const _NOEXCEPT {
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__annotate_contiguous_container(data() + size(), data() + capacity());
#endif
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_increase(size_type __n) const _NOEXCEPT {
(void)__n;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__annotate_contiguous_container(data() + size(), data() + size() + __n);
#endif
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __annotate_shrink(size_type __old_size) const _NOEXCEPT {
(void)__old_size;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__annotate_contiguous_container(data() + __old_size, data() + size());
#endif
}
@ -945,14 +945,14 @@ private:
struct _ConstructTransaction {
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(vector& __v, size_type __n)
: __v_(__v), __pos_(__v.__end_), __new_end_(__v.__end_ + __n) {
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
__v_.__annotate_increase(__n);
#endif
}
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() {
__v_.__end_ = __pos_;
#ifndef _LIBCPP_HAS_NO_ASAN
#if _LIBCPP_HAS_ASAN
if (__pos_ != __new_end_) {
__v_.__annotate_shrink(__new_end_ - __v_.__begin_);
}
@ -1482,9 +1482,9 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::reserve(size_type __
template <class _Tp, class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT {
if (capacity() > size()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
allocator_type& __a = this->__alloc();
__split_buffer<value_type, allocator_type&> __v(size(), size(), __a);
// The Standard mandates shrink_to_fit() does not increase the capacity.
@ -1492,10 +1492,10 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOE
// due to swapping the elements.
if (__v.capacity() < capacity())
__swap_out_circular_buffer(__v);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -1733,21 +1733,21 @@ vector<_Tp, _Allocator>::__insert_with_sentinel(const_iterator __position, _Inpu
}
__split_buffer<value_type, allocator_type&> __v(__a);
if (__first != __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__v.__construct_at_end_with_sentinel(std::move(__first), std::move(__last));
difference_type __old_size = __old_last - this->__begin_;
difference_type __old_p = __p - this->__begin_;
reserve(__recommend(size() + __v.size()));
__p = this->__begin_ + __old_p;
__old_last = this->__begin_ + __old_size;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
erase(__make_iter(__old_last), end());
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
__p = std::rotate(__p, __old_last, this->__end_);
insert(__make_iter(__p), std::make_move_iterator(__v.begin()), std::make_move_iterator(__v.end()));
@ -2190,18 +2190,18 @@ private:
template <class _InputIterator, class _Sentinel>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
__init_with_sentinel(_InputIterator __first, _Sentinel __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
for (; __first != __last; ++__first)
push_back(*__first);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
if (__begin_ != nullptr)
__storage_traits::deallocate(__alloc(), __begin_, __cap());
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
template <class _Iterator, class _Sentinel>
@ -2648,14 +2648,14 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::reserve(size_type _
template <class _Allocator>
_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<bool, _Allocator>::shrink_to_fit() _NOEXCEPT {
if (__external_cap_to_internal(size()) > __cap()) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
vector(*this, allocator_type(__alloc())).swap(*this);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
}
@ -2744,21 +2744,21 @@ vector<bool, _Allocator>::__insert_with_sentinel(const_iterator __position, _Inp
}
vector __v(get_allocator());
if (__first != __last) {
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
__v.__assign_with_sentinel(std::move(__first), std::move(__last));
difference_type __old_size = static_cast<difference_type>(__old_end - begin());
difference_type __old_p = __p - begin();
reserve(__recommend(size() + __v.size()));
__p = begin() + __old_p;
__old_end = begin() + __old_size;
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
erase(__old_end, end());
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
}
__p = std::rotate(__p, __old_end, end());
insert(__p, __v.begin(), __v.end());

View File

@ -384,7 +384,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_bit_cast 201806L
# define __cpp_lib_bitops 201907L
# define __cpp_lib_bounded_array_traits 201902L
# if !defined(_LIBCPP_HAS_NO_CHAR8_T)
# if _LIBCPP_HAS_CHAR8_T
# define __cpp_lib_char8_t 201907L
# endif
# define __cpp_lib_concepts 202002L

View File

@ -17,7 +17,7 @@ export {
// size_t is conditionally here, but always present in cstddef.cppm. To avoid
// conflicing declarations omit the using here.
#if !defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8)
#if _LIBCPP_HAS_C8RTOMB_MBRTOC8
using ::mbrtoc8 _LIBCPP_USING_IF_EXISTS;
using ::c8rtomb _LIBCPP_USING_IF_EXISTS;
#endif

View File

@ -20,7 +20,7 @@ module;
#include <algorithm>
#include <any>
#include <array>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
#if _LIBCPP_HAS_ATOMIC_HEADER
# include <atomic>
#endif
#include <barrier>

View File

@ -60,7 +60,7 @@ export namespace std {
using std::atomic_char _LIBCPP_USING_IF_EXISTS;
using std::atomic_char16_t _LIBCPP_USING_IF_EXISTS;
using std::atomic_char32_t _LIBCPP_USING_IF_EXISTS;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
using std::atomic_char8_t _LIBCPP_USING_IF_EXISTS;
#endif
using std::atomic_int _LIBCPP_USING_IF_EXISTS;

View File

@ -17,7 +17,7 @@ export namespace std {
// size_t is conditionally here, but always present in cstddef.cppm. To avoid
// conflicing declarations omit the using here.
#if !defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8)
#if _LIBCPP_HAS_C8RTOMB_MBRTOC8
using std::mbrtoc8 _LIBCPP_USING_IF_EXISTS;
using std::c8rtomb _LIBCPP_USING_IF_EXISTS;
#endif

View File

@ -14,7 +14,7 @@ export namespace std {
#endif
using std::u16streampos;
using std::u32streampos;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
using std::u8streampos;
#endif

View File

@ -154,9 +154,9 @@ export namespace std {
using std::reinterpret_pointer_cast;
using std::static_pointer_cast;
#ifndef _LIBCPP_HAS_NO_RTTI
#if _LIBCPP_HAS_RTTI
using std::get_deleter;
#endif // _LIBCPP_HAS_NO_RTTI
#endif // _LIBCPP_HAS_RTTI
// [util.smartptr.shared.io], shared_ptr I/O

View File

@ -34,7 +34,7 @@ export namespace std {
using std::string;
using std::u16string;
using std::u32string;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
using std::u8string;
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
@ -60,7 +60,7 @@ export namespace std {
using std::pmr::string;
using std::pmr::u16string;
using std::pmr::u32string;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
using std::pmr::u8string;
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS

View File

@ -27,7 +27,7 @@ export namespace std {
using std::string_view;
using std::u16string_view;
using std::u32string_view;
#ifndef _LIBCPP_HAS_NO_CHAR8_T
#if _LIBCPP_HAS_CHAR8_T
using std::u8string_view;
#endif
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS

View File

@ -14,7 +14,7 @@
#include <__config>
#include <__thread/support.h>
#if _LIBCPP_ABI_VERSION == 1 || !defined(_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION)
#if _LIBCPP_ABI_VERSION == 1 || !_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
# define NEEDS_CONDVAR_DESTRUCTOR
#endif

View File

@ -186,16 +186,16 @@ struct ErrorHandler {
T report(const error_code& ec, const char* msg, ...) const {
va_list ap;
va_start(ap, msg);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
report_impl(ec, msg, ap);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
va_end(ap);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
va_end(ap);
return error_value<T>();
}
@ -206,16 +206,16 @@ struct ErrorHandler {
T report(errc const& err, const char* msg, ...) const {
va_list ap;
va_start(ap, msg);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
report_impl(make_error_code(err), msg, ap);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
va_end(ap);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
va_end(ap);
return error_value<T>();
}

View File

@ -56,16 +56,16 @@ inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) string format_string(const cha
string ret;
va_list ap;
va_start(ap, msg);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
try {
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
ret = detail::vformat_string(msg, ap);
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
#if _LIBCPP_HAS_EXCEPTIONS
} catch (...) {
va_end(ap);
throw;
}
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_EXCEPTIONS
va_end(ap);
return ret;
}

Some files were not shown because too many files have changed in this diff Show More