diff options
Diffstat (limited to 'gnu/llvm/libcxx/include')
26 files changed, 3457 insertions, 6645 deletions
diff --git a/gnu/llvm/libcxx/include/__algorithm/ranges_find.h b/gnu/llvm/libcxx/include/__algorithm/ranges_find.h index ca6d2f43829..580c2a14c9e 100644 --- a/gnu/llvm/libcxx/include/__algorithm/ranges_find.h +++ b/gnu/llvm/libcxx/include/__algorithm/ranges_find.h @@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if _LIBCPP_STD_VER > 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -35,7 +35,7 @@ namespace __find { struct __fn { template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, class _Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<_Ip, _Proj>, const _Tp*> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __first, _Sp __last, const _Tp& __value, _Proj __proj = {}) const { auto __pred = [&](auto&& __e) { return std::forward<decltype(__e)>(__e) == __value; }; return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj); @@ -43,7 +43,7 @@ struct __fn { template <input_range _Rp, class _Tp, class _Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Rp>, _Proj>, const _Tp*> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> operator()(_Rp&& __r, const _Tp& __value, _Proj __proj = {}) const { auto __pred = [&](auto&& __e) { return std::forward<decltype(__e)>(__e) == __value; }; return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); @@ -58,6 +58,6 @@ inline namespace __cpo { _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#endif // _LIBCPP_STD_VER > 17 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_H diff --git a/gnu/llvm/libcxx/include/__algorithm/ranges_find_if.h b/gnu/llvm/libcxx/include/__algorithm/ranges_find_if.h index 65ac122f667..45ce6e460d6 100644 --- a/gnu/llvm/libcxx/include/__algorithm/ranges_find_if.h +++ b/gnu/llvm/libcxx/include/__algorithm/ranges_find_if.h @@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if _LIBCPP_STD_VER > 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -45,14 +45,14 @@ struct __fn { template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, indirect_unary_predicate<projected<_Ip, _Proj>> _Pred> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj); } template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj); } @@ -66,6 +66,6 @@ inline namespace __cpo { _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#endif // _LIBCPP_STD_VER > 17 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_H diff --git a/gnu/llvm/libcxx/include/__algorithm/ranges_find_if_not.h b/gnu/llvm/libcxx/include/__algorithm/ranges_find_if_not.h index 9a1adf71fc5..3dd12132754 100644 --- a/gnu/llvm/libcxx/include/__algorithm/ranges_find_if_not.h +++ b/gnu/llvm/libcxx/include/__algorithm/ranges_find_if_not.h @@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#if _LIBCPP_STD_VER > 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -35,7 +35,7 @@ namespace __find_if_not { struct __fn { template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity, indirect_unary_predicate<projected<_Ip, _Proj>> _Pred> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const { auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); }; return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred2, __proj); @@ -43,7 +43,7 @@ struct __fn { template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred> - _LIBCPP_HIDE_FROM_ABI constexpr + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const { auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); }; return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred2, __proj); @@ -58,6 +58,6 @@ inline namespace __cpo { _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) +#endif // _LIBCPP_STD_VER > 17 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H diff --git a/gnu/llvm/libcxx/include/__bits b/gnu/llvm/libcxx/include/__bits deleted file mode 100644 index b565a782358..00000000000 --- a/gnu/llvm/libcxx/include/__bits +++ /dev/null @@ -1,145 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___BITS -#define _LIBCPP___BITS - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - -_LIBCPP_BEGIN_NAMESPACE_STD - -#ifndef _LIBCPP_COMPILER_MSVC - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_ctz(unsigned __x) _NOEXCEPT { return __builtin_ctz(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_ctz(unsigned long __x) _NOEXCEPT { return __builtin_ctzl(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_ctz(unsigned long long __x) _NOEXCEPT { return __builtin_ctzll(__x); } - - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_clz(unsigned __x) _NOEXCEPT { return __builtin_clz(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_clz(unsigned long __x) _NOEXCEPT { return __builtin_clzl(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_clz(unsigned long long __x) _NOEXCEPT { return __builtin_clzll(__x); } - - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -int __libcpp_popcount(unsigned long long __x) _NOEXCEPT { return __builtin_popcountll(__x); } - -#else // _LIBCPP_COMPILER_MSVC - -// Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long __where; - if (_BitScanForward(&__where, __x)) - return static_cast<int>(__where); - return 32; -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned long __x) { - static_assert(sizeof(unsigned long) == sizeof(unsigned), ""); - return __ctz(static_cast<unsigned>(__x)); -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_ctz(unsigned long long __x) { - unsigned long __where; -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanForward64(&__where, __x)) - return static_cast<int>(__where); -#else - // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls. - if (_BitScanForward(&__where, static_cast<unsigned long>(__x))) - return static_cast<int>(__where); - if (_BitScanForward(&__where, static_cast<unsigned long>(__x >> 32))) - return static_cast<int>(__where + 32); -#endif - return 64; -} - -// Precondition: __x != 0 -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - static_assert(sizeof(unsigned long) == 4, ""); - unsigned long __where; - if (_BitScanReverse(&__where, __x)) - return static_cast<int>(31 - __where); - return 32; // Undefined Behavior. -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned long __x) { - static_assert(sizeof(unsigned) == sizeof(unsigned long), ""); - return __libcpp_clz(static_cast<unsigned>(__x)); -} - -inline _LIBCPP_INLINE_VISIBILITY -int __libcpp_clz(unsigned long long __x) { - unsigned long __where; -#if defined(_LIBCPP_HAS_BITSCAN64) - if (_BitScanReverse64(&__where, __x)) - return static_cast<int>(63 - __where); -#else - // Win32 doesn't have _BitScanReverse64 so emulate it with two 32 bit calls. - if (_BitScanReverse(&__where, static_cast<unsigned long>(__x >> 32))) - return static_cast<int>(63 - (__where + 32)); - if (_BitScanReverse(&__where, static_cast<unsigned long>(__x))) - return static_cast<int>(63 - __where); -#endif - return 64; // Undefined Behavior. -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned __x) { - static_assert(sizeof(unsigned) == 4, ""); - return __popcnt(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long __x) { - static_assert(sizeof(unsigned long) == 4, ""); - return __popcnt(__x); -} - -inline _LIBCPP_INLINE_VISIBILITY int __libcpp_popcount(unsigned long long __x) { - static_assert(sizeof(unsigned long long) == 8, ""); - return __popcnt64(__x); -} - -#endif // _LIBCPP_COMPILER_MSVC - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___BITS diff --git a/gnu/llvm/libcxx/include/__config b/gnu/llvm/libcxx/include/__config index 97e33f3157a..10815388389 100644 --- a/gnu/llvm/libcxx/include/__config +++ b/gnu/llvm/libcxx/include/__config @@ -1,5 +1,5 @@ // -*- C++ -*- -//===--------------------------- __config ---------------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_CONFIG -#define _LIBCPP_CONFIG +#ifndef _LIBCPP___CONFIG +#define _LIBCPP___CONFIG #include <__config_site> @@ -19,1175 +19,958 @@ #endif #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -#pragma GCC system_header +# pragma GCC system_header +#endif + +#if defined(__apple_build_version__) +// Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403) +# define _LIBCPP_COMPILER_CLANG_BASED +# define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000) +#elif defined(__clang__) +# define _LIBCPP_COMPILER_CLANG_BASED +# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) +#elif defined(__GNUC__) +# define _LIBCPP_COMPILER_GCC #endif #ifdef __cplusplus -#ifdef __GNUC__ -# define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) -// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme -// introduced in GCC 5.0. -# define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) -#else -# define _GNUC_VER 0 -# define _GNUC_VER_NEW 0 -#endif +// _LIBCPP_VERSION represents the version of libc++, which matches the version of LLVM. +// Given a LLVM release LLVM XX.YY.ZZ (e.g. LLVM 16.0.1 == 16.00.01), _LIBCPP_VERSION is +// defined to XXYYZZ. +# define _LIBCPP_VERSION 160006 -#define _LIBCPP_VERSION 13000 +# define _LIBCPP_CONCAT_IMPL(_X, _Y) _X##_Y +# define _LIBCPP_CONCAT(_X, _Y) _LIBCPP_CONCAT_IMPL(_X, _Y) -#ifndef _LIBCPP_ABI_VERSION -# define _LIBCPP_ABI_VERSION 1 -#endif +// Valid C++ identifier that revs with every libc++ version. This can be used to +// generate identifiers that must be unique for every released libc++ version. +# define _LIBCPP_VERSIONED_IDENTIFIER _LIBCPP_CONCAT(v, _LIBCPP_VERSION) -#if __STDC_HOSTED__ == 0 -# define _LIBCPP_FREESTANDING -#endif +# if __STDC_HOSTED__ == 0 +# define _LIBCPP_FREESTANDING +# endif -#ifndef _LIBCPP_STD_VER -# if __cplusplus <= 201103L -# define _LIBCPP_STD_VER 11 -# elif __cplusplus <= 201402L -# define _LIBCPP_STD_VER 14 -# elif __cplusplus <= 201703L -# define _LIBCPP_STD_VER 17 -# elif __cplusplus <= 202002L -# define _LIBCPP_STD_VER 20 +# ifndef _LIBCPP_STD_VER +# if __cplusplus <= 201103L +# define _LIBCPP_STD_VER 11 +# elif __cplusplus <= 201402L +# define _LIBCPP_STD_VER 14 +# elif __cplusplus <= 201703L +# define _LIBCPP_STD_VER 17 +# elif __cplusplus <= 202002L +# define _LIBCPP_STD_VER 20 +# else +// Expected release year of the next C++ standard +# define _LIBCPP_STD_VER 23 +# endif +# endif // _LIBCPP_STD_VER + +# if defined(__ELF__) +# define _LIBCPP_OBJECT_FORMAT_ELF 1 +# elif defined(__MACH__) +# define _LIBCPP_OBJECT_FORMAT_MACHO 1 +# elif defined(_WIN32) +# define _LIBCPP_OBJECT_FORMAT_COFF 1 +# elif defined(__wasm__) +# define _LIBCPP_OBJECT_FORMAT_WASM 1 +# elif defined(_AIX) +# define _LIBCPP_OBJECT_FORMAT_XCOFF 1 # else -# define _LIBCPP_STD_VER 21 // current year, or date of c++2b ratification -# endif -#endif // _LIBCPP_STD_VER - -#if defined(__ELF__) -# define _LIBCPP_OBJECT_FORMAT_ELF 1 -#elif defined(__MACH__) -# define _LIBCPP_OBJECT_FORMAT_MACHO 1 -#elif defined(_WIN32) -# define _LIBCPP_OBJECT_FORMAT_COFF 1 -#elif defined(__wasm__) -# define _LIBCPP_OBJECT_FORMAT_WASM 1 -#else - // ... add new file formats here ... -#endif +// ... add new file formats here ... +# endif -#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 +# if _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. -# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. -# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE +# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE // Fix undefined behavior in how std::list stores its linked nodes. -# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __tree stores its end and parent nodes. -# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __hash_table stores its pointer types. -# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB -# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB -# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE -// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr -// provided under the alternate keyword __nullptr, which changes the mangling -// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. -# define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR +# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB +# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE // Define a key function for `bad_function_call` in the library, to centralize // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. -# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +// Override the default return value of exception::what() for +// bad_function_call::what() with a string that is specific to +// bad_function_call (see http://wg21.link/LWG2233). This is an ABI break +// because it changes the vtable layout of bad_function_call. +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE // Enable optimized version of __do_get_(un)signed which avoids redundant copies. -# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET -// In C++20 and later, don't derive std::plus from std::binary_function, -// nor std::negate from std::unary_function. -# define _LIBCPP_ABI_NO_BINDER_BASES +# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET // Give reverse_iterator<T> one data member of type T, not two. // Also, in C++17 and later, don't derive iterator types from std::iterator. -# define _LIBCPP_ABI_NO_ITERATOR_BASES +# define _LIBCPP_ABI_NO_ITERATOR_BASES // Use the smallest possible integer type to represent the index of the variant. // Previously libc++ used "unsigned int" exclusively. -# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION +# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION // Unstable attempt to provide a more optimized std::function -# define _LIBCPP_ABI_OPTIMIZED_FUNCTION +# define _LIBCPP_ABI_OPTIMIZED_FUNCTION // All the regex constants must be distinct and nonzero. -# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO -// Use raw pointers, not wrapped ones, for std::span's iterator type. -# define _LIBCPP_ABI_SPAN_POINTER_ITERATORS +# define _LIBCPP_ABI_REGEX_CONSTANTS_NONZERO // Re-worked external template instantiations for std::string with a focus on // performance and fast-path inlining. -# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION +# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION // Enable clang::trivial_abi on std::unique_ptr. -# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI +# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI // Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr -# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI -#elif _LIBCPP_ABI_VERSION == 1 -# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) +# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI +// std::random_device holds some state when it uses an implementation that gets +// entropy from a file (see _LIBCPP_USING_DEV_RANDOM). When switching from this +// implementation to another one on a platform that has already shipped +// std::random_device, one needs to retain the same object layout to remain ABI +// compatible. This switch removes these workarounds for platforms that don't care +// about ABI compatibility. +# define _LIBCPP_ABI_NO_RANDOM_DEVICE_COMPATIBILITY_LAYOUT +// Don't export the legacy __basic_string_common class and its methods from the built library. +# define _LIBCPP_ABI_DO_NOT_EXPORT_BASIC_STRING_COMMON +// Don't export the legacy __vector_base_common class and its methods from the built library. +# define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON +// According to the Standard, `bitset::operator[] const` returns bool +# define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL +// Fix the implementation of CityHash used for std::hash<fundamental-type>. +// This is an ABI break because `std::hash` will return a different result, +// which means that hashing the same object in translation units built against +// different versions of libc++ can return inconsistent results. This is especially +// tricky since std::hash is used in the implementation of unordered containers. +// +// The incorrect implementation of CityHash has the problem that it drops some +// bits on the floor. +# define _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION +// Remove the base 10 implementation of std::to_chars from the dylib. +// The implementation moved to the header, but we still export the symbols from +// the dylib for backwards compatibility. +# define _LIBCPP_ABI_DO_NOT_EXPORT_TO_CHARS_BASE_10 +# elif _LIBCPP_ABI_VERSION == 1 +# if !(defined(_LIBCPP_OBJECT_FORMAT_COFF) || defined(_LIBCPP_OBJECT_FORMAT_XCOFF)) // Enable compiling copies of now inline methods into the dylib to support // applications compiled against older libraries. This is unnecessary with // COFF dllexport semantics, since dllexport forces a non-inline definition // of inline functions to be emitted anyway. Our own non-inline copy would -// conflict with the dllexport-emitted copy, so we disable it. -# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS -# endif +// conflict with the dllexport-emitted copy, so we disable it. For XCOFF, +// the linker will take issue with the symbols in the shared object if the +// weak inline methods get visibility (such as from -fvisibility-inlines-hidden), +// so disable it. +# define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS +# endif // Feature macros for disabling pre ABI v1 features. All of these options // are deprecated. -# if defined(__FreeBSD__) -# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +# if defined(__FreeBSD__) +# define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR +# endif # endif -#endif -#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 +# if defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_ABI_VERSION >= 2 // Enable additional explicit instantiations of iostreams components. This // reduces the number of weak definitions generated in programs that use // iostreams by providing a single strong definition in the shared library. -# define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 -#endif +# define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 -#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y -#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) +// Define a key function for `bad_function_call` in the library, to centralize +// its vtable and typeinfo to libc++ rather than having all other libraries +// using that class define their own copies. +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# endif -#ifndef _LIBCPP_ABI_NAMESPACE -# define _LIBCPP_ABI_NAMESPACE _LIBCPP_CONCAT(__,_LIBCPP_ABI_VERSION) -#endif +# define _LIBCPP_TOSTRING2(x) #x +# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) -#if __cplusplus < 201103L -#define _LIBCPP_CXX03_LANG -#endif +# if __cplusplus < 201103L +# define _LIBCPP_CXX03_LANG +# endif -#ifndef __has_attribute -#define __has_attribute(__x) 0 -#endif +# ifndef __has_attribute +# define __has_attribute(__x) 0 +# endif -#ifndef __has_builtin -#define __has_builtin(__x) 0 -#endif +# ifndef __has_builtin +# define __has_builtin(__x) 0 +# endif -#ifndef __has_extension -#define __has_extension(__x) 0 -#endif +# ifndef __has_extension +# define __has_extension(__x) 0 +# endif -#ifndef __has_feature -#define __has_feature(__x) 0 -#endif +# ifndef __has_feature +# define __has_feature(__x) 0 +# endif -#ifndef __has_cpp_attribute -#define __has_cpp_attribute(__x) 0 -#endif +# ifndef __has_cpp_attribute +# define __has_cpp_attribute(__x) 0 +# endif + +# ifndef __has_constexpr_builtin +# define __has_constexpr_builtin(x) 0 +# endif // '__is_identifier' returns '0' if '__x' is a reserved identifier provided by // the compiler and '1' otherwise. -#ifndef __is_identifier -#define __is_identifier(__x) 1 -#endif - -#ifndef __has_declspec_attribute -#define __has_declspec_attribute(__x) 0 -#endif +# ifndef __is_identifier +# define __is_identifier(__x) 1 +# endif -#define __has_keyword(__x) !(__is_identifier(__x)) +# ifndef __has_declspec_attribute +# define __has_declspec_attribute(__x) 0 +# endif -#ifndef __has_include -#define __has_include(...) 0 -#endif +# define __has_keyword(__x) !(__is_identifier(__x)) -#if defined(__apple_build_version__) -# define _LIBCPP_COMPILER_CLANG_BASED -# define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000) -#elif defined(__clang__) -# define _LIBCPP_COMPILER_CLANG_BASED -# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) -#elif defined(__GNUC__) -# define _LIBCPP_COMPILER_GCC -#elif defined(_MSC_VER) -# define _LIBCPP_COMPILER_MSVC -#elif defined(__IBMCPP__) -# define _LIBCPP_COMPILER_IBM -#endif +# ifndef __has_include +# define __has_include(...) 0 +# endif -#if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L -#error "libc++ does not support using GCC with C++03. Please enable C++11" -#endif +# if !defined(_LIBCPP_COMPILER_CLANG_BASED) && __cplusplus < 201103L +# error "libc++ only supports C++03 with Clang-based compilers. Please enable C++11" +# endif // FIXME: ABI detection should be done via compiler builtin macros. This // is just a placeholder until Clang implements such macros. For now assume // that Windows compilers pretending to be MSVC++ target the Microsoft ABI, // and allow the user to explicitly specify the ABI to handle cases where this // heuristic falls short. -#if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" -#elif defined(_LIBCPP_ABI_FORCE_ITANIUM) -# define _LIBCPP_ABI_ITANIUM -#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) -# define _LIBCPP_ABI_MICROSOFT -#else -# if defined(_WIN32) && defined(_MSC_VER) +# if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT) +# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined" +# elif defined(_LIBCPP_ABI_FORCE_ITANIUM) +# define _LIBCPP_ABI_ITANIUM +# elif defined(_LIBCPP_ABI_FORCE_MICROSOFT) # define _LIBCPP_ABI_MICROSOFT # else -# define _LIBCPP_ABI_ITANIUM +# if defined(_WIN32) && defined(_MSC_VER) +# define _LIBCPP_ABI_MICROSOFT +# else +# define _LIBCPP_ABI_ITANIUM +# endif # endif -#endif -#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) -# define _LIBCPP_ABI_VCRUNTIME -#endif +# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME) +# define _LIBCPP_ABI_VCRUNTIME +# endif -// Need to detect which libc we're using if we're on Linux. -#if defined(__linux__) -# include <features.h> -# if defined(__GLIBC_PREREQ) -# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) -# else -# define _LIBCPP_GLIBC_PREREQ(a, b) 0 -# endif // defined(__GLIBC_PREREQ) -#endif // defined(__linux__) +# if __has_feature(experimental_library) +# ifndef _LIBCPP_ENABLE_EXPERIMENTAL +# define _LIBCPP_ENABLE_EXPERIMENTAL +# endif +# endif -#ifdef __LITTLE_ENDIAN__ -# if __LITTLE_ENDIAN__ -# define _LIBCPP_LITTLE_ENDIAN -# endif // __LITTLE_ENDIAN__ -#endif // __LITTLE_ENDIAN__ +// Incomplete features get their own specific disabling flags. This makes it +// easier to grep for target specific flags once the feature is complete. +# if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY) +# define _LIBCPP_HAS_NO_INCOMPLETE_FORMAT +# endif -#ifdef __BIG_ENDIAN__ -# if __BIG_ENDIAN__ -# define _LIBCPP_BIG_ENDIAN -# endif // __BIG_ENDIAN__ -#endif // __BIG_ENDIAN__ +// Need to detect which libc we're using if we're on Linux. +# if defined(__linux__) +# include <features.h> +# if defined(__GLIBC_PREREQ) +# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) +# else +# define _LIBCPP_GLIBC_PREREQ(a, b) 0 +# endif // defined(__GLIBC_PREREQ) +# endif // defined(__linux__) -#ifdef __BYTE_ORDER__ -# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# define _LIBCPP_LITTLE_ENDIAN -# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -# define _LIBCPP_BIG_ENDIAN -# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -#endif // __BYTE_ORDER__ - -#ifdef __FreeBSD__ -# include <sys/endian.h> -# include <osreldate.h> -# if _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -# ifndef __LONG_LONG_SUPPORTED -# define _LIBCPP_HAS_NO_LONG_LONG -# endif // __LONG_LONG_SUPPORTED -#endif // __FreeBSD__ - -#if defined(__NetBSD__) || defined(__OpenBSD__) -# include <sys/endian.h> -# if _BYTE_ORDER == _LITTLE_ENDIAN +# if defined(__MVS__) +# include <features.h> // for __NATIVE_ASCII_F +# endif + +# ifdef __LITTLE_ENDIAN__ +# if __LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# endif // __LITTLE_ENDIAN__ +# endif // __LITTLE_ENDIAN__ + +# ifdef __BIG_ENDIAN__ +# if __BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BIG_ENDIAN__ +# endif // __BIG_ENDIAN__ + +# ifdef __BYTE_ORDER__ +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define _LIBCPP_BIG_ENDIAN +# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# endif // __BYTE_ORDER__ + +# ifdef __FreeBSD__ +# include <sys/endian.h> +# include <osreldate.h> +# if _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# endif // __FreeBSD__ + +# if defined(__NetBSD__) || defined(__OpenBSD__) +# include <sys/endian.h> +# if _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else // _BYTE_ORDER == _LITTLE_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# endif // _BYTE_ORDER == _LITTLE_ENDIAN +# endif // defined(__NetBSD__) || defined(__OpenBSD__) + +# if defined(_WIN32) +# define _LIBCPP_WIN32API # define _LIBCPP_LITTLE_ENDIAN -# else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# endif // _BYTE_ORDER == _LITTLE_ENDIAN -#endif // defined(__NetBSD__) || defined(__OpenBSD__) - -#if defined(_WIN32) -# define _LIBCPP_WIN32API -# define _LIBCPP_LITTLE_ENDIAN -# define _LIBCPP_SHORT_WCHAR 1 +# define _LIBCPP_SHORT_WCHAR 1 // Both MinGW and native MSVC provide a "MSVC"-like environment -# define _LIBCPP_MSVCRT_LIKE +# define _LIBCPP_MSVCRT_LIKE // If mingw not explicitly detected, assume using MS C runtime only if // a MS compatibility version is specified. -# if defined(_MSC_VER) && !defined(__MINGW32__) -# 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 -# endif -# define _LIBCPP_HAS_OPEN_WITH_WCHAR -# if defined(_LIBCPP_MSVCRT) -# define _LIBCPP_HAS_QUICK_EXIT -# endif +# if defined(_MSC_VER) && !defined(__MINGW32__) +# 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 +# endif +# define _LIBCPP_HAS_OPEN_WITH_WCHAR +# endif // defined(_WIN32) -// Some CRT APIs are unavailable to store apps -# if defined(WINAPI_FAMILY) -# include <winapifamily.h> -# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \ - (!defined(WINAPI_PARTITION_SYSTEM) || \ - !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM)) -# define _LIBCPP_WINDOWS_STORE_APP +# ifdef __sun__ +# include <sys/isa_defs.h> +# ifdef _LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# else +# define _LIBCPP_BIG_ENDIAN # endif +# endif // __sun__ + +# if defined(_AIX) && !defined(__64BIT__) +// The size of wchar is 2 byte on 32-bit mode on AIX. +# define _LIBCPP_SHORT_WCHAR 1 # endif -#endif // defined(_WIN32) -#ifdef __sun__ -# include <sys/isa_defs.h> -# ifdef _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN +// Libc++ supports various implementations of std::random_device. +// +// _LIBCPP_USING_DEV_RANDOM +// Read entropy from the given file, by default `/dev/urandom`. +// If a token is provided, it is assumed to be the path to a file +// to read entropy from. This is the default behavior if nothing +// else is specified. This implementation requires storing state +// inside `std::random_device`. +// +// _LIBCPP_USING_ARC4_RANDOM +// Use arc4random(). This allows obtaining random data even when +// using sandboxing mechanisms. On some platforms like Apple, this +// is the recommended source of entropy for user-space programs. +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +// +// _LIBCPP_USING_GETENTROPY +// Use getentropy(). +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +// +// _LIBCPP_USING_FUCHSIA_CPRNG +// Use Fuchsia's zx_cprng_draw() system call, which is specified to +// deliver high-quality entropy and cannot fail. +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +// +// _LIBCPP_USING_NACL_RANDOM +// NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, +// including accesses to the special files under `/dev`. This implementation +// uses the NaCL syscall `nacl_secure_random_init()` to get entropy. +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +// +// _LIBCPP_USING_WIN32_RANDOM +// Use rand_s(), for use on Windows. +// When this option is used, the token passed to `std::random_device`'s +// constructor *must* be "/dev/urandom" -- anything else is an error. +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \ + defined(__DragonFly__) || defined(__sun__) +# define _LIBCPP_USING_ARC4_RANDOM +# elif defined(__wasi__) || defined(__EMSCRIPTEN__) +# define _LIBCPP_USING_GETENTROPY +# elif defined(__Fuchsia__) +# define _LIBCPP_USING_FUCHSIA_CPRNG +# elif defined(__native_client__) +# define _LIBCPP_USING_NACL_RANDOM +# elif defined(_LIBCPP_WIN32API) +# define _LIBCPP_USING_WIN32_RANDOM # else -# define _LIBCPP_BIG_ENDIAN -# endif -#endif // __sun__ - -#if defined(__OpenBSD__) || defined(__CloudABI__) - // Certain architectures provide arc4random(). Prefer using - // arc4random() over /dev/{u,}random to make it possible to obtain - // random data even when using sandboxing mechanisms such as chroots, - // Capsicum, etc. -# define _LIBCPP_USING_ARC4_RANDOM -#elif defined(__Fuchsia__) || defined(__wasi__) -# define _LIBCPP_USING_GETENTROPY -#elif defined(__native_client__) - // NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access, - // including accesses to the special files under /dev. C++11's - // std::random_device is instead exposed through a NaCl syscall. -# define _LIBCPP_USING_NACL_RANDOM -#elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_USING_WIN32_RANDOM -#else -# define _LIBCPP_USING_DEV_RANDOM -#endif - -#if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -# include <endian.h> -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN -# elif __BYTE_ORDER == __BIG_ENDIAN -# define _LIBCPP_BIG_ENDIAN -# else // __BYTE_ORDER == __BIG_ENDIAN -# error unable to determine endian +# define _LIBCPP_USING_DEV_RANDOM # endif -#endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) - -#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) -#else -# define _LIBCPP_NO_CFI -#endif -// If the compiler supports using_if_exists, pretend we have those functions and they'll -// be picked up if the C library provides them. -// -// TODO: Once we drop support for Clang 12, we can assume the compiler supports using_if_exists -// for platforms that don't have a conforming C11 library, so we can drop this whole thing. -#if __has_attribute(using_if_exists) -# define _LIBCPP_HAS_TIMESPEC_GET -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_ALIGNED_ALLOC -#else -#if (defined(__ISO_C_VISIBLE) && (__ISO_C_VISIBLE >= 2011)) || __cplusplus >= 201103L -# if defined(__FreeBSD__) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_QUICK_EXIT -# if __FreeBSD_version >= 1300064 || \ - (__FreeBSD_version >= 1201504 && __FreeBSD_version < 1300000) -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# elif defined(__BIONIC__) -# if __ANDROID_API__ >= 21 -# define _LIBCPP_HAS_QUICK_EXIT -# endif -# if __ANDROID_API__ >= 28 -# define _LIBCPP_HAS_ALIGNED_ALLOC +# if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) +# include <endian.h> +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define _LIBCPP_LITTLE_ENDIAN +# elif __BYTE_ORDER == __BIG_ENDIAN +# define _LIBCPP_BIG_ENDIAN +# else // __BYTE_ORDER == __BIG_ENDIAN +# error unable to determine endian # endif -# if __ANDROID_API__ >= 29 -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# elif defined(__Fuchsia__) || defined(__wasi__) || defined(__NetBSD__) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_TIMESPEC_GET -# elif defined(__OpenBSD__) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_TIMESPEC_GET -# elif defined(__linux__) -# if !defined(_LIBCPP_HAS_MUSL_LIBC) -# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) -# define _LIBCPP_HAS_QUICK_EXIT -# endif -# if _LIBCPP_GLIBC_PREREQ(2, 17) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# else // defined(_LIBCPP_HAS_MUSL_LIBC) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# elif defined(_LIBCPP_MSVCRT) - // Using Microsoft's C Runtime library, not MinGW -# define _LIBCPP_HAS_TIMESPEC_GET -# elif defined(__APPLE__) - // timespec_get and aligned_alloc were introduced in macOS 10.15 and - // aligned releases -# if ((defined(__ENVIRONMENT_MAC_OS_X_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) || \ - (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000) || \ - (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000)) -# define _LIBCPP_HAS_ALIGNED_ALLOC -# define _LIBCPP_HAS_TIMESPEC_GET -# endif -# endif // __APPLE__ -#endif -#endif // __has_attribute(using_if_exists) +# endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) -#ifndef _LIBCPP_CXX03_LANG -# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) -#elif defined(_LIBCPP_COMPILER_CLANG_BASED) -# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) -#else -# error "We don't know a correct way to implement alignof(T) in C++03 outside of Clang" -#endif +# if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) +# else +# define _LIBCPP_NO_CFI +# endif -#define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) +# ifndef _LIBCPP_CXX03_LANG -#if defined(_LIBCPP_COMPILER_CLANG_BASED) +# define _LIBCPP_ALIGNOF(_Tp) alignof(_Tp) +# define _ALIGNAS_TYPE(x) alignas(x) +# define _ALIGNAS(x) alignas(x) +# define _LIBCPP_NORETURN [[noreturn]] +# define _NOEXCEPT noexcept +# define _NOEXCEPT_(x) noexcept(x) +# define _LIBCPP_CONSTEXPR constexpr -#if defined(_LIBCPP_ALTERNATE_STRING_LAYOUT) -# error _LIBCPP_ALTERNATE_STRING_LAYOUT is deprecated, please use _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT instead -#endif -#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \ - (!defined(__arm__) || __ARM_ARCH_7K__ >= 2) -# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT -#endif +# else -#if __has_feature(cxx_alignas) -# define _ALIGNAS_TYPE(x) alignas(x) -# define _ALIGNAS(x) alignas(x) -#else -# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) -# define _ALIGNAS(x) __attribute__((__aligned__(x))) -#endif +# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp) +# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) +# define _ALIGNAS(x) __attribute__((__aligned__(x))) +# define _LIBCPP_NORETURN __attribute__((__noreturn__)) +# define _LIBCPP_HAS_NO_NOEXCEPT +# define nullptr __nullptr +# define _NOEXCEPT throw() +# define _NOEXCEPT_(x) +# define static_assert(...) _Static_assert(__VA_ARGS__) +# define decltype(...) __decltype(__VA_ARGS__) +# define _LIBCPP_CONSTEXPR -#if __cplusplus < 201103L typedef __char16_t char16_t; typedef __char32_t char32_t; -#endif -#if !__has_feature(cxx_exceptions) -# define _LIBCPP_NO_EXCEPTIONS -#endif - -#if !(__has_feature(cxx_strong_enums)) -#define _LIBCPP_HAS_NO_STRONG_ENUMS -#endif - -#if __has_feature(cxx_attributes) -# define _LIBCPP_NORETURN [[noreturn]] -#else -# define _LIBCPP_NORETURN __attribute__ ((noreturn)) -#endif +# endif -#if !(__has_feature(cxx_nullptr)) -# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR) -# define nullptr __nullptr -# else -# define _LIBCPP_HAS_NO_NULLPTR +# if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L +# define _LIBCPP_NO_EXCEPTIONS # endif -#endif -// Objective-C++ features (opt-in) -#if __has_feature(objc_arc) -#define _LIBCPP_HAS_OBJC_ARC -#endif +# define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) -#if __has_feature(objc_arc_weak) -#define _LIBCPP_HAS_OBJC_ARC_WEAK -#endif +# if defined(_LIBCPP_COMPILER_CLANG_BASED) -#if __has_extension(blocks) -# define _LIBCPP_HAS_EXTENSION_BLOCKS -#endif +# if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && (!defined(__arm__) || __ARM_ARCH_7K__ >= 2) +# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +# endif -#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) -# define _LIBCPP_HAS_BLOCKS_RUNTIME -#endif +// Objective-C++ features (opt-in) +# if __has_feature(objc_arc) +# define _LIBCPP_HAS_OBJC_ARC +# endif -#if !(__has_feature(cxx_relaxed_constexpr)) -#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR -#endif +# if __has_feature(objc_arc_weak) +# define _LIBCPP_HAS_OBJC_ARC_WEAK +# endif -#if !(__has_feature(cxx_variable_templates)) -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -#endif +# if __has_extension(blocks) +# define _LIBCPP_HAS_EXTENSION_BLOCKS +# endif -#if !(__has_feature(cxx_noexcept)) -#define _LIBCPP_HAS_NO_NOEXCEPT -#endif +# if defined(_LIBCPP_HAS_EXTENSION_BLOCKS) && defined(__APPLE__) +# define _LIBCPP_HAS_BLOCKS_RUNTIME +# endif -#if !__has_feature(address_sanitizer) -#define _LIBCPP_HAS_NO_ASAN -#endif +# if !__has_feature(address_sanitizer) +# define _LIBCPP_HAS_NO_ASAN +# endif // Allow for build-time disabling of unsigned integer sanitization -#if __has_attribute(no_sanitize) -#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) -#endif +# if __has_attribute(no_sanitize) +# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow"))) +# endif -#if __has_builtin(__builtin_launder) -#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER -#endif +# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) -#if __has_builtin(__builtin_constant_p) -#define _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT_P -#endif +# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ -#if !__is_identifier(__has_unique_object_representations) -#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS -#endif - -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# elif defined(_LIBCPP_COMPILER_GCC) -// Literal operators ""d and ""y are supported starting with LLVM Clang 8 and AppleClang 10.0.1 -#if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 800) || \ - (defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER < 1001) -#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS -#endif +# if !defined(__SANITIZE_ADDRESS__) +# define _LIBCPP_HAS_NO_ASAN +# endif -#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ +# define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__)) -#elif defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ -#define _ALIGNAS(x) __attribute__((__aligned__(x))) -#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) +# endif // _LIBCPP_COMPILER_[CLANG|GCC] -#define _LIBCPP_NORETURN __attribute__((noreturn)) +# if defined(_LIBCPP_OBJECT_FORMAT_COFF) -#if !defined(__EXCEPTIONS) -# define _LIBCPP_NO_EXCEPTIONS -#endif +# ifdef _DLL +# define _LIBCPP_CRT_FUNC __declspec(dllimport) +# else +# define _LIBCPP_CRT_FUNC +# endif -// Determine if GCC supports relaxed constexpr -#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L -#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR -#endif +# if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) || (defined(__MINGW32__) && !defined(_LIBCPP_BUILDING_LIBRARY)) +# define _LIBCPP_DLL_VIS +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_EXPORTED_FROM_ABI +# elif defined(_LIBCPP_BUILDING_LIBRARY) +# define _LIBCPP_DLL_VIS __declspec(dllexport) +# if defined(__MINGW32__) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# else +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS +# endif +# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport) +# else +# define _LIBCPP_DLL_VIS __declspec(dllimport) +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport) +# endif -// GCC 5 supports variable templates -#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -#endif +# define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS +# define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS +# define _LIBCPP_HIDDEN +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# define _LIBCPP_TEMPLATE_VIS +# define _LIBCPP_TEMPLATE_DATA_VIS +# define _LIBCPP_ENUM_VIS -#if !defined(__SANITIZE_ADDRESS__) -#define _LIBCPP_HAS_NO_ASAN -#endif +# else -#if _GNUC_VER >= 700 -#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER -#define _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT_P -#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_VISIBILITY(vis) __attribute__((__visibility__(vis))) +# else +# define _LIBCPP_VISIBILITY(vis) +# endif -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# define _LIBCPP_HIDDEN _LIBCPP_VISIBILITY("hidden") +# define _LIBCPP_FUNC_VIS _LIBCPP_VISIBILITY("default") +# define _LIBCPP_TYPE_VIS _LIBCPP_VISIBILITY("default") +# define _LIBCPP_TEMPLATE_DATA_VIS _LIBCPP_VISIBILITY("default") +# define _LIBCPP_EXPORTED_FROM_ABI _LIBCPP_VISIBILITY("default") +# define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBILITY("default") +# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_VISIBILITY("default") +# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ +// TODO: Make this a proper customization point or remove the option to override it. +# ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS +# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_VISIBILITY("default") +# endif -#elif defined(_LIBCPP_COMPILER_MSVC) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +// The inline should be removed once PR32114 is resolved +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN +# else +# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# endif -#define _LIBCPP_TOSTRING2(x) #x -#define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) -#define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x)) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# if __has_attribute(__type_visibility__) +# define _LIBCPP_TEMPLATE_VIS __attribute__((__type_visibility__("default"))) +# else +# define _LIBCPP_TEMPLATE_VIS __attribute__((__visibility__("default"))) +# endif +# else +# define _LIBCPP_TEMPLATE_VIS +# endif -#if _MSC_VER < 1900 -#error "MSVC versions prior to Visual Studio 2015 are not supported" -#endif +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) +# define _LIBCPP_ENUM_VIS __attribute__((__type_visibility__("default"))) +# else +# define _LIBCPP_ENUM_VIS +# endif -#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES -#define __alignof__ __alignof -#define _LIBCPP_NORETURN __declspec(noreturn) -#define _ALIGNAS(x) __declspec(align(x)) -#define _ALIGNAS_TYPE(x) alignas(x) +# endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) -#define _LIBCPP_WEAK +# if __has_attribute(exclude_from_explicit_instantiation) +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__((__exclude_from_explicit_instantiation__)) +# else +// Try to approximate the effect of exclude_from_explicit_instantiation +// (which is that entities are not assumed to be provided by explicit +// template instantiations in the dylib) by always inlining those entities. +# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE +# endif -#define _LIBCPP_HAS_NO_ASAN +// This macro marks a symbol as being hidden from libc++'s ABI. This is achieved +// on two levels: +// 1. The symbol is given hidden visibility, which ensures that users won't start exporting +// symbols from their dynamic library by means of using the libc++ headers. This ensures +// that those symbols stay private to the dynamic library in which it is defined. +// +// 2. The symbol is given an ABI tag that changes with each version of libc++. This ensures +// that no ODR violation can arise from mixing two TUs compiled with different versions +// of libc++ where we would have changed the definition of a symbol. If the symbols shared +// the same name, the ODR would require that their definitions be token-by-token equivalent, +// which basically prevents us from being able to make any change to any function in our +// headers. Using this ABI tag ensures that the symbol name is "bumped" artificially at +// each release, which lets us change the definition of these symbols at our leisure. +// Note that historically, this has been achieved in various ways, including force-inlining +// all functions or giving internal linkage to all functions. Both these (previous) solutions +// suffer from drawbacks that lead notably to code bloat. +// +// Note that we use _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION to ensure that we don't depend +// on _LIBCPP_HIDE_FROM_ABI methods of classes explicitly instantiated in the dynamic library. +// +// Also note that the _LIBCPP_HIDE_FROM_ABI_VIRTUAL macro should be used on virtual functions +// instead of _LIBCPP_HIDE_FROM_ABI. That macro does not use an ABI tag. Indeed, the mangled +// name of a virtual function is part of its ABI, since some architectures like arm64e can sign +// the virtual function pointer in the vtable based on the mangled name of the function. Since +// we use an ABI tag that changes with each released version, the mangled name of the virtual +// function would change, which is incorrect. Note that it doesn't make much sense to change +// the implementation of a virtual function in an ABI-incompatible way in the first place, +// since that would be an ABI break anyway. Hence, the lack of ABI tag should not be noticeable. +// +// TODO: We provide a escape hatch with _LIBCPP_NO_ABI_TAG for folks who want to avoid increasing +// the length of symbols with an ABI tag. In practice, we should remove the escape hatch and +// use compression mangling instead, see https://github.com/itanium-cxx-abi/cxx-abi/issues/70. +# ifndef _LIBCPP_NO_ABI_TAG +# define _LIBCPP_HIDE_FROM_ABI \ + _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION \ + __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER)))) +# else +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION +# endif +# define _LIBCPP_HIDE_FROM_ABI_VIRTUAL _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION -#define _LIBCPP_ALWAYS_INLINE __forceinline +// This macro provides a HIDE_FROM_ABI equivalent that can be applied to extern +// "C" function, as those lack mangling. +# define _LIBCPP_HIDE_FROM_ABI_C _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION -#define _LIBCPP_HAS_NO_VECTOR_EXTENSION +# ifdef _LIBCPP_BUILDING_LIBRARY +# if _LIBCPP_ABI_VERSION > 1 +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI +# else +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 +# endif +# else +# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI +# endif -#define _LIBCPP_DISABLE_EXTENSION_WARNING +// Just so we can migrate to the new macros gradually. +# define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI -#elif defined(_LIBCPP_COMPILER_IBM) +// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect. +// clang-format off +# define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE { +# define _LIBCPP_END_NAMESPACE_STD }} +# define _VSTD std -#define _ALIGNAS(x) __attribute__((__aligned__(x))) -#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(_LIBCPP_ALIGNOF(x)))) -#define _ATTRIBUTE(x) __attribute__((x)) -#define _LIBCPP_NORETURN __attribute__((noreturn)) +_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD -#define _LIBCPP_HAS_NO_UNICODE_CHARS -#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES +# if _LIBCPP_STD_VER > 14 +# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { +# else +# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { +# endif -#if defined(_AIX) -#define __MULTILOCALE_API -#endif +# define _LIBCPP_END_NAMESPACE_FILESYSTEM _LIBCPP_END_NAMESPACE_STD }} +// clang-format on -#define _LIBCPP_HAS_NO_ASAN +# define _VSTD_FS std::__fs::filesystem -#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +# if __has_attribute(__enable_if__) +# define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, ""))) +# endif -#define _LIBCPP_HAS_NO_VECTOR_EXTENSION +# ifndef __SIZEOF_INT128__ +# define _LIBCPP_HAS_NO_INT128 +# endif -#define _LIBCPP_DISABLE_EXTENSION_WARNING +# ifndef __cpp_consteval +# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR +# else +# define _LIBCPP_CONSTEVAL consteval +# endif -#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] +# if __has_attribute(__malloc__) +# define _LIBCPP_NOALIAS __attribute__((__malloc__)) +# else +# define _LIBCPP_NOALIAS +# endif -#if defined(_LIBCPP_OBJECT_FORMAT_COFF) +# if __has_attribute(__using_if_exists__) +# define _LIBCPP_USING_IF_EXISTS __attribute__((__using_if_exists__)) +# else +# define _LIBCPP_USING_IF_EXISTS +# endif -#ifdef _DLL -# define _LIBCPP_CRT_FUNC __declspec(dllimport) -#else -# define _LIBCPP_CRT_FUNC -#endif +# ifdef _LIBCPP_CXX03_LANG +# define _LIBCPP_DECLARE_STRONG_ENUM(x) \ + struct _LIBCPP_TYPE_VIS x { \ + enum __lx +// clang-format off +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ + __lx __v_; \ + _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \ + _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ + _LIBCPP_INLINE_VISIBILITY operator int() const { return __v_; } \ + }; +// clang-format on + +# else // _LIBCPP_CXX03_LANG +# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x +# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) +# endif // _LIBCPP_CXX03_LANG + +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || defined(__sun__) || \ + defined(__NetBSD__) +# define _LIBCPP_LOCALE__L_EXTENSIONS 1 +# endif -#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_DLL_VIS -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS -# define _LIBCPP_EXPORTED_FROM_ABI -#elif defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_DLL_VIS __declspec(dllexport) -# if defined(__MINGW32__) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# else -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DLL_VIS +# ifdef __FreeBSD__ +# define _DECLARE_C99_LDBL_MATH 1 # endif -# define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllexport) -#else -# define _LIBCPP_DLL_VIS __declspec(dllimport) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DLL_VIS -# define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -# define _LIBCPP_OVERRIDABLE_FUNC_VIS -# define _LIBCPP_EXPORTED_FROM_ABI __declspec(dllimport) -#endif -#define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS -#define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS -#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS -#define _LIBCPP_HIDDEN -#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -#define _LIBCPP_TEMPLATE_VIS -#define _LIBCPP_TEMPLATE_DATA_VIS -#define _LIBCPP_ENUM_VIS +// 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 +# 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 +# elif defined(__MVS__) +# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION +# endif -#endif // defined(_LIBCPP_OBJECT_FORMAT_COFF) +# if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# endif -#ifndef _LIBCPP_HIDDEN -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) -# else -# define _LIBCPP_HIDDEN +// 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 +# elif defined(__ANDROID__) && __ANDROID_API__ < 28 +// Android only provides aligned_alloc when targeting API 28 or higher. +# define _LIBCPP_HAS_NO_C11_ALIGNED_ALLOC # endif -#endif -#ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -// The inline should be removed once PR32114 is resolved -# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN -# else -# define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS +# if defined(__APPLE__) || defined(__FreeBSD__) +# define _LIBCPP_HAS_DEFAULTRUNELOCALE # endif -#endif -#ifndef _LIBCPP_FUNC_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_FUNC_VIS +# if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) +# define _LIBCPP_WCTYPE_IS_MASK # endif -#endif -#ifndef _LIBCPP_TYPE_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_TYPE_VIS +# if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) +# define _LIBCPP_HAS_NO_CHAR8_T # endif -#endif -#ifndef _LIBCPP_TEMPLATE_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# if __has_attribute(__type_visibility__) -# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default"))) +// Deprecation macros. +// +// Deprecations warnings are always enabled, except when users explicitly opt-out +// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS. +# if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) +# if __has_attribute(deprecated) +# define _LIBCPP_DEPRECATED __attribute__((deprecated)) +# define _LIBCPP_DEPRECATED_(m) __attribute__((deprecated(m))) +# elif _LIBCPP_STD_VER > 11 +# define _LIBCPP_DEPRECATED [[deprecated]] +# define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]] # else -# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default"))) +# define _LIBCPP_DEPRECATED +# define _LIBCPP_DEPRECATED_(m) # endif # else -# define _LIBCPP_TEMPLATE_VIS -# endif -#endif - -#ifndef _LIBCPP_TEMPLATE_DATA_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_TEMPLATE_DATA_VIS __attribute__ ((__visibility__("default"))) -# else -# define _LIBCPP_TEMPLATE_DATA_VIS +# define _LIBCPP_DEPRECATED +# define _LIBCPP_DEPRECATED_(m) # endif -#endif -#ifndef _LIBCPP_EXPORTED_FROM_ABI -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXPORTED_FROM_ABI __attribute__((__visibility__("default"))) +# if !defined(_LIBCPP_CXX03_LANG) +# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED # else -# define _LIBCPP_EXPORTED_FROM_ABI +# define _LIBCPP_DEPRECATED_IN_CXX11 # endif -#endif - -#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS -#define _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_FUNC_VIS -#endif -#ifndef _LIBCPP_EXCEPTION_ABI -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) +# if _LIBCPP_STD_VER > 11 +# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED # else -# define _LIBCPP_EXCEPTION_ABI +# define _LIBCPP_DEPRECATED_IN_CXX14 # endif -#endif -#ifndef _LIBCPP_ENUM_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) -# define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default"))) +# if _LIBCPP_STD_VER > 14 +# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED # else -# define _LIBCPP_ENUM_VIS +# define _LIBCPP_DEPRECATED_IN_CXX17 # endif -#endif -#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default"))) +# if _LIBCPP_STD_VER > 17 +# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED # else -# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS +# define _LIBCPP_DEPRECATED_IN_CXX20 # endif -#endif -#ifndef _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -#define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS -#endif - -#if __has_attribute(internal_linkage) -# define _LIBCPP_INTERNAL_LINKAGE __attribute__ ((internal_linkage)) -#else -# define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE -#endif - -#if __has_attribute(exclude_from_explicit_instantiation) -# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION __attribute__ ((__exclude_from_explicit_instantiation__)) +#if _LIBCPP_STD_VER >= 23 +# define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED #else - // Try to approximate the effect of exclude_from_explicit_instantiation - // (which is that entities are not assumed to be provided by explicit - // template instantiations in the dylib) by always inlining those entities. -# define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE +# define _LIBCPP_DEPRECATED_IN_CXX23 #endif -#ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU -# ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT -# define _LIBCPP_HIDE_FROM_ABI_PER_TU 0 +# if !defined(_LIBCPP_HAS_NO_CHAR8_T) +# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED # else -# define _LIBCPP_HIDE_FROM_ABI_PER_TU 1 +# define _LIBCPP_DEPRECATED_WITH_CHAR8_T # endif -#endif -#ifndef _LIBCPP_HIDE_FROM_ABI -# if _LIBCPP_HIDE_FROM_ABI_PER_TU -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE +// Macros to enter and leave a state where deprecation warnings are suppressed. +# if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ + _Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +# define _LIBCPP_SUPPRESS_DEPRECATED_POP _Pragma("GCC diagnostic pop") # else -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH +# define _LIBCPP_SUPPRESS_DEPRECATED_POP # endif -#endif -#ifdef _LIBCPP_BUILDING_LIBRARY -# if _LIBCPP_ABI_VERSION > 1 -# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI +# if _LIBCPP_STD_VER <= 11 +# define _LIBCPP_EXPLICIT_AFTER_CXX11 # else -# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 +# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit # endif -#else -# define _LIBCPP_HIDE_FROM_ABI_AFTER_V1 _LIBCPP_HIDE_FROM_ABI -#endif - -// Just so we can migrate to the new macros gradually. -#define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI - -// Inline namespaces are available in Clang/GCC/MSVC regardless of C++ dialect. -#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_ABI_NAMESPACE { -#define _LIBCPP_END_NAMESPACE_STD } } -#define _VSTD std::_LIBCPP_ABI_NAMESPACE -_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 17 -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { -#else -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { -#endif - -#define _LIBCPP_END_NAMESPACE_FILESYSTEM \ - _LIBCPP_END_NAMESPACE_STD } } - -#define _VSTD_FS _VSTD::__fs::filesystem - -#if __has_attribute(__enable_if__) -# define _LIBCPP_PREFERRED_OVERLOAD __attribute__ ((__enable_if__(true, ""))) -#endif - -#ifndef _LIBCPP_HAS_NO_NOEXCEPT -# define _NOEXCEPT noexcept -# define _NOEXCEPT_(x) noexcept(x) -#else -# define _NOEXCEPT throw() -# define _NOEXCEPT_(x) -#endif - -#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS -typedef unsigned short char16_t; -typedef unsigned int char32_t; -#endif // _LIBCPP_HAS_NO_UNICODE_CHARS - -#ifndef __SIZEOF_INT128__ -#define _LIBCPP_HAS_NO_INT128 -#endif - -#ifdef _LIBCPP_CXX03_LANG -# define static_assert(...) _Static_assert(__VA_ARGS__) -# define decltype(...) __decltype(__VA_ARGS__) -#endif // _LIBCPP_CXX03_LANG - -#ifdef _LIBCPP_CXX03_LANG -# define _LIBCPP_CONSTEXPR -#else -# define _LIBCPP_CONSTEXPR constexpr -#endif - -#ifndef __cpp_consteval -# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR -#else -# define _LIBCPP_CONSTEVAL consteval -#endif - -#if !defined(__cpp_concepts) || __cpp_concepts < 201907L -#define _LIBCPP_HAS_NO_CONCEPTS -#endif - -#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_HAS_NO_CONCEPTS) -#define _LIBCPP_HAS_NO_RANGES -#endif -#ifdef _LIBCPP_CXX03_LANG -# define _LIBCPP_DEFAULT {} -#else -# define _LIBCPP_DEFAULT = default; -#endif - -#ifdef _LIBCPP_CXX03_LANG -# define _LIBCPP_EQUAL_DELETE -#else -# define _LIBCPP_EQUAL_DELETE = delete -#endif - -#ifdef __GNUC__ -# define _LIBCPP_NOALIAS __attribute__((__malloc__)) -#else -# define _LIBCPP_NOALIAS -#endif - -#if __has_attribute(using_if_exists) -# define _LIBCPP_USING_IF_EXISTS __attribute__((using_if_exists)) -#else -# define _LIBCPP_USING_IF_EXISTS -#endif - -#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS -# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx -# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \ - __lx __v_; \ - _LIBCPP_INLINE_VISIBILITY x(__lx __v) : __v_(__v) {} \ - _LIBCPP_INLINE_VISIBILITY explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \ - _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} \ - }; -#else // _LIBCPP_HAS_NO_STRONG_ENUMS -# define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_ENUM_VIS x -# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) -#endif // _LIBCPP_HAS_NO_STRONG_ENUMS - -// _LIBCPP_DEBUG potential values: -// - undefined: No assertions. This is the default. -// - 0: Basic assertions -// - 1: Basic assertions + iterator validity checks. -#if !defined(_LIBCPP_DEBUG) -# define _LIBCPP_DEBUG_LEVEL 0 -#elif _LIBCPP_DEBUG == 0 -# define _LIBCPP_DEBUG_LEVEL 1 -#elif _LIBCPP_DEBUG == 1 -# define _LIBCPP_DEBUG_LEVEL 2 -#else -# error Supported values for _LIBCPP_DEBUG are 0 and 1 -#endif - -// Libc++ allows disabling extern template instantiation declarations by -// means of users defining _LIBCPP_DISABLE_EXTERN_TEMPLATE. -// -// Furthermore, when the Debug mode is enabled, we disable extern declarations -// when building user code because we don't want to use the functions compiled -// in the library, which might not have had the debug mode enabled when built. -// However, some extern declarations need to be used, because code correctness -// depends on it (several instances in <locale>). Those special declarations -// are declared with _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE, which is enabled -// even when the debug mode is enabled. -#if defined(_LIBCPP_DISABLE_EXTERN_TEMPLATE) -# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */ -# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) /* nothing */ -#elif _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_BUILDING_LIBRARY) -# define _LIBCPP_EXTERN_TEMPLATE(...) /* nothing */ -# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__; -#else -# define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__; -# define _LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(...) extern template __VA_ARGS__; -#endif - -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \ - defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__) -#define _LIBCPP_LOCALE__L_EXTENSIONS 1 -#endif - -#ifdef __FreeBSD__ -#define _DECLARE_C99_LDBL_MATH 1 -#endif - -// 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 -#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 -#elif defined(__MVS__) -# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION -#endif - -#if defined(__APPLE__) -# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ - defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) -# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# if _LIBCPP_STD_VER > 11 +# define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr +# else +# define _LIBCPP_CONSTEXPR_SINCE_CXX14 # endif -#endif // defined(__APPLE__) - -#if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) || \ - (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) -# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION -#endif - -#if defined(__APPLE__) || defined(__FreeBSD__) -#define _LIBCPP_HAS_DEFAULTRUNELOCALE -#endif - -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) -#define _LIBCPP_WCTYPE_IS_MASK -#endif -#if _LIBCPP_STD_VER <= 17 || !defined(__cpp_char8_t) -#define _LIBCPP_HAS_NO_CHAR8_T -#endif - -// Deprecation macros. -// -// Deprecations warnings are always enabled, except when users explicitly opt-out -// by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS. -#if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) -# if __has_attribute(deprecated) -# define _LIBCPP_DEPRECATED __attribute__ ((deprecated)) -# elif _LIBCPP_STD_VER > 11 -# define _LIBCPP_DEPRECATED [[deprecated]] +# if _LIBCPP_STD_VER > 14 +# define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr # else -# define _LIBCPP_DEPRECATED +# define _LIBCPP_CONSTEXPR_SINCE_CXX17 # endif -#else -# define _LIBCPP_DEPRECATED -#endif - -#if !defined(_LIBCPP_CXX03_LANG) -# define _LIBCPP_DEPRECATED_IN_CXX11 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX11 -#endif - -#if _LIBCPP_STD_VER >= 14 -# define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX14 -#endif - -#if _LIBCPP_STD_VER >= 17 -# define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX17 -#endif - -#if _LIBCPP_STD_VER > 17 -# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_IN_CXX20 -#endif - -#if !defined(_LIBCPP_HAS_NO_CHAR8_T) -# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED -#else -# define _LIBCPP_DEPRECATED_WITH_CHAR8_T -#endif - -// Macros to enter and leave a state where deprecation warnings are suppressed. -#if defined(_LIBCPP_COMPILER_CLANG_BASED) || defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -# define _LIBCPP_SUPPRESS_DEPRECATED_POP \ - _Pragma("GCC diagnostic pop") -#else -# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH -# define _LIBCPP_SUPPRESS_DEPRECATED_POP -#endif - -#if _LIBCPP_STD_VER <= 11 -# define _LIBCPP_EXPLICIT_AFTER_CXX11 -#else -# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit -#endif - -#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -# define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr -#else -# define _LIBCPP_CONSTEXPR_AFTER_CXX11 -#endif -#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -# define _LIBCPP_CONSTEXPR_AFTER_CXX14 constexpr -#else -# define _LIBCPP_CONSTEXPR_AFTER_CXX14 -#endif +# if _LIBCPP_STD_VER > 17 +# define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr +# else +# define _LIBCPP_CONSTEXPR_SINCE_CXX20 +# endif -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -# define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr -#else -# define _LIBCPP_CONSTEXPR_AFTER_CXX17 -#endif +# if _LIBCPP_STD_VER > 20 +# define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr +# else +# define _LIBCPP_CONSTEXPR_SINCE_CXX23 +# endif -// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other -// NODISCARD macros to the correct attribute. -#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_NODISCARD_ATTRIBUTE [[nodiscard]] -#elif defined(_LIBCPP_COMPILER_CLANG_BASED) && !defined(_LIBCPP_CXX03_LANG) -# define _LIBCPP_NODISCARD_ATTRIBUTE [[clang::warn_unused_result]] -#else +# if __has_cpp_attribute(nodiscard) +# define _LIBCPP_NODISCARD [[nodiscard]] +# else // We can't use GCC's [[gnu::warn_unused_result]] and // __attribute__((warn_unused_result)), because GCC does not silence them via // (void) cast. -# define _LIBCPP_NODISCARD_ATTRIBUTE -#endif +# define _LIBCPP_NODISCARD +# endif // _LIBCPP_NODISCARD_EXT may be used to apply [[nodiscard]] to entities not // specified as such as an extension. -#if defined(_LIBCPP_ENABLE_NODISCARD) && !defined(_LIBCPP_DISABLE_NODISCARD_EXT) -# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD_ATTRIBUTE -#else -# define _LIBCPP_NODISCARD_EXT -#endif - -#if !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17) && \ - (_LIBCPP_STD_VER > 17 || defined(_LIBCPP_ENABLE_NODISCARD)) -# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD_ATTRIBUTE -#else -# define _LIBCPP_NODISCARD_AFTER_CXX17 -#endif - -#if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L) -# define _LIBCPP_INLINE_VAR inline -#else -# define _LIBCPP_INLINE_VAR -#endif +# if !defined(_LIBCPP_DISABLE_NODISCARD_EXT) +# define _LIBCPP_NODISCARD_EXT _LIBCPP_NODISCARD +# else +# define _LIBCPP_NODISCARD_EXT +# endif -#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) -# define _LIBCPP_CONSTEXPR_IF_NODEBUG -#else -# define _LIBCPP_CONSTEXPR_IF_NODEBUG constexpr -#endif +# if _LIBCPP_STD_VER > 17 || !defined(_LIBCPP_DISABLE_NODISCARD_EXT) +# define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD +# else +# define _LIBCPP_NODISCARD_AFTER_CXX17 +# endif -#if __has_attribute(no_destroy) -# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) -#else -# define _LIBCPP_NO_DESTROY -#endif +# if __has_attribute(__no_destroy__) +# define _LIBCPP_NO_DESTROY __attribute__((__no_destroy__)) +# else +# define _LIBCPP_NO_DESTROY +# endif -#ifndef _LIBCPP_HAS_NO_ASAN -extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( - const void *, const void *, const void *, const void *); -#endif +# ifndef _LIBCPP_HAS_NO_ASAN + extern "C" _LIBCPP_FUNC_VIS void + __sanitizer_annotate_contiguous_container(const void*, const void*, const void*, const void*); +# endif // Try to find out if RTTI is disabled. -#if defined(_LIBCPP_COMPILER_CLANG_BASED) && !__has_feature(cxx_rtti) -# define _LIBCPP_NO_RTTI -#elif defined(__GNUC__) && !defined(__GXX_RTTI) -# define _LIBCPP_NO_RTTI -#elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI) -# define _LIBCPP_NO_RTTI -#endif +# if !defined(__cpp_rtti) || __cpp_rtti < 199711L +# define _LIBCPP_HAS_NO_RTTI +# endif -#ifndef _LIBCPP_WEAK -#define _LIBCPP_WEAK __attribute__((__weak__)) -#endif +# ifndef _LIBCPP_WEAK +# define _LIBCPP_WEAK __attribute__((__weak__)) +# endif // Thread API -#if !defined(_LIBCPP_HAS_NO_THREADS) && \ - !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ - !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ - !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -# if defined(__FreeBSD__) || \ - defined(__wasi__) || \ - defined(__NetBSD__) || \ - defined(__OpenBSD__) || \ - defined(__NuttX__) || \ - defined(__linux__) || \ - defined(__GNU__) || \ - defined(__APPLE__) || \ - defined(__CloudABI__) || \ - defined(__sun__) || \ - defined(__MVS__) || \ - defined(_AIX) || \ - (defined(__MINGW32__) && __has_include(<pthread.h>)) -# define _LIBCPP_HAS_THREAD_API_PTHREAD -# elif defined(__Fuchsia__) - // TODO(44575): Switch to C11 thread API when possible. -# define _LIBCPP_HAS_THREAD_API_PTHREAD -# elif defined(_LIBCPP_WIN32API) -# define _LIBCPP_HAS_THREAD_API_WIN32 -# else -# error "No thread API" -# endif // _LIBCPP_HAS_THREAD_API -#endif // _LIBCPP_HAS_NO_THREADS - -#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -#if defined(__ANDROID__) && __ANDROID_API__ >= 30 -#define _LIBCPP_HAS_COND_CLOCKWAIT -#elif defined(_LIBCPP_GLIBC_PREREQ) -#if _LIBCPP_GLIBC_PREREQ(2, 30) -#define _LIBCPP_HAS_COND_CLOCKWAIT -#endif -#endif -#endif +// clang-format off +# if !defined(_LIBCPP_HAS_NO_THREADS) && \ + !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \ + !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \ + !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) + +# if defined(__FreeBSD__) || \ + defined(__wasi__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NuttX__) || \ + defined(__linux__) || \ + defined(__GNU__) || \ + defined(__APPLE__) || \ + defined(__sun__) || \ + defined(__MVS__) || \ + defined(_AIX) || \ + defined(__EMSCRIPTEN__) +// clang-format on +# define _LIBCPP_HAS_THREAD_API_PTHREAD +# elif defined(__Fuchsia__) +// TODO(44575): Switch to C11 thread API when possible. +# define _LIBCPP_HAS_THREAD_API_PTHREAD +# elif defined(_LIBCPP_WIN32API) +# define _LIBCPP_HAS_THREAD_API_WIN32 +# else +# error "No thread API" +# endif // _LIBCPP_HAS_THREAD_API +# endif // _LIBCPP_HAS_NO_THREADS + +# if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +# if defined(__ANDROID__) && __ANDROID_API__ >= 30 +# define _LIBCPP_HAS_COND_CLOCKWAIT +# elif defined(_LIBCPP_GLIBC_PREREQ) +# if _LIBCPP_GLIBC_PREREQ(2, 30) +# define _LIBCPP_HAS_COND_CLOCKWAIT +# endif +# endif +# endif -#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) -#error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ +# if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +# error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ _LIBCPP_HAS_NO_THREADS is not defined. -#endif +# endif -#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) -#error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ +# if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) +# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \ _LIBCPP_HAS_NO_THREADS is defined. -#endif +# endif -#if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) -#error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ +# if defined(_LIBCPP_HAS_NO_MONOTONIC_CLOCK) && !defined(_LIBCPP_HAS_NO_THREADS) +# error _LIBCPP_HAS_NO_MONOTONIC_CLOCK may only be defined when \ _LIBCPP_HAS_NO_THREADS is defined. -#endif +# endif -#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) -#define __STDCPP_THREADS__ 1 -#endif +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) +# define __STDCPP_THREADS__ 1 +# endif // The glibc and Bionic implementation of pthreads implements // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32 @@ -1199,11 +982,13 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( // // TODO(EricWF): Enable this optimization on Bionic after speaking to their // respective stakeholders. -#if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \ - || (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) \ - || defined(_LIBCPP_HAS_THREAD_API_WIN32) -# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION -#endif +// clang-format off +# if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) || \ + (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || \ + defined(_LIBCPP_HAS_THREAD_API_WIN32) +// clang-format on +# define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION +# endif // Destroying a condvar is a nop on Windows. // @@ -1213,260 +998,274 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container( // // 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 -#endif - -// Systems that use capability-based security (FreeBSD with Capsicum, -// Nuxi CloudABI) may only provide local filesystem access (using *at()). -// Functions like open(), rename(), unlink() and stat() should not be -// used, as they attempt to access the global filesystem namespace. -#ifdef __CloudABI__ -#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE -#endif - -// CloudABI is intended for running networked services. Processes do not -// have standard input and output channels. -#ifdef __CloudABI__ -#define _LIBCPP_HAS_NO_STDIN -#define _LIBCPP_HAS_NO_STDOUT -#endif +# if (defined(_LIBCPP_HAS_THREAD_API_C11) && defined(__Fuchsia__)) || defined(_LIBCPP_HAS_THREAD_API_WIN32) +# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION +# endif // Some systems do not provide gets() in their C library, for security reasons. -#if defined(_LIBCPP_MSVCRT) || \ - (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || \ - defined(__OpenBSD__) -# define _LIBCPP_C_HAS_NO_GETS -#endif - -#if defined(__BIONIC__) || defined(__CloudABI__) || defined(__NuttX__) || \ - defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) || \ - defined(__MVS__) || defined(__OpenBSD__) -#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE -#endif - -// Thread-unsafe functions such as strtok() and localtime() -// are not available. -#ifdef __CloudABI__ -#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS -#endif +# if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || defined(__OpenBSD__) +# define _LIBCPP_C_HAS_NO_GETS +# endif -#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) -# define _LIBCPP_HAS_C_ATOMIC_IMP -#elif defined(_LIBCPP_COMPILER_GCC) -# define _LIBCPP_HAS_GCC_ATOMIC_IMP -#endif +# if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) || \ + defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__) +# define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE +# endif -#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \ - !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \ - !defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)) \ - || defined(_LIBCPP_HAS_NO_THREADS) -# define _LIBCPP_HAS_NO_ATOMIC_HEADER -#else -# ifndef _LIBCPP_ATOMIC_FLAG_TYPE -# define _LIBCPP_ATOMIC_FLAG_TYPE bool +# if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic) +# define _LIBCPP_HAS_C_ATOMIC_IMP +# elif defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_HAS_GCC_ATOMIC_IMP # endif -# ifdef _LIBCPP_FREESTANDING -# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS + +# 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 +# else +# ifndef _LIBCPP_ATOMIC_FLAG_TYPE +# define _LIBCPP_ATOMIC_FLAG_TYPE bool +# endif +# ifdef _LIBCPP_FREESTANDING +# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS +# endif # endif -#endif -#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK -#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK -#endif +# ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +# define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK +# endif -#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) -# if defined(__clang__) && __has_attribute(acquire_capability) +# 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. -# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) -# define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +// 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 # endif -#endif - -#ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS -# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) -#else -# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) -#endif - -#if __has_attribute(require_constant_initialization) -# define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__)) -#else -# define _LIBCPP_SAFE_STATIC -#endif -#if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700 -#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF -#endif +# ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS +# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) +# else +# define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) +# endif -#if !__has_builtin(__builtin_is_constant_evaluated) && _GNUC_VER < 900 -#define _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED -#endif +# if _LIBCPP_STD_VER > 17 +# define _LIBCPP_CONSTINIT constinit +# elif __has_attribute(__require_constant_initialization__) +# define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) +# else +# define _LIBCPP_CONSTINIT +# endif -#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) -# define _LIBCPP_DIAGNOSE_WARNING(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "warning"))) -# define _LIBCPP_DIAGNOSE_ERROR(...) \ - __attribute__((diagnose_if(__VA_ARGS__, "error"))) -#else -# define _LIBCPP_DIAGNOSE_WARNING(...) -# define _LIBCPP_DIAGNOSE_ERROR(...) -#endif +# if __has_attribute(__diagnose_if__) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS) +# define _LIBCPP_DIAGNOSE_WARNING(...) __attribute__((__diagnose_if__(__VA_ARGS__, "warning"))) +# else +# define _LIBCPP_DIAGNOSE_WARNING(...) +# endif // Use a function like macro to imply that it must be followed by a semicolon -#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) -# define _LIBCPP_FALLTHROUGH() [[fallthrough]] -#elif __has_cpp_attribute(clang::fallthrough) -# define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]] -#elif __has_attribute(fallthrough) || _GNUC_VER >= 700 -# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) -#else -# define _LIBCPP_FALLTHROUGH() ((void)0) -#endif - -#if __has_attribute(__nodebug__) -#define _LIBCPP_NODEBUG __attribute__((__nodebug__)) -#else -#define _LIBCPP_NODEBUG -#endif - -#if __has_attribute(__nodebug__) && (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 900) -# define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug)) -#else -# define _LIBCPP_NODEBUG_TYPE -#endif - -#if __has_attribute(__standalone_debug__) -#define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__)) -#else -#define _LIBCPP_STANDALONE_DEBUG -#endif - -#if __has_attribute(__preferred_name__) -#define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x))) -#else -#define _LIBCPP_PREFERRED_NAME(x) -#endif - -#if defined(_LIBCPP_ABI_MICROSOFT) && \ - (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases)) -# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) -#else -# define _LIBCPP_DECLSPEC_EMPTY_BASES -#endif +# if __has_cpp_attribute(fallthrough) +# define _LIBCPP_FALLTHROUGH() [[fallthrough]] +# elif __has_attribute(__fallthrough__) +# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__)) +# else +# define _LIBCPP_FALLTHROUGH() ((void)0) +# endif -#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) -#define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS -#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE -#define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS -#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES - -#if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) -#define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS -#define _LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS -#define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS -#define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR -#define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS -#endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES - -#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611 -#define _LIBCPP_HAS_NO_DEDUCTION_GUIDES -#endif +# if __has_cpp_attribute(_Clang::__lifetimebound__) +# define _LIBCPP_LIFETIMEBOUND [[_Clang::__lifetimebound__]] +# else +# define _LIBCPP_LIFETIMEBOUND +# endif -#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001) -#define _LIBCPP_HAS_NO_IS_AGGREGATE -#endif +# if __has_attribute(__nodebug__) +# define _LIBCPP_NODEBUG __attribute__((__nodebug__)) +# else +# define _LIBCPP_NODEBUG +# endif -#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L -#define _LIBCPP_HAS_NO_COROUTINES -#endif +# if __has_attribute(__standalone_debug__) +# define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__)) +# else +# define _LIBCPP_STANDALONE_DEBUG +# endif -#if !defined(__cpp_impl_three_way_comparison) || __cpp_impl_three_way_comparison < 201907L -#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR -#endif +# if __has_attribute(__preferred_name__) +# define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x))) +# else +# define _LIBCPP_PREFERRED_NAME(x) +# endif -#if defined(_LIBCPP_COMPILER_IBM) -#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO -#endif +// We often repeat things just for handling wide characters in the library. +// When wide characters are disabled, it can be useful to have a quick way of +// disabling it without having to resort to #if-#endif, which has a larger +// impact on readability. +# if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) +# define _LIBCPP_IF_WIDE_CHARACTERS(...) +# else +# define _LIBCPP_IF_WIDE_CHARACTERS(...) __VA_ARGS__ +# endif -#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) -# define _LIBCPP_PUSH_MACROS -# define _LIBCPP_POP_MACROS -#else - // Don't warn about macro conflicts when we can restore them at the - // end of the header. -# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS -# endif -# if defined(_LIBCPP_COMPILER_MSVC) -# define _LIBCPP_PUSH_MACROS \ - __pragma(push_macro("min")) \ - __pragma(push_macro("max")) -# define _LIBCPP_POP_MACROS \ - __pragma(pop_macro("min")) \ - __pragma(pop_macro("max")) +# if defined(_LIBCPP_ABI_MICROSOFT) && __has_declspec_attribute(empty_bases) +# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases) # else -# define _LIBCPP_PUSH_MACROS \ - _Pragma("push_macro(\"min\")") \ - _Pragma("push_macro(\"max\")") -# define _LIBCPP_POP_MACROS \ - _Pragma("pop_macro(\"min\")") \ - _Pragma("pop_macro(\"max\")") +# define _LIBCPP_DECLSPEC_EMPTY_BASES # endif -#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO) -#ifndef _LIBCPP_NO_AUTO_LINK -# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) -# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) -# pragma comment(lib, "c++.lib") -# else -# pragma comment(lib, "libc++.lib") -# endif -# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) -#endif // _LIBCPP_NO_AUTO_LINK +# if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES) +# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR +# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS +# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE +# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS +# define _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION +# endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES + +# if defined(_LIBCPP_ENABLE_CXX20_REMOVED_FEATURES) +# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS +# define _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_VOID_SPECIALIZATION +# define _LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS +# define _LIBCPP_ENABLE_CXX20_REMOVED_NEGATORS +# define _LIBCPP_ENABLE_CXX20_REMOVED_RAW_STORAGE_ITERATOR +# define _LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS +# endif // _LIBCPP_ENABLE_CXX20_REMOVED_FEATURES + +# define _LIBCPP_PUSH_MACROS _Pragma("push_macro(\"min\")") _Pragma("push_macro(\"max\")") +# define _LIBCPP_POP_MACROS _Pragma("pop_macro(\"min\")") _Pragma("pop_macro(\"max\")") + +# ifndef _LIBCPP_NO_AUTO_LINK +# if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# pragma comment(lib, "c++.lib") +# else +# pragma comment(lib, "libc++.lib") +# endif +# endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY) +# endif // _LIBCPP_NO_AUTO_LINK // Configures the fopen close-on-exec mode character, if any. This string will // be appended to any mode string used by fstream for fopen/fdopen. // // Not all platforms support this, but it helps avoid fd-leaks on platforms that // do. -#if defined(__BIONIC__) -# define _LIBCPP_FOPEN_CLOEXEC_MODE "e" -#else -# define _LIBCPP_FOPEN_CLOEXEC_MODE -#endif - -#ifdef _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT_P -#define _LIBCPP_BUILTIN_CONSTANT_P(x) __builtin_constant_p(x) -#else -#define _LIBCPP_BUILTIN_CONSTANT_P(x) false -#endif +# if defined(__BIONIC__) +# define _LIBCPP_FOPEN_CLOEXEC_MODE "e" +# else +# define _LIBCPP_FOPEN_CLOEXEC_MODE +# endif // Support for _FILE_OFFSET_BITS=64 landed gradually in Android, so the full set // of functions used in cstdio may not be available for low API levels when // using 64-bit file offsets on LP32. -#if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24 -#define _LIBCPP_HAS_NO_FGETPOS_FSETPOS -#endif +# if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24 +# define _LIBCPP_HAS_NO_FGETPOS_FSETPOS +# endif -#if __has_attribute(init_priority) -# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101))) -#else -# define _LIBCPP_INIT_PRIORITY_MAX -#endif +# if __has_attribute(__init_priority__) +# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((__init_priority__(100))) +# else +# define _LIBCPP_INIT_PRIORITY_MAX +# endif + +# if __has_attribute(__format__) +// The attribute uses 1-based indices for ordinary and static member functions. +// The attribute uses 2-based indices for non-static member functions. +# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) \ + __attribute__((__format__(archetype, format_string_index, first_format_arg_index))) +# else +# define _LIBCPP_ATTRIBUTE_FORMAT(archetype, format_string_index, first_format_arg_index) /* nothing */ +# endif + +# if __has_cpp_attribute(msvc::no_unique_address) +// MSVC implements [[no_unique_address]] as a silent no-op currently. +// (If/when MSVC breaks its C++ ABI, it will be changed to work as intended.) +// However, MSVC implements [[msvc::no_unique_address]] which does what +// [[no_unique_address]] is supposed to do, in general. + +// Clang-cl does not yet (14.0) implement either [[no_unique_address]] or +// [[msvc::no_unique_address]] though. If/when it does implement +// [[msvc::no_unique_address]], this should be preferred though. +# define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] +# elif __has_cpp_attribute(no_unique_address) +# define _LIBCPP_NO_UNIQUE_ADDRESS [[no_unique_address]] +# else +# define _LIBCPP_NO_UNIQUE_ADDRESS /* nothing */ +// Note that this can be replaced by #error as soon as clang-cl +// implements msvc::no_unique_address, since there should be no C++20 +// compiler that doesn't support one of the two attributes at that point. +// We generally don't want to use this macro outside of C++20-only code, +// because using it conditionally in one language version only would make +// the ABI inconsistent. +# endif + +# ifdef _LIBCPP_COMPILER_CLANG_BASED +# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") +# define _LIBCPP_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(clang diagnostic ignored str)) +# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) +# elif defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") +# define _LIBCPP_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) +# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) _Pragma(_LIBCPP_TOSTRING(GCC diagnostic ignored str)) +# else +# define _LIBCPP_DIAGNOSTIC_PUSH +# define _LIBCPP_DIAGNOSTIC_POP +# define _LIBCPP_CLANG_DIAGNOSTIC_IGNORED(str) +# define _LIBCPP_GCC_DIAGNOSTIC_IGNORED(str) +# endif -#if defined(__GNUC__) || defined(__clang__) -#define _LIBCPP_FORMAT_PRINTF(a, b) \ - __attribute__((__format__(__printf__, a, b))) +# if defined(_AIX) && !defined(_LIBCPP_COMPILER_GCC) +# define _LIBCPP_PACKED_BYTE_FOR_AIX _Pragma("pack(1)") +# define _LIBCPP_PACKED_BYTE_FOR_AIX_END _Pragma("pack(pop)") +# else +# define _LIBCPP_PACKED_BYTE_FOR_AIX /* empty */ +# define _LIBCPP_PACKED_BYTE_FOR_AIX_END /* empty */ +# endif + +# if __has_attribute(__packed__) +# define _LIBCPP_PACKED __attribute__((__packed__)) +# else +# define _LIBCPP_PACKED +# endif + +// c8rtomb() and mbrtoc8() were added in C++20 and C23. Support for these +// 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 +// to depend on here, so any declarations present when __cpp_char8_t is not +// defined are ignored. +# if defined(_LIBCPP_GLIBC_PREREQ) +# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t) +# undef _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 +# endif +# endif + +// There are a handful of public standard library types that are intended to +// support CTAD but don't need any explicit deduction guides to do so. This +// macro is used to mark them as such, which suppresses the +// '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code +// with these classes. +#if _LIBCPP_STD_VER >= 17 +# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \ + template <class ..._Tag> \ + _ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...> #else -#define _LIBCPP_FORMAT_PRINTF(a, b) +# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") #endif +// TODO(varconst): currently, there are bugs in Clang's intrinsics when handling Objective-C++ `id`, so don't use +// compiler intrinsics in the Objective-C++ mode. +# ifdef __OBJC__ +# define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS +# endif + #endif // __cplusplus -#endif // _LIBCPP_CONFIG +#endif // _LIBCPP___CONFIG diff --git a/gnu/llvm/libcxx/include/__function_like.h b/gnu/llvm/libcxx/include/__function_like.h deleted file mode 100644 index 8a3597bacdc..00000000000 --- a/gnu/llvm/libcxx/include/__function_like.h +++ /dev/null @@ -1,56 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___ITERATOR_FUNCTION_LIKE_H -#define _LIBCPP___ITERATOR_FUNCTION_LIKE_H - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if !defined(_LIBCPP_HAS_NO_RANGES) - -namespace ranges { -// Per [range.iter.ops.general] and [algorithms.requirements], functions in namespace std::ranges -// can't be found by ADL and inhibit ADL when found by unqualified lookup. The easiest way to -// facilitate this is to use function objects. -// -// Since these are still standard library functions, we use `__function_like` to eliminate most of -// the properties that function objects get by default (e.g. semiregularity, addressability), to -// limit the surface area of the unintended public interface, so as to curb the effect of Hyrum's -// law. -struct __function_like { - __function_like() = delete; - __function_like(__function_like const&) = delete; - __function_like& operator=(__function_like const&) = delete; - - void operator&() const = delete; - - struct __tag { }; - -protected: - constexpr explicit __function_like(__tag) noexcept {} - ~__function_like() = default; -}; -} // namespace ranges - -#endif // !defined(_LIBCPP_HAS_NO_RANGES) - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___ITERATOR_FUNCTION_LIKE_H diff --git a/gnu/llvm/libcxx/include/__functional_base b/gnu/llvm/libcxx/include/__functional_base deleted file mode 100644 index ca761c409b6..00000000000 --- a/gnu/llvm/libcxx/include/__functional_base +++ /dev/null @@ -1,652 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_FUNCTIONAL_BASE -#define _LIBCPP_FUNCTIONAL_BASE - -#include <__config> -#include <type_traits> -#include <typeinfo> -#include <exception> -#include <new> -#include <utility> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Arg1, class _Arg2, class _Result> -struct _LIBCPP_TEMPLATE_VIS binary_function -{ - typedef _Arg1 first_argument_type; - typedef _Arg2 second_argument_type; - typedef _Result result_type; -}; - -template <class _Tp> -struct __has_result_type -{ -private: - struct __two {char __lx; char __lxx;}; - template <class _Up> static __two __test(...); - template <class _Up> static char __test(typename _Up::result_type* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; - -#if _LIBCPP_STD_VER > 11 -template <class _Tp = void> -#else -template <class _Tp> -#endif -struct _LIBCPP_TEMPLATE_VIS less : binary_function<_Tp, _Tp, bool> -{ - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - bool operator()(const _Tp& __x, const _Tp& __y) const - {return __x < __y;} -}; - -#if _LIBCPP_STD_VER > 11 -template <> -struct _LIBCPP_TEMPLATE_VIS less<void> -{ - template <class _T1, class _T2> - _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY - auto operator()(_T1&& __t, _T2&& __u) const - _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u))) - -> decltype (_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)) - { return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); } - typedef void is_transparent; -}; -#endif - -// __weak_result_type - -template <class _Tp> -struct __derives_from_unary_function -{ -private: - struct __two {char __lx; char __lxx;}; - static __two __test(...); - template <class _Ap, class _Rp> - static unary_function<_Ap, _Rp> - __test(const volatile unary_function<_Ap, _Rp>*); -public: - static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; - typedef decltype(__test((_Tp*)0)) type; -}; - -template <class _Tp> -struct __derives_from_binary_function -{ -private: - struct __two {char __lx; char __lxx;}; - static __two __test(...); - template <class _A1, class _A2, class _Rp> - static binary_function<_A1, _A2, _Rp> - __test(const volatile binary_function<_A1, _A2, _Rp>*); -public: - static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; - typedef decltype(__test((_Tp*)0)) type; -}; - -template <class _Tp, bool = __derives_from_unary_function<_Tp>::value> -struct __maybe_derive_from_unary_function // bool is true - : public __derives_from_unary_function<_Tp>::type -{ -}; - -template <class _Tp> -struct __maybe_derive_from_unary_function<_Tp, false> -{ -}; - -template <class _Tp, bool = __derives_from_binary_function<_Tp>::value> -struct __maybe_derive_from_binary_function // bool is true - : public __derives_from_binary_function<_Tp>::type -{ -}; - -template <class _Tp> -struct __maybe_derive_from_binary_function<_Tp, false> -{ -}; - -template <class _Tp, bool = __has_result_type<_Tp>::value> -struct __weak_result_type_imp // bool is true - : public __maybe_derive_from_unary_function<_Tp>, - public __maybe_derive_from_binary_function<_Tp> -{ - typedef _LIBCPP_NODEBUG_TYPE typename _Tp::result_type result_type; -}; - -template <class _Tp> -struct __weak_result_type_imp<_Tp, false> - : public __maybe_derive_from_unary_function<_Tp>, - public __maybe_derive_from_binary_function<_Tp> -{ -}; - -template <class _Tp> -struct __weak_result_type - : public __weak_result_type_imp<_Tp> -{ -}; - -// 0 argument case - -template <class _Rp> -struct __weak_result_type<_Rp ()> -{ - typedef _LIBCPP_NODEBUG_TYPE _Rp result_type; -}; - -template <class _Rp> -struct __weak_result_type<_Rp (&)()> -{ - typedef _LIBCPP_NODEBUG_TYPE _Rp result_type; -}; - -template <class _Rp> -struct __weak_result_type<_Rp (*)()> -{ - typedef _LIBCPP_NODEBUG_TYPE _Rp result_type; -}; - -// 1 argument case - -template <class _Rp, class _A1> -struct __weak_result_type<_Rp (_A1)> - : public unary_function<_A1, _Rp> -{ -}; - -template <class _Rp, class _A1> -struct __weak_result_type<_Rp (&)(_A1)> - : public unary_function<_A1, _Rp> -{ -}; - -template <class _Rp, class _A1> -struct __weak_result_type<_Rp (*)(_A1)> - : public unary_function<_A1, _Rp> -{ -}; - -template <class _Rp, class _Cp> -struct __weak_result_type<_Rp (_Cp::*)()> - : public unary_function<_Cp*, _Rp> -{ -}; - -template <class _Rp, class _Cp> -struct __weak_result_type<_Rp (_Cp::*)() const> - : public unary_function<const _Cp*, _Rp> -{ -}; - -template <class _Rp, class _Cp> -struct __weak_result_type<_Rp (_Cp::*)() volatile> - : public unary_function<volatile _Cp*, _Rp> -{ -}; - -template <class _Rp, class _Cp> -struct __weak_result_type<_Rp (_Cp::*)() const volatile> - : public unary_function<const volatile _Cp*, _Rp> -{ -}; - -// 2 argument case - -template <class _Rp, class _A1, class _A2> -struct __weak_result_type<_Rp (_A1, _A2)> - : public binary_function<_A1, _A2, _Rp> -{ -}; - -template <class _Rp, class _A1, class _A2> -struct __weak_result_type<_Rp (*)(_A1, _A2)> - : public binary_function<_A1, _A2, _Rp> -{ -}; - -template <class _Rp, class _A1, class _A2> -struct __weak_result_type<_Rp (&)(_A1, _A2)> - : public binary_function<_A1, _A2, _Rp> -{ -}; - -template <class _Rp, class _Cp, class _A1> -struct __weak_result_type<_Rp (_Cp::*)(_A1)> - : public binary_function<_Cp*, _A1, _Rp> -{ -}; - -template <class _Rp, class _Cp, class _A1> -struct __weak_result_type<_Rp (_Cp::*)(_A1) const> - : public binary_function<const _Cp*, _A1, _Rp> -{ -}; - -template <class _Rp, class _Cp, class _A1> -struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> - : public binary_function<volatile _Cp*, _A1, _Rp> -{ -}; - -template <class _Rp, class _Cp, class _A1> -struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> - : public binary_function<const volatile _Cp*, _A1, _Rp> -{ -}; - - -#ifndef _LIBCPP_CXX03_LANG -// 3 or more arguments - -template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> -struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)> -{ - typedef _Rp result_type; -}; - -template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> -struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> -{ - typedef _Rp result_type; -}; - -template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> -struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> -{ - typedef _Rp result_type; -}; - -template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> -struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> -{ - typedef _Rp result_type; -}; - -template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> -struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> -{ - typedef _Rp result_type; -}; - -template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> -struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> -{ - typedef _Rp result_type; -}; - -template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> -struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> -{ - typedef _Rp result_type; -}; - -template <class _Tp, class ..._Args> -struct __invoke_return -{ - typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type; -}; - -#else // defined(_LIBCPP_CXX03_LANG) - -#include <__functional_base_03> - -#endif // !defined(_LIBCPP_CXX03_LANG) - - -template <class _Ret> -struct __invoke_void_return_wrapper -{ -#ifndef _LIBCPP_CXX03_LANG - template <class ..._Args> - static _Ret __call(_Args&&... __args) { - return __invoke(_VSTD::forward<_Args>(__args)...); - } -#else - template <class _Fn> - static _Ret __call(_Fn __f) { - return __invoke(__f); - } - - template <class _Fn, class _A0> - static _Ret __call(_Fn __f, _A0& __a0) { - return __invoke(__f, __a0); - } - - template <class _Fn, class _A0, class _A1> - static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) { - return __invoke(__f, __a0, __a1); - } - - template <class _Fn, class _A0, class _A1, class _A2> - static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){ - return __invoke(__f, __a0, __a1, __a2); - } -#endif -}; - -template <> -struct __invoke_void_return_wrapper<void> -{ -#ifndef _LIBCPP_CXX03_LANG - template <class ..._Args> - static void __call(_Args&&... __args) { - __invoke(_VSTD::forward<_Args>(__args)...); - } -#else - template <class _Fn> - static void __call(_Fn __f) { - __invoke(__f); - } - - template <class _Fn, class _A0> - static void __call(_Fn __f, _A0& __a0) { - __invoke(__f, __a0); - } - - template <class _Fn, class _A0, class _A1> - static void __call(_Fn __f, _A0& __a0, _A1& __a1) { - __invoke(__f, __a0, __a1); - } - - template <class _Fn, class _A0, class _A1, class _A2> - static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) { - __invoke(__f, __a0, __a1, __a2); - } -#endif -}; - -template <class _Tp> -class _LIBCPP_TEMPLATE_VIS reference_wrapper - : public __weak_result_type<_Tp> -{ -public: - // types - typedef _Tp type; -private: - type* __f_; - -public: - // construct/copy/destroy - _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT - : __f_(_VSTD::addressof(__f)) {} -#ifndef _LIBCPP_CXX03_LANG - private: reference_wrapper(type&&); public: // = delete; // do not bind to temps -#endif - - // access - _LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;} - _LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;} - -#ifndef _LIBCPP_CXX03_LANG - // invoke - template <class... _ArgTypes> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_of<type&, _ArgTypes...>::type - operator() (_ArgTypes&&... __args) const { - return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...); - } -#else - - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return<type>::type - operator() () const { - return __invoke(get()); - } - - template <class _A0> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return0<type, _A0>::type - operator() (_A0& __a0) const { - return __invoke(get(), __a0); - } - - template <class _A0> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return0<type, _A0 const>::type - operator() (_A0 const& __a0) const { - return __invoke(get(), __a0); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0, _A1>::type - operator() (_A0& __a0, _A1& __a1) const { - return __invoke(get(), __a0, __a1); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0 const, _A1>::type - operator() (_A0 const& __a0, _A1& __a1) const { - return __invoke(get(), __a0, __a1); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0, _A1 const>::type - operator() (_A0& __a0, _A1 const& __a1) const { - return __invoke(get(), __a0, __a1); - } - - template <class _A0, class _A1> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return1<type, _A0 const, _A1 const>::type - operator() (_A0 const& __a0, _A1 const& __a1) const { - return __invoke(get(), __a0, __a1); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1, _A2>::type - operator() (_A0& __a0, _A1& __a1, _A2& __a2) const { - return __invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1, _A2>::type - operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const { - return __invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1 const, _A2>::type - operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const { - return __invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1, _A2 const>::type - operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const { - return __invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type - operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const { - return __invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type - operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const { - return __invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type - operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const { - return __invoke(get(), __a0, __a1, __a2); - } - - template <class _A0, class _A1, class _A2> - _LIBCPP_INLINE_VISIBILITY - typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type - operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { - return __invoke(get(), __a0, __a1, __a2); - } -#endif // _LIBCPP_CXX03_LANG -}; - - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -reference_wrapper<_Tp> -ref(_Tp& __t) _NOEXCEPT -{ - return reference_wrapper<_Tp>(__t); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -reference_wrapper<_Tp> -ref(reference_wrapper<_Tp> __t) _NOEXCEPT -{ - return ref(__t.get()); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -reference_wrapper<const _Tp> -cref(const _Tp& __t) _NOEXCEPT -{ - return reference_wrapper<const _Tp>(__t); -} - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -reference_wrapper<const _Tp> -cref(reference_wrapper<_Tp> __t) _NOEXCEPT -{ - return cref(__t.get()); -} - -#ifndef _LIBCPP_CXX03_LANG -template <class _Tp> void ref(const _Tp&&) = delete; -template <class _Tp> void cref(const _Tp&&) = delete; -#endif - -#if _LIBCPP_STD_VER > 11 -template <class _Tp, class, class = void> -struct __is_transparent : false_type {}; - -template <class _Tp, class _Up> -struct __is_transparent<_Tp, _Up, - typename __void_t<typename _Tp::is_transparent>::type> - : true_type {}; -#endif - -// allocator_arg_t - -struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; }; - -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) -extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg; -#else -/* _LIBCPP_INLINE_VAR */ constexpr allocator_arg_t allocator_arg = allocator_arg_t(); -#endif - -// uses_allocator - -template <class _Tp> -struct __has_allocator_type -{ -private: - struct __two {char __lx; char __lxx;}; - template <class _Up> static __two __test(...); - template <class _Up> static char __test(typename _Up::allocator_type* = 0); -public: - static const bool value = sizeof(__test<_Tp>(0)) == 1; -}; - -template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value> -struct __uses_allocator - : public integral_constant<bool, - is_convertible<_Alloc, typename _Tp::allocator_type>::value> -{ -}; - -template <class _Tp, class _Alloc> -struct __uses_allocator<_Tp, _Alloc, false> - : public false_type -{ -}; - -template <class _Tp, class _Alloc> -struct _LIBCPP_TEMPLATE_VIS uses_allocator - : public __uses_allocator<_Tp, _Alloc> -{ -}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp, class _Alloc> -_LIBCPP_INLINE_VAR constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value; -#endif - -#ifndef _LIBCPP_CXX03_LANG - -// allocator construction - -template <class _Tp, class _Alloc, class ..._Args> -struct __uses_alloc_ctor_imp -{ - typedef _LIBCPP_NODEBUG_TYPE typename __uncvref<_Alloc>::type _RawAlloc; - static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value; - static const bool __ic = - is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; - static const int value = __ua ? 2 - __ic : 0; -}; - -template <class _Tp, class _Alloc, class ..._Args> -struct __uses_alloc_ctor - : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value> - {}; - -template <class _Tp, class _Allocator, class... _Args> -inline _LIBCPP_INLINE_VISIBILITY -void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args ) -{ - new (__storage) _Tp (_VSTD::forward<_Args>(__args)...); -} - -// FIXME: This should have a version which takes a non-const alloc. -template <class _Tp, class _Allocator, class... _Args> -inline _LIBCPP_INLINE_VISIBILITY -void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) -{ - new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...); -} - -// FIXME: This should have a version which takes a non-const alloc. -template <class _Tp, class _Allocator, class... _Args> -inline _LIBCPP_INLINE_VISIBILITY -void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) -{ - new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a); -} - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP_FUNCTIONAL_BASE diff --git a/gnu/llvm/libcxx/include/__libcpp_version b/gnu/llvm/libcxx/include/__libcpp_version deleted file mode 100644 index 5caff40c4a0..00000000000 --- a/gnu/llvm/libcxx/include/__libcpp_version +++ /dev/null @@ -1 +0,0 @@ -10000 diff --git a/gnu/llvm/libcxx/include/__locale b/gnu/llvm/libcxx/include/__locale index ad742997d9a..e0ffa0ca00f 100644 --- a/gnu/llvm/libcxx/include/__locale +++ b/gnu/llvm/libcxx/include/__locale @@ -12,31 +12,30 @@ #include <__availability> #include <__config> -#include <string> -#include <memory> -#include <utility> -#include <mutex> -#include <cstdint> #include <cctype> +#include <cstdint> #include <locale.h> +#include <mutex> +#include <string> + +// Some platforms require more includes than others. Keep the includes on all plaforms for now. +#include <cstddef> +#include <cstring> + #if defined(_LIBCPP_MSVCRT_LIKE) -# include <cstring> # include <__support/win32/locale_win32.h> -#elif defined(__NuttX__) -# include <__support/nuttx/xlocale.h> #elif defined(_AIX) || defined(__MVS__) # include <__support/ibm/xlocale.h> #elif defined(__ANDROID__) # include <__support/android/locale_bionic.h> #elif defined(__sun__) -# include <xlocale.h> # include <__support/solaris/xlocale.h> +# include <xlocale.h> #elif defined(_NEWLIB_VERSION) # include <__support/newlib/xlocale.h> #elif defined(__OpenBSD__) # include <__support/openbsd/xlocale.h> -#elif (defined(__APPLE__) || defined(__FreeBSD__) \ - || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)) +#elif (defined(__APPLE__) || defined(__FreeBSD__)) # include <xlocale.h> #elif defined(__Fuchsia__) # include <__support/fuchsia/xlocale.h> @@ -48,7 +47,7 @@ #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header +# pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD @@ -194,12 +193,12 @@ protected: explicit facet(size_t __refs = 0) : __shared_count(static_cast<long>(__refs)-1) {} - virtual ~facet(); + ~facet() override; // facet(const facet&) = delete; // effectively done in __shared_count // void operator=(const facet&) = delete; private: - virtual void __on_zero_shared() _NOEXCEPT; + void __on_zero_shared() _NOEXCEPT override; }; class _LIBCPP_TYPE_VIS locale::id @@ -210,10 +209,11 @@ class _LIBCPP_TYPE_VIS locale::id static int32_t __next_id; public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {} + void operator=(const id&) = delete; + id(const id&) = delete; + private: void __init(); - void operator=(const id&); // = delete; - id(const id&); // = delete; public: // only needed for tests long __get(); @@ -293,7 +293,7 @@ public: static locale::id id; protected: - ~collate(); + ~collate() override; virtual int do_compare(const char_type* __lo1, const char_type* __hi1, const char_type* __lo2, const char_type* __hi2) const; virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const @@ -339,8 +339,10 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const return static_cast<long>(__h); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>; +#endif // template <class CharT> class collate_byname; @@ -350,7 +352,7 @@ template <> class _LIBCPP_TYPE_VIS collate_byname<char> : public collate<char> { - locale_t __l; + locale_t __l_; public: typedef char char_type; typedef basic_string<char_type> string_type; @@ -359,17 +361,18 @@ public: explicit collate_byname(const string& __n, size_t __refs = 0); protected: - ~collate_byname(); - virtual int do_compare(const char_type* __lo1, const char_type* __hi1, - const char_type* __lo2, const char_type* __hi2) const; - virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; + ~collate_byname() override; + int do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const override; + string_type do_transform(const char_type* __lo, const char_type* __hi) const override; }; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS collate_byname<wchar_t> : public collate<wchar_t> { - locale_t __l; + locale_t __l_; public: typedef wchar_t char_type; typedef basic_string<char_type> string_type; @@ -378,12 +381,13 @@ public: explicit collate_byname(const string& __n, size_t __refs = 0); protected: - ~collate_byname(); + ~collate_byname() override; - virtual int do_compare(const char_type* __lo1, const char_type* __hi1, - const char_type* __lo2, const char_type* __hi2) const; - virtual string_type do_transform(const char_type* __lo, const char_type* __hi) const; + int do_compare(const char_type* __lo1, const char_type* __hi1, + const char_type* __lo2, const char_type* __hi2) const override; + string_type do_transform(const char_type* __lo, const char_type* __hi) const override; }; +#endif template <class _CharT, class _Traits, class _Allocator> bool @@ -448,8 +452,9 @@ public: static const mask punct = _PUNCT; static const mask xdigit = _HEX; static const mask blank = _BLANK; - static const mask __regex_word = 0x80; + static const mask __regex_word = 0x4000; // 0x8000 and 0x0100 and 0x00ff are used # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT +# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA #elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__) # ifdef __APPLE__ typedef __uint32_t mask; @@ -489,7 +494,11 @@ public: static const mask punct = _ISPUNCT; static const mask xdigit = _ISXDIGIT; static const mask blank = _ISBLANK; +# if defined(_AIX) + static const mask __regex_word = 0x8000; +# else static const mask __regex_word = 0x80; +# endif #elif defined(_NEWLIB_VERSION) // Same type as Newlib's _ctype_ array in newlib/libc/include/ctype.h. typedef char mask; @@ -503,10 +512,38 @@ public: static const mask punct = _P; static const mask xdigit = _X | _N; static const mask blank = _B; - static const mask __regex_word = 0x80; + // mask is already fully saturated, use a different type in regex_type_traits. + static const unsigned short __regex_word = 0x100; # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_PRINT # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA # define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT +#elif defined(__MVS__) +# if defined(__NATIVE_ASCII_F) + typedef unsigned int mask; + static const mask space = _ISSPACE_A; + static const mask print = _ISPRINT_A; + static const mask cntrl = _ISCNTRL_A; + static const mask upper = _ISUPPER_A; + static const mask lower = _ISLOWER_A; + static const mask alpha = _ISALPHA_A; + static const mask digit = _ISDIGIT_A; + static const mask punct = _ISPUNCT_A; + static const mask xdigit = _ISXDIGIT_A; + static const mask blank = _ISBLANK_A; +# else + typedef unsigned short mask; + static const mask space = __ISSPACE; + static const mask print = __ISPRINT; + static const mask cntrl = __ISCNTRL; + static const mask upper = __ISUPPER; + static const mask lower = __ISLOWER; + static const mask alpha = __ISALPHA; + static const mask digit = __ISDIGIT; + static const mask punct = __ISPUNCT; + static const mask xdigit = __ISXDIGIT; + static const mask blank = __ISBLANK; +# endif + static const mask __regex_word = 0x8000; #else # error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE? #endif @@ -514,10 +551,15 @@ public: static const mask graph = alnum | punct; _LIBCPP_INLINE_VISIBILITY ctype_base() {} + + static_assert((__regex_word & ~(std::make_unsigned<mask>::type)(space | print | cntrl | upper | lower | alpha | + digit | punct | xdigit | blank)) == __regex_word, + "__regex_word can't overlap other bits"); }; template <class _CharT> class _LIBCPP_TEMPLATE_VIS ctype; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS ctype<wchar_t> : public locale::facet, @@ -605,7 +647,7 @@ public: static locale::id id; protected: - ~ctype(); + ~ctype() override; virtual bool do_is(mask __m, char_type __c) const; virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; @@ -619,6 +661,7 @@ protected: virtual char do_narrow(char_type, char __dfault) const; virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS ctype<char> @@ -658,7 +701,7 @@ public: const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const { for (; __low != __high; ++__low) - if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))) + if (!isascii(*__low) || !(__tab_[static_cast<int>(*__low)] & __m)) break; return __low; } @@ -728,9 +771,13 @@ public: static const short* __classic_upper_table() _NOEXCEPT; static const short* __classic_lower_table() _NOEXCEPT; #endif +#if defined(__MVS__) + static const unsigned short* __classic_upper_table() _NOEXCEPT; + static const unsigned short* __classic_lower_table() _NOEXCEPT; +#endif protected: - ~ctype(); + ~ctype() override; virtual char_type do_toupper(char_type __c) const; virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; virtual char_type do_tolower(char_type __c) const; @@ -749,52 +796,54 @@ template <> class _LIBCPP_TYPE_VIS ctype_byname<char> : public ctype<char> { - locale_t __l; + locale_t __l_; public: explicit ctype_byname(const char*, size_t = 0); explicit ctype_byname(const string&, size_t = 0); protected: - ~ctype_byname(); - virtual char_type do_toupper(char_type) const; - virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; - virtual char_type do_tolower(char_type) const; - virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; + ~ctype_byname() override; + char_type do_toupper(char_type) const override; + const char_type* do_toupper(char_type* __low, const char_type* __high) const override; + char_type do_tolower(char_type) const override; + const char_type* do_tolower(char_type* __low, const char_type* __high) const override; }; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS ctype_byname<wchar_t> : public ctype<wchar_t> { - locale_t __l; + locale_t __l_; public: explicit ctype_byname(const char*, size_t = 0); explicit ctype_byname(const string&, size_t = 0); protected: - ~ctype_byname(); - virtual bool do_is(mask __m, char_type __c) const; - virtual const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const; - virtual const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const; - virtual const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const; - virtual char_type do_toupper(char_type) const; - virtual const char_type* do_toupper(char_type* __low, const char_type* __high) const; - virtual char_type do_tolower(char_type) const; - virtual const char_type* do_tolower(char_type* __low, const char_type* __high) const; - virtual char_type do_widen(char) const; - virtual const char* do_widen(const char* __low, const char* __high, char_type* __dest) const; - virtual char do_narrow(char_type, char __dfault) const; - virtual const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const; + ~ctype_byname() override; + bool do_is(mask __m, char_type __c) const override; + const char_type* do_is(const char_type* __low, const char_type* __high, mask* __vec) const override; + const char_type* do_scan_is(mask __m, const char_type* __low, const char_type* __high) const override; + const char_type* do_scan_not(mask __m, const char_type* __low, const char_type* __high) const override; + char_type do_toupper(char_type) const override; + const char_type* do_toupper(char_type* __low, const char_type* __high) const override; + char_type do_tolower(char_type) const override; + const char_type* do_tolower(char_type* __low, const char_type* __high) const override; + char_type do_widen(char) const override; + const char* do_widen(const char* __low, const char* __high, char_type* __dest) const override; + char do_narrow(char_type, char __dfault) const override; + const char_type* do_narrow(const char_type* __low, const char_type* __high, char __dfault, char* __dest) const override; }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class _CharT> inline _LIBCPP_INLINE_VISIBILITY bool isspace(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); } template <class _CharT> @@ -802,7 +851,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isprint(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); } template <class _CharT> @@ -810,7 +859,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool iscntrl(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); } template <class _CharT> @@ -818,7 +867,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isupper(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); } template <class _CharT> @@ -826,7 +875,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool islower(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); } template <class _CharT> @@ -834,7 +883,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isalpha(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); } template <class _CharT> @@ -842,7 +891,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isdigit(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); } template <class _CharT> @@ -850,7 +899,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool ispunct(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); } template <class _CharT> @@ -858,7 +907,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isxdigit(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); } template <class _CharT> @@ -866,7 +915,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isalnum(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); } template <class _CharT> @@ -874,7 +923,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool isgraph(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); } template <class _CharT> @@ -882,7 +931,7 @@ inline _LIBCPP_INLINE_VISIBILITY _CharT toupper(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).toupper(__c); + return std::use_facet<ctype<_CharT> >(__loc).toupper(__c); } template <class _CharT> @@ -890,7 +939,7 @@ inline _LIBCPP_INLINE_VISIBILITY _CharT tolower(_CharT __c, const locale& __loc) { - return use_facet<ctype<_CharT> >(__loc).tolower(__c); + return std::use_facet<ctype<_CharT> >(__loc).tolower(__c); } // codecvt_base @@ -976,7 +1025,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -994,12 +1043,13 @@ protected: // template <> class codecvt<wchar_t, char, mbstate_t> +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t> : public locale::facet, public codecvt_base { - locale_t __l; + locale_t __l_; public: typedef wchar_t intern_type; typedef char extern_type; @@ -1059,7 +1109,7 @@ public: protected: explicit codecvt(const char*, size_t __refs = 0); - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1074,6 +1124,7 @@ protected: virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_max_length() const _NOEXCEPT; }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS // template <> class codecvt<char16_t, char, mbstate_t> // deprecated in C++20 @@ -1145,7 +1196,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1233,7 +1284,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1321,7 +1372,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1409,7 +1460,7 @@ protected: explicit codecvt(const char*, size_t __refs = 0) : locale::facet(__refs) {} - ~codecvt(); + ~codecvt() override; virtual result do_out(state_type& __st, const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt, @@ -1441,7 +1492,7 @@ public: explicit codecvt_byname(const string& __nm, size_t __refs = 0) : codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {} protected: - ~codecvt_byname(); + ~codecvt_byname() override; }; _LIBCPP_SUPPRESS_DEPRECATED_PUSH @@ -1451,13 +1502,15 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname() } _LIBCPP_SUPPRESS_DEPRECATED_POP -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>) // deprecated in C++20 -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>) // deprecated in C++20 +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>; +#endif +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 -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>) // C++20 -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>) // C++20 +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 template <size_t _Np> @@ -1491,7 +1544,7 @@ struct _LIBCPP_TYPE_VIS __narrow_to_utf8<16> __narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__narrow_to_utf8(); + ~__narrow_to_utf8() override; template <class _OutputIterator, class _CharT> _LIBCPP_INLINE_VISIBILITY @@ -1527,7 +1580,7 @@ struct _LIBCPP_TYPE_VIS __narrow_to_utf8<32> __narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__narrow_to_utf8(); + ~__narrow_to_utf8() override; template <class _OutputIterator, class _CharT> _LIBCPP_INLINE_VISIBILITY @@ -1585,7 +1638,7 @@ struct _LIBCPP_TYPE_VIS __widen_from_utf8<16> __widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__widen_from_utf8(); + ~__widen_from_utf8() override; template <class _OutputIterator> _LIBCPP_INLINE_VISIBILITY @@ -1621,7 +1674,7 @@ struct _LIBCPP_TYPE_VIS __widen_from_utf8<32> __widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {} _LIBCPP_SUPPRESS_DEPRECATED_POP - ~__widen_from_utf8(); + ~__widen_from_utf8() override; template <class _OutputIterator> _LIBCPP_INLINE_VISIBILITY @@ -1671,7 +1724,7 @@ public: static locale::id id; protected: - ~numpunct(); + ~numpunct() override; virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; @@ -1683,6 +1736,7 @@ protected: string __grouping_; }; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS numpunct<wchar_t> : public locale::facet @@ -1702,7 +1756,7 @@ public: static locale::id id; protected: - ~numpunct(); + ~numpunct() override; virtual char_type do_decimal_point() const; virtual char_type do_thousands_sep() const; virtual string do_grouping() const; @@ -1713,6 +1767,7 @@ protected: char_type __thousands_sep_; string __grouping_; }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS // template <class charT> class numpunct_byname @@ -1730,12 +1785,13 @@ public: explicit numpunct_byname(const string& __nm, size_t __refs = 0); protected: - ~numpunct_byname(); + ~numpunct_byname() override; private: void __init(const char*); }; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t> : public numpunct<wchar_t> @@ -1748,11 +1804,12 @@ public: explicit numpunct_byname(const string& __nm, size_t __refs = 0); protected: - ~numpunct_byname(); + ~numpunct_byname() override; private: void __init(const char*); }; +#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS _LIBCPP_END_NAMESPACE_STD diff --git a/gnu/llvm/libcxx/include/__memory/pointer_safety.h b/gnu/llvm/libcxx/include/__memory/pointer_safety.h deleted file mode 100644 index 87a6a9659e0..00000000000 --- a/gnu/llvm/libcxx/include/__memory/pointer_safety.h +++ /dev/null @@ -1,57 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___MEMORY_POINTER_SAFETY_H -#define _LIBCPP___MEMORY_POINTER_SAFETY_H - -#include <__config> -#include <cstddef> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if !defined(_LIBCPP_CXX03_LANG) - -enum class pointer_safety : unsigned char { - relaxed, - preferred, - strict -}; - -inline _LIBCPP_INLINE_VISIBILITY -pointer_safety get_pointer_safety() _NOEXCEPT { - return pointer_safety::relaxed; -} - -_LIBCPP_FUNC_VIS void declare_reachable(void* __p); -_LIBCPP_FUNC_VIS void declare_no_pointers(char* __p, size_t __n); -_LIBCPP_FUNC_VIS void undeclare_no_pointers(char* __p, size_t __n); -_LIBCPP_FUNC_VIS void* __undeclare_reachable(void* __p); - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_Tp* -undeclare_reachable(_Tp* __p) -{ - return static_cast<_Tp*>(__undeclare_reachable(__p)); -} - -#endif // !C++03 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___MEMORY_POINTER_SAFETY_H diff --git a/gnu/llvm/libcxx/include/__nullptr b/gnu/llvm/libcxx/include/__nullptr deleted file mode 100644 index 45529a710b6..00000000000 --- a/gnu/llvm/libcxx/include/__nullptr +++ /dev/null @@ -1,61 +0,0 @@ -// -*- C++ -*- -//===--------------------------- __nullptr --------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_NULLPTR -#define _LIBCPP_NULLPTR - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -#ifdef _LIBCPP_HAS_NO_NULLPTR - -_LIBCPP_BEGIN_NAMESPACE_STD - -struct _LIBCPP_TEMPLATE_VIS nullptr_t -{ - void* __lx; - - struct __nat {int __for_bool_;}; - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {} - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;} - - template <class _Tp> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - operator _Tp* () const {return 0;} - - template <class _Tp, class _Up> - _LIBCPP_INLINE_VISIBILITY - operator _Tp _Up::* () const {return 0;} - - friend _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;} - friend _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;} -}; - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);} - -#define nullptr _VSTD::__get_nullptr_t() - -_LIBCPP_END_NAMESPACE_STD - -#else // _LIBCPP_HAS_NO_NULLPTR - -namespace std -{ - typedef decltype(nullptr) nullptr_t; -} - -#endif // _LIBCPP_HAS_NO_NULLPTR - -#endif // _LIBCPP_NULLPTR diff --git a/gnu/llvm/libcxx/include/__string b/gnu/llvm/libcxx/include/__string deleted file mode 100644 index 056b9b80ea5..00000000000 --- a/gnu/llvm/libcxx/include/__string +++ /dev/null @@ -1,1061 +0,0 @@ -// -*- C++ -*- -//===-------------------------- __string ----------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___STRING -#define _LIBCPP___STRING - -/* - string synopsis - -namespace std -{ - -template <class charT> -struct char_traits -{ - typedef charT char_type; - typedef ... int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; - - static constexpr void assign(char_type& c1, const char_type& c2) noexcept; - static constexpr bool eq(char_type c1, char_type c2) noexcept; - static constexpr bool lt(char_type c1, char_type c2) noexcept; - - static constexpr int compare(const char_type* s1, const char_type* s2, size_t n); - static constexpr size_t length(const char_type* s); - static constexpr const char_type* - find(const char_type* s, size_t n, const char_type& a); - - static constexpr char_type* move(char_type* s1, const char_type* s2, size_t n); // constexpr in C++20 - static constexpr char_type* copy(char_type* s1, const char_type* s2, size_t n); // constexpr in C++20 - static constexpr char_type* assign(char_type* s, size_t n, char_type a); // constexpr in C++20 - - static constexpr int_type not_eof(int_type c) noexcept; - static constexpr char_type to_char_type(int_type c) noexcept; - static constexpr int_type to_int_type(char_type c) noexcept; - static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept; - static constexpr int_type eof() noexcept; -}; - -template <> struct char_traits<char>; -template <> struct char_traits<wchar_t>; -template <> struct char_traits<char8_t>; // c++20 - -} // std - -*/ - -#include <__config> -#include <algorithm> // for search and min -#include <cstdio> // For EOF. -#include <memory> // for __murmur2_or_cityhash - -#include <__debug> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - -_LIBCPP_BEGIN_NAMESPACE_STD - -// char_traits - -template <class _CharT> -struct _LIBCPP_TEMPLATE_VIS char_traits -{ - typedef _CharT char_type; - typedef int int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; - - static inline void _LIBCPP_CONSTEXPR_AFTER_CXX14 - assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 < __c2;} - - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n); - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - size_t length(const char_type* __s); - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a); - static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* move(char_type* __s1, const char_type* __s2, size_t __n); - _LIBCPP_INLINE_VISIBILITY - static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); - _LIBCPP_INLINE_VISIBILITY - static _LIBCPP_CONSTEXPR_AFTER_CXX17 - char_type* assign(char_type* __s, size_t __n, char_type __a); - - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type(__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(EOF);} -}; - -template <class _CharT> -_LIBCPP_CONSTEXPR_AFTER_CXX14 int -char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_t __n) -{ - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -} - -template <class _CharT> -inline -_LIBCPP_CONSTEXPR_AFTER_CXX14 size_t -char_traits<_CharT>::length(const char_type* __s) -{ - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -} - -template <class _CharT> -inline -_LIBCPP_CONSTEXPR_AFTER_CXX14 const _CharT* -char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a) -{ - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return 0; -} - -template <class _CharT> -_LIBCPP_CONSTEXPR_AFTER_CXX17 _CharT* -char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n) -{ - if (__n == 0) return __s1; - char_type* __r = __s1; - if (__s1 < __s2) - { - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - } - else if (__s2 < __s1) - { - __s1 += __n; - __s2 += __n; - for (; __n; --__n) - assign(*--__s1, *--__s2); - } - return __r; -} - -template <class _CharT> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* -char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n) -{ - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - char_type* __r = __s1; - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - return __r; -} - -template <class _CharT> -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -_CharT* -char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a) -{ - char_type* __r = __s; - for (; __n; --__n, ++__s) - assign(*__s, __a); - return __r; -} - -// constexpr versions of move/copy/assign. - -template <class _CharT> -static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED -_CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) return __s1; - if (__s1 < __s2) { - _VSTD::copy(__s2, __s2 + __n, __s1); - } else if (__s2 < __s1) { - _VSTD::copy_backward(__s2, __s2 + __n, __s1 + __n); - } - return __s1; -} - -template <class _CharT> -static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED -_CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT -{ - _VSTD::copy_n(__s2, __n, __s1); - return __s1; -} - -template <class _CharT> -static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED -_CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT -{ - _VSTD::fill_n(__s, __n, __a); - return __s; -} - -// char_traits<char> - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits<char> -{ - typedef char char_type; - typedef int int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; - - static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 - void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return (unsigned char)__c1 < (unsigned char)__c2;} - - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - static inline size_t _LIBCPP_CONSTEXPR_AFTER_CXX14 - length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);} - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED - char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? __move_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n); - } - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - return __libcpp_is_constant_evaluated() - ? __copy_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); - } - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED - char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? __assign_constexpr(__s, __n, __a) - : __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n); - } - - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type((unsigned char)__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(EOF);} -}; - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -int -char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) - return 0; -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_memcmp(__s1, __s2, __n); -#elif _LIBCPP_STD_VER <= 14 - return memcmp(__s1, __s2, __n); -#else - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -#endif -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -const char* -char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - if (__n == 0) - return nullptr; -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_char_memchr(__s, to_int_type(__a), __n); -#elif _LIBCPP_STD_VER <= 14 - return (const char_type*) memchr(__s, to_int_type(__a), __n); -#else - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return nullptr; -#endif -} - - -// char_traits<wchar_t> - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t> -{ - typedef wchar_t char_type; - typedef wint_t int_type; - typedef streamoff off_type; - typedef streampos pos_type; - typedef mbstate_t state_type; - - static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 - void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 < __c2;} - - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - size_t length(const char_type* __s) _NOEXCEPT; - static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED - char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? __move_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : wmemmove(__s1, __s2, __n); - } - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - return __libcpp_is_constant_evaluated() - ? __copy_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : wmemcpy(__s1, __s2, __n); - } - static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED - char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? __assign_constexpr(__s, __n, __a) - : __n == 0 ? __s : wmemset(__s, __a, __n); - } - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type(__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(WEOF);} -}; - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -int -char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) - return 0; -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_wmemcmp(__s1, __s2, __n); -#elif _LIBCPP_STD_VER <= 14 - return wmemcmp(__s1, __s2, __n); -#else - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -#endif -} - - -template <class _Traits> -_LIBCPP_INLINE_VISIBILITY -_LIBCPP_CONSTEXPR -inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT { -#if _LIBCPP_DEBUG_LEVEL >= 1 - return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0); -#else - return _Traits::length(__s); -#endif -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -size_t -char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT -{ -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_wcslen(__s); -#elif _LIBCPP_STD_VER <= 14 - return wcslen(__s); -#else - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -#endif -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -const wchar_t* -char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - if (__n == 0) - return nullptr; -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_wmemchr(__s, __a, __n); -#elif _LIBCPP_STD_VER <= 14 - return wmemchr(__s, __a, __n); -#else - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return nullptr; -#endif -} - - -#ifndef _LIBCPP_NO_HAS_CHAR8_T - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t> -{ - typedef char8_t char_type; - typedef unsigned int int_type; - typedef streamoff off_type; - typedef u8streampos pos_type; - typedef mbstate_t state_type; - - static inline constexpr void assign(char_type& __c1, const char_type& __c2) noexcept - {__c1 = __c2;} - static inline constexpr bool eq(char_type __c1, char_type __c2) noexcept - {return __c1 == __c2;} - static inline constexpr bool lt(char_type __c1, char_type __c2) noexcept - {return __c1 < __c2;} - - static constexpr - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - - static constexpr - size_t length(const char_type* __s) _NOEXCEPT; - - _LIBCPP_INLINE_VISIBILITY static constexpr - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - - static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED - char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? __move_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n); - } - - static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED - char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT - { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - return __libcpp_is_constant_evaluated() - ? __copy_constexpr(__s1, __s2, __n) - : __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n); - } - - static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED - char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT - { - return __libcpp_is_constant_evaluated() - ? __assign_constexpr(__s, __n, __a) - : __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n); - } - - static inline constexpr int_type not_eof(int_type __c) noexcept - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline constexpr char_type to_char_type(int_type __c) noexcept - {return char_type(__c);} - static inline constexpr int_type to_int_type(char_type __c) noexcept - {return int_type(__c);} - static inline constexpr bool eq_int_type(int_type __c1, int_type __c2) noexcept - {return __c1 == __c2;} - static inline constexpr int_type eof() noexcept - {return int_type(EOF);} -}; - -// TODO use '__builtin_strlen' if it ever supports char8_t ?? -inline constexpr -size_t -char_traits<char8_t>::length(const char_type* __s) _NOEXCEPT -{ - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -} - -inline constexpr -int -char_traits<char8_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ -#if __has_feature(cxx_constexpr_string_builtins) - return __builtin_memcmp(__s1, __s2, __n); -#else - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -#endif -} - -// TODO use '__builtin_char_memchr' if it ever supports char8_t ?? -inline constexpr -const char8_t* -char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return 0; -} - -#endif // #_LIBCPP_NO_HAS_CHAR8_T - -#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t> -{ - typedef char16_t char_type; - typedef uint_least16_t int_type; - typedef streamoff off_type; - typedef u16streampos pos_type; - typedef mbstate_t state_type; - - static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 - void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 < __c2;} - - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - size_t length(const char_type* __s) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; - - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type(__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(0xFFFF);} -}; - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -int -char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -size_t -char_traits<char16_t>::length(const char_type* __s) _NOEXCEPT -{ - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -const char16_t* -char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return 0; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char16_t* -char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) return __s1; - char_type* __r = __s1; - if (__s1 < __s2) - { - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - } - else if (__s2 < __s1) - { - __s1 += __n; - __s2 += __n; - for (; __n; --__n) - assign(*--__s1, *--__s2); - } - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char16_t* -char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - char_type* __r = __s1; - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char16_t* -char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT -{ - char_type* __r = __s; - for (; __n; --__n, ++__s) - assign(*__s, __a); - return __r; -} - -template <> -struct _LIBCPP_TEMPLATE_VIS char_traits<char32_t> -{ - typedef char32_t char_type; - typedef uint_least32_t int_type; - typedef streamoff off_type; - typedef u32streampos pos_type; - typedef mbstate_t state_type; - - static inline _LIBCPP_CONSTEXPR_AFTER_CXX14 - void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT {__c1 = __c2;} - static inline _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT - {return __c1 < __c2;} - - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - int compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - size_t length(const char_type* __s) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR_AFTER_CXX14 - const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 - static char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT; - - static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT - {return eq_int_type(__c, eof()) ? ~eof() : __c;} - static inline _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT - {return char_type(__c);} - static inline _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT - {return int_type(__c);} - static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT - {return __c1 == __c2;} - static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT - {return int_type(0xFFFFFFFF);} -}; - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -int -char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - for (; __n; --__n, ++__s1, ++__s2) - { - if (lt(*__s1, *__s2)) - return -1; - if (lt(*__s2, *__s1)) - return 1; - } - return 0; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -size_t -char_traits<char32_t>::length(const char_type* __s) _NOEXCEPT -{ - size_t __len = 0; - for (; !eq(*__s, char_type(0)); ++__s) - ++__len; - return __len; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX14 -const char32_t* -char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT -{ - for (; __n; --__n) - { - if (eq(*__s, __a)) - return __s; - ++__s; - } - return 0; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char32_t* -char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - if (__n == 0) return __s1; - char_type* __r = __s1; - if (__s1 < __s2) - { - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - } - else if (__s2 < __s1) - { - __s1 += __n; - __s2 += __n; - for (; __n; --__n) - assign(*--__s1, *--__s2); - } - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char32_t* -char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT -{ - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); - char_type* __r = __s1; - for (; __n; --__n, ++__s1, ++__s2) - assign(*__s1, *__s2); - return __r; -} - -inline _LIBCPP_CONSTEXPR_AFTER_CXX17 -char32_t* -char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT -{ - char_type* __r = __s; - for (; __n; --__n, ++__s) - assign(*__s, __a); - return __r; -} - -#endif // _LIBCPP_HAS_NO_UNICODE_CHARS - -// helper fns for basic_string and string_view - -// __str_find -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT -{ - if (__pos >= __sz) - return __npos; - const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c); - if (__r == 0) - return __npos; - return static_cast<_SizeT>(__r - __p); -} - -template <class _CharT, class _Traits> -inline _LIBCPP_CONSTEXPR_AFTER_CXX11 const _CharT * -__search_substring(const _CharT *__first1, const _CharT *__last1, - const _CharT *__first2, const _CharT *__last2) { - // Take advantage of knowing source and pattern lengths. - // Stop short when source is smaller than pattern. - const ptrdiff_t __len2 = __last2 - __first2; - if (__len2 == 0) - return __first1; - - ptrdiff_t __len1 = __last1 - __first1; - if (__len1 < __len2) - return __last1; - - // First element of __first2 is loop invariant. - _CharT __f2 = *__first2; - while (true) { - __len1 = __last1 - __first1; - // Check whether __first1 still has at least __len2 bytes. - if (__len1 < __len2) - return __last1; - - // Find __f2 the first byte matching in __first1. - __first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2); - if (__first1 == 0) - return __last1; - - // It is faster to compare from the first byte of __first1 even if we - // already know that it matches the first byte of __first2: this is because - // __first2 is most likely aligned, as it is user's "pattern" string, and - // __first1 + 1 is most likely not aligned, as the match is in the middle of - // the string. - if (_Traits::compare(__first1, __first2, __len2) == 0) - return __first1; - - ++__first1; - } -} - -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - if (__pos > __sz) - return __npos; - - if (__n == 0) // There is nothing to search, just return __pos. - return __pos; - - const _CharT *__r = __search_substring<_CharT, _Traits>( - __p + __pos, __p + __sz, __s, __s + __n); - - if (__r == __p + __sz) - return __npos; - return static_cast<_SizeT>(__r - __p); -} - - -// __str_rfind - -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_rfind(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT -{ - if (__sz < 1) - return __npos; - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - for (const _CharT* __ps = __p + __pos; __ps != __p;) - { - if (_Traits::eq(*--__ps, __c)) - return static_cast<_SizeT>(__ps - __p); - } - return __npos; -} - -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_rfind(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - __pos = _VSTD::min(__pos, __sz); - if (__n < __sz - __pos) - __pos += __n; - else - __pos = __sz; - const _CharT* __r = _VSTD::__find_end( - __p, __p + __pos, __s, __s + __n, _Traits::eq, - random_access_iterator_tag(), random_access_iterator_tag()); - if (__n > 0 && __r == __p + __pos) - return __npos; - return static_cast<_SizeT>(__r - __p); -} - -// __str_find_first_of -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_first_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - if (__pos >= __sz || __n == 0) - return __npos; - const _CharT* __r = _VSTD::__find_first_of_ce - (__p + __pos, __p + __sz, __s, __s + __n, _Traits::eq ); - if (__r == __p + __sz) - return __npos; - return static_cast<_SizeT>(__r - __p); -} - - -// __str_find_last_of -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_last_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT - { - if (__n != 0) - { - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - for (const _CharT* __ps = __p + __pos; __ps != __p;) - { - const _CharT* __r = _Traits::find(__s, __n, *--__ps); - if (__r) - return static_cast<_SizeT>(__ps - __p); - } - } - return __npos; -} - - -// __str_find_first_not_of -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_first_not_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - if (__pos < __sz) - { - const _CharT* __pe = __p + __sz; - for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) - if (_Traits::find(__s, __n, *__ps) == 0) - return static_cast<_SizeT>(__ps - __p); - } - return __npos; -} - - -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_first_not_of(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT -{ - if (__pos < __sz) - { - const _CharT* __pe = __p + __sz; - for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps) - if (!_Traits::eq(*__ps, __c)) - return static_cast<_SizeT>(__ps - __p); - } - return __npos; -} - - -// __str_find_last_not_of -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_last_not_of(const _CharT *__p, _SizeT __sz, - const _CharT* __s, _SizeT __pos, _SizeT __n) _NOEXCEPT -{ - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - for (const _CharT* __ps = __p + __pos; __ps != __p;) - if (_Traits::find(__s, __n, *--__ps) == 0) - return static_cast<_SizeT>(__ps - __p); - return __npos; -} - - -template<class _CharT, class _SizeT, class _Traits, _SizeT __npos> -inline _SizeT _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY -__str_find_last_not_of(const _CharT *__p, _SizeT __sz, - _CharT __c, _SizeT __pos) _NOEXCEPT -{ - if (__pos < __sz) - ++__pos; - else - __pos = __sz; - for (const _CharT* __ps = __p + __pos; __ps != __p;) - if (!_Traits::eq(*--__ps, __c)) - return static_cast<_SizeT>(__ps - __p); - return __npos; -} - -template<class _Ptr> -inline _LIBCPP_INLINE_VISIBILITY -size_t __do_string_hash(_Ptr __p, _Ptr __e) -{ - typedef typename iterator_traits<_Ptr>::value_type value_type; - return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type)); -} - -template <class _CharT, class _Iter, class _Traits=char_traits<_CharT> > -struct __quoted_output_proxy -{ - _Iter __first; - _Iter __last; - _CharT __delim; - _CharT __escape; - - __quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e) - : __first(__f), __last(__l), __delim(__d), __escape(__e) {} - // This would be a nice place for a string_ref -}; - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___STRING diff --git a/gnu/llvm/libcxx/include/__support/ibm/limits.h b/gnu/llvm/libcxx/include/__support/ibm/limits.h deleted file mode 100644 index 45f1f1e3684..00000000000 --- a/gnu/llvm/libcxx/include/__support/ibm/limits.h +++ /dev/null @@ -1,98 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_LIMITS_H -#define _LIBCPP_SUPPORT_IBM_LIMITS_H - -#if !defined(_AIX) // Linux -#include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN - -static const unsigned int _QNAN_F = 0x7fc00000; -#define NANF (*((float *)(&_QNAN_F))) -static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0}; -#define NANL (*((long double *)(&_QNAN_LDBL128))) -static const unsigned int _SNAN_F= 0x7f855555; -#define NANSF (*((float *)(&_SNAN_F))) -static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555}; -#define NANS (*((double *)(&_SNAN_D))) -static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0}; -#define NANSL (*((long double *)(&_SNAN_LDBL128))) - -#define __builtin_huge_val() HUGE_VAL -#define __builtin_huge_valf() HUGE_VALF -#define __builtin_huge_vall() HUGE_VALL -#define __builtin_nan(__dummy) NAN -#define __builtin_nanf(__dummy) NANF -#define __builtin_nanl(__dummy) NANL -#define __builtin_nans(__dummy) NANS -#define __builtin_nansf(__dummy) NANSF -#define __builtin_nansl(__dummy) NANSL - -#else - -#include <math.h> -#include <float.h> // limit constants - -#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000 -#define __builtin_huge_valf() HUGE_VALF //0x7f800000 -#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000 -#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000 -#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000 -#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000 -#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555 -#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555 -#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555 - -#define __FLT_MANT_DIG__ FLT_MANT_DIG -#define __FLT_DIG__ FLT_DIG -#define __FLT_RADIX__ FLT_RADIX -#define __FLT_MIN_EXP__ FLT_MIN_EXP -#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP -#define __FLT_MAX_EXP__ FLT_MAX_EXP -#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP -#define __FLT_MIN__ FLT_MIN -#define __FLT_MAX__ FLT_MAX -#define __FLT_EPSILON__ FLT_EPSILON -// predefined by XLC on LoP -#define __FLT_DENORM_MIN__ 1.40129846e-45F - -#define __DBL_MANT_DIG__ DBL_MANT_DIG -#define __DBL_DIG__ DBL_DIG -#define __DBL_MIN_EXP__ DBL_MIN_EXP -#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP -#define __DBL_MAX_EXP__ DBL_MAX_EXP -#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP -#define __DBL_MIN__ DBL_MIN -#define __DBL_MAX__ DBL_MAX -#define __DBL_EPSILON__ DBL_EPSILON -// predefined by XLC on LoP -#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 - -#define __LDBL_MANT_DIG__ LDBL_MANT_DIG -#define __LDBL_DIG__ LDBL_DIG -#define __LDBL_MIN_EXP__ LDBL_MIN_EXP -#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP -#define __LDBL_MAX_EXP__ LDBL_MAX_EXP -#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP -#define __LDBL_MIN__ LDBL_MIN -#define __LDBL_MAX__ LDBL_MAX -#define __LDBL_EPSILON__ LDBL_EPSILON -// predefined by XLC on LoP -#if __LONGDOUBLE128 -#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L -#else -#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L -#endif - -// predefined by XLC on LoP -#define __CHAR_BIT__ 8 - -#endif // _AIX - -#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H diff --git a/gnu/llvm/libcxx/include/__support/ibm/locale_mgmt_aix.h b/gnu/llvm/libcxx/include/__support/ibm/locale_mgmt_aix.h deleted file mode 100644 index 4f658c3eee3..00000000000 --- a/gnu/llvm/libcxx/include/__support/ibm/locale_mgmt_aix.h +++ /dev/null @@ -1,84 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H -#define _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H - -#if defined(_AIX) -#include "cstdlib" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_AIX71) -// AIX 7.1 and higher has these definitions. Definitions and stubs -// are provied here as a temporary workaround on AIX 6.1. - -#define LC_COLLATE_MASK 1 -#define LC_CTYPE_MASK 2 -#define LC_MESSAGES_MASK 4 -#define LC_MONETARY_MASK 8 -#define LC_NUMERIC_MASK 16 -#define LC_TIME_MASK 32 -#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | \ - LC_MESSAGES_MASK | LC_MONETARY_MASK |\ - LC_NUMERIC_MASK | LC_TIME_MASK) - -typedef void* locale_t; - -// The following are stubs. They are not supported on AIX 6.1. -static inline -locale_t newlocale(int category_mask, const char *locale, locale_t base) -{ - _LC_locale_t *newloc, *loc; - if ((loc = (_LC_locale_t *)__xopen_locale(locale)) == NULL) - { - errno = EINVAL; - return (locale_t)0; - } - if ((newloc = (_LC_locale_t *)calloc(1, sizeof(_LC_locale_t))) == NULL) - { - errno = ENOMEM; - return (locale_t)0; - } - if (!base) - base = (_LC_locale_t *)__xopen_locale("C"); - memcpy(newloc, base, sizeof (_LC_locale_t)); - if (category_mask & LC_COLLATE_MASK) - newloc->lc_collate = loc->lc_collate; - if (category_mask & LC_CTYPE_MASK) - newloc->lc_ctype = loc->lc_ctype; - //if (category_mask & LC_MESSAGES_MASK) - // newloc->lc_messages = loc->lc_messages; - if (category_mask & LC_MONETARY_MASK) - newloc->lc_monetary = loc->lc_monetary; - if (category_mask & LC_TIME_MASK) - newloc->lc_time = loc->lc_time; - if (category_mask & LC_NUMERIC_MASK) - newloc->lc_numeric = loc->lc_numeric; - return (locale_t)newloc; -} -static inline -void freelocale(locale_t locobj) -{ - free(locobj); -} -static inline -locale_t uselocale(locale_t newloc) -{ - return (locale_t)0; -} -#endif // !defined(_AIX71) - -#ifdef __cplusplus -} -#endif -#endif // defined(_AIX) -#endif // _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H diff --git a/gnu/llvm/libcxx/include/__support/ibm/support.h b/gnu/llvm/libcxx/include/__support/ibm/support.h deleted file mode 100644 index a7751b01766..00000000000 --- a/gnu/llvm/libcxx/include/__support/ibm/support.h +++ /dev/null @@ -1,53 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_IBM_SUPPORT_H -#define _LIBCPP_SUPPORT_IBM_SUPPORT_H - -extern "builtin" int __popcnt4(unsigned int); -extern "builtin" int __popcnt8(unsigned long long); -extern "builtin" unsigned int __cnttz4(unsigned int); -extern "builtin" unsigned int __cnttz8(unsigned long long); -extern "builtin" unsigned int __cntlz4(unsigned int); -extern "builtin" unsigned int __cntlz8(unsigned long long); - -// Builtin functions for counting population -#define __builtin_popcount(x) __popcnt4(x) -#define __builtin_popcountll(x) __popcnt8(x) -#if defined(__64BIT__) -#define __builtin_popcountl(x) __builtin_popcountll(x) -#else -#define __builtin_popcountl(x) __builtin_popcount(x) -#endif - -// Builtin functions for counting trailing zeros -#define __builtin_ctz(x) __cnttz4(x) -#define __builtin_ctzll(x) __cnttz8(x) -#if defined(__64BIT__) -#define __builtin_ctzl(x) __builtin_ctzll(x) -#else -#define __builtin_ctzl(x) __builtin_ctz(x) -#endif - -// Builtin functions for counting leading zeros -#define __builtin_clz(x) __cntlz4(x) -#define __builtin_clzll(x) __cntlz8(x) -#if defined(__64BIT__) -#define __builtin_clzl(x) __builtin_clzll(x) -#else -#define __builtin_clzl(x) __builtin_clz(x) -#endif - -#if defined(__64BIT__) -#define __SIZE_WIDTH__ 64 -#else -#define __SIZE_WIDTH__ 32 -#endif - -#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H diff --git a/gnu/llvm/libcxx/include/__support/nuttx/xlocale.h b/gnu/llvm/libcxx/include/__support/nuttx/xlocale.h deleted file mode 100644 index be738e3b64e..00000000000 --- a/gnu/llvm/libcxx/include/__support/nuttx/xlocale.h +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_NUTTX_XLOCALE_H -#define _LIBCPP_SUPPORT_NUTTX_XLOCALE_H - -#if defined(__NuttX__) -#include <__support/xlocale/__posix_l_fallback.h> -#include <__support/xlocale/__strtonum_fallback.h> -#endif // __NuttX__ - -#endif diff --git a/gnu/llvm/libcxx/include/__support/win32/limits_msvc_win32.h b/gnu/llvm/libcxx/include/__support/win32/limits_msvc_win32.h deleted file mode 100644 index c80df6693ce..00000000000 --- a/gnu/llvm/libcxx/include/__support/win32/limits_msvc_win32.h +++ /dev/null @@ -1,71 +0,0 @@ -// -*- C++ -*- -//===-----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H -#define _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H - -#if !defined(_LIBCPP_MSVCRT) -#error "This header complements the Microsoft C Runtime library, and should not be included otherwise." -#endif -#if defined(__clang__) -#error "This header should only be included when using Microsofts C1XX frontend" -#endif - -#include <float.h> // limit constants -#include <limits.h> // CHAR_BIT -#include <math.h> // HUGE_VAL -#include <ymath.h> // internal MSVC header providing the needed functionality - -#define __CHAR_BIT__ CHAR_BIT - -#define __FLT_MANT_DIG__ FLT_MANT_DIG -#define __FLT_DIG__ FLT_DIG -#define __FLT_RADIX__ FLT_RADIX -#define __FLT_MIN_EXP__ FLT_MIN_EXP -#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP -#define __FLT_MAX_EXP__ FLT_MAX_EXP -#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP -#define __FLT_MIN__ FLT_MIN -#define __FLT_MAX__ FLT_MAX -#define __FLT_EPSILON__ FLT_EPSILON -// predefined by MinGW GCC -#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F - -#define __DBL_MANT_DIG__ DBL_MANT_DIG -#define __DBL_DIG__ DBL_DIG -#define __DBL_RADIX__ DBL_RADIX -#define __DBL_MIN_EXP__ DBL_MIN_EXP -#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP -#define __DBL_MAX_EXP__ DBL_MAX_EXP -#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP -#define __DBL_MIN__ DBL_MIN -#define __DBL_MAX__ DBL_MAX -#define __DBL_EPSILON__ DBL_EPSILON -// predefined by MinGW GCC -#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L) - -#define __LDBL_MANT_DIG__ LDBL_MANT_DIG -#define __LDBL_DIG__ LDBL_DIG -#define __LDBL_RADIX__ LDBL_RADIX -#define __LDBL_MIN_EXP__ LDBL_MIN_EXP -#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP -#define __LDBL_MAX_EXP__ LDBL_MAX_EXP -#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP -#define __LDBL_MIN__ LDBL_MIN -#define __LDBL_MAX__ LDBL_MAX -#define __LDBL_EPSILON__ LDBL_EPSILON -// predefined by MinGW GCC -#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L - -// __builtin replacements/workarounds -#define __builtin_huge_vall() _LInf._Long_double -#define __builtin_nanl(__dummmy) _LNan._Long_double -#define __builtin_nansl(__dummy) _LSnan._Long_double - -#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_MSVC_WIN32_H diff --git a/gnu/llvm/libcxx/include/__tuple b/gnu/llvm/libcxx/include/__tuple deleted file mode 100644 index 4da9ec55f35..00000000000 --- a/gnu/llvm/libcxx/include/__tuple +++ /dev/null @@ -1,551 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___TUPLE -#define _LIBCPP___TUPLE - -#include <__config> -#include <cstddef> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size; - -#if !defined(_LIBCPP_CXX03_LANG) -template <class _Tp, class...> -using __enable_if_tuple_size_imp = _Tp; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< - const _Tp, - typename enable_if<!is_volatile<_Tp>::value>::type, - integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> - : public integral_constant<size_t, tuple_size<_Tp>::value> {}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< - volatile _Tp, - typename enable_if<!is_const<_Tp>::value>::type, - integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> - : public integral_constant<size_t, tuple_size<_Tp>::value> {}; - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS tuple_size<__enable_if_tuple_size_imp< - const volatile _Tp, - integral_constant<size_t, sizeof(tuple_size<_Tp>)>>> - : public integral_constant<size_t, tuple_size<_Tp>::value> {}; - -#else -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const _Tp> : public tuple_size<_Tp> {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<volatile _Tp> : public tuple_size<_Tp> {}; -template <class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_size<const volatile _Tp> : public tuple_size<_Tp> {}; -#endif - -template <size_t _Ip, class _Tp> struct _LIBCPP_TEMPLATE_VIS tuple_element; - -template <size_t _Ip, class _Tp> -struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const _Tp> -{ - typedef _LIBCPP_NODEBUG_TYPE typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type; -}; - -template <size_t _Ip, class _Tp> -struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, volatile _Tp> -{ - typedef _LIBCPP_NODEBUG_TYPE typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type; -}; - -template <size_t _Ip, class _Tp> -struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, const volatile _Tp> -{ - typedef _LIBCPP_NODEBUG_TYPE typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type; -}; - -template <class _Tp> struct __tuple_like : false_type {}; - -template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {}; -template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {}; -template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {}; - -// tuple specializations - -#ifndef _LIBCPP_CXX03_LANG - -template <size_t...> struct __tuple_indices {}; - -template <class _IdxType, _IdxType... _Values> -struct __integer_sequence { - template <template <class _OIdxType, _OIdxType...> class _ToIndexSeq, class _ToIndexType> - using __convert = _ToIndexSeq<_ToIndexType, _Values...>; - - template <size_t _Sp> - using __to_tuple_indices = __tuple_indices<(_Values + _Sp)...>; -}; - -#if !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) -namespace __detail { - -template<typename _Tp, size_t ..._Extra> struct __repeat; -template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> { - typedef _LIBCPP_NODEBUG_TYPE __integer_sequence<_Tp, - _Np..., - sizeof...(_Np) + _Np..., - 2 * sizeof...(_Np) + _Np..., - 3 * sizeof...(_Np) + _Np..., - 4 * sizeof...(_Np) + _Np..., - 5 * sizeof...(_Np) + _Np..., - 6 * sizeof...(_Np) + _Np..., - 7 * sizeof...(_Np) + _Np..., - _Extra...> type; -}; - -template<size_t _Np> struct __parity; -template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {}; - -template<> struct __make<0> { typedef __integer_sequence<size_t> type; }; -template<> struct __make<1> { typedef __integer_sequence<size_t, 0> type; }; -template<> struct __make<2> { typedef __integer_sequence<size_t, 0, 1> type; }; -template<> struct __make<3> { typedef __integer_sequence<size_t, 0, 1, 2> type; }; -template<> struct __make<4> { typedef __integer_sequence<size_t, 0, 1, 2, 3> type; }; -template<> struct __make<5> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4> type; }; -template<> struct __make<6> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; }; -template<> struct __make<7> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; }; - -template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; }; -template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; }; -template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<5> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; -template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; }; - -} // namespace detail - -#endif // !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE) - -#if __has_builtin(__make_integer_seq) -template <size_t _Ep, size_t _Sp> -using __make_indices_imp = - typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template - __to_tuple_indices<_Sp>; -#else -template <size_t _Ep, size_t _Sp> -using __make_indices_imp = - typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>; - -#endif - -template <size_t _Ep, size_t _Sp = 0> -struct __make_tuple_indices -{ - static_assert(_Sp <= _Ep, "__make_tuple_indices input error"); - typedef __make_indices_imp<_Ep, _Sp> type; -}; - - -template <class ..._Tp> class _LIBCPP_TEMPLATE_VIS tuple; - -template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {}; - -template <class ..._Tp> -struct _LIBCPP_TEMPLATE_VIS tuple_size<tuple<_Tp...> > - : public integral_constant<size_t, sizeof...(_Tp)> -{ -}; - -template <size_t _Ip, class ..._Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(tuple<_Tp...>&) _NOEXCEPT; - -template <size_t _Ip, class ..._Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -const typename tuple_element<_Ip, tuple<_Tp...> >::type& -get(const tuple<_Tp...>&) _NOEXCEPT; - -template <size_t _Ip, class ..._Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(tuple<_Tp...>&&) _NOEXCEPT; - -template <size_t _Ip, class ..._Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -const typename tuple_element<_Ip, tuple<_Tp...> >::type&& -get(const tuple<_Tp...>&&) _NOEXCEPT; - -#endif // !defined(_LIBCPP_CXX03_LANG) - -// pair specializations - -template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {}; - -template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(pair<_T1, _T2>&) _NOEXCEPT; - -template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -const typename tuple_element<_Ip, pair<_T1, _T2> >::type& -get(const pair<_T1, _T2>&) _NOEXCEPT; - -#ifndef _LIBCPP_CXX03_LANG -template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(pair<_T1, _T2>&&) _NOEXCEPT; - -template <size_t _Ip, class _T1, class _T2> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& -get(const pair<_T1, _T2>&&) _NOEXCEPT; -#endif - -// array specializations - -template <class _Tp, size_t _Size> struct _LIBCPP_TEMPLATE_VIS array; - -template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {}; - -template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -_Tp& -get(array<_Tp, _Size>&) _NOEXCEPT; - -template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -const _Tp& -get(const array<_Tp, _Size>&) _NOEXCEPT; - -#ifndef _LIBCPP_CXX03_LANG -template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -_Tp&& -get(array<_Tp, _Size>&&) _NOEXCEPT; - -template <size_t _Ip, class _Tp, size_t _Size> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 -const _Tp&& -get(const array<_Tp, _Size>&&) _NOEXCEPT; -#endif - -#ifndef _LIBCPP_CXX03_LANG - -// __tuple_types - -template <class ..._Tp> struct __tuple_types {}; - -#if !__has_builtin(__type_pack_element) - -namespace __indexer_detail { - -template <size_t _Idx, class _Tp> -struct __indexed { using type _LIBCPP_NODEBUG_TYPE = _Tp; }; - -template <class _Types, class _Indexes> struct __indexer; - -template <class ..._Types, size_t ..._Idx> -struct __indexer<__tuple_types<_Types...>, __tuple_indices<_Idx...>> - : __indexed<_Idx, _Types>... -{}; - -template <size_t _Idx, class _Tp> -__indexed<_Idx, _Tp> __at_index(__indexed<_Idx, _Tp> const&); - -} // namespace __indexer_detail - -template <size_t _Idx, class ..._Types> -using __type_pack_element _LIBCPP_NODEBUG_TYPE = typename decltype( - __indexer_detail::__at_index<_Idx>( - __indexer_detail::__indexer< - __tuple_types<_Types...>, - typename __make_tuple_indices<sizeof...(_Types)>::type - >{}) - )::type; -#endif - -template <size_t _Ip, class ..._Types> -struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, __tuple_types<_Types...>> -{ - static_assert(_Ip < sizeof...(_Types), "tuple_element index out of range"); - typedef _LIBCPP_NODEBUG_TYPE __type_pack_element<_Ip, _Types...> type; -}; - - -template <class ..._Tp> -struct _LIBCPP_TEMPLATE_VIS tuple_size<__tuple_types<_Tp...> > - : public integral_constant<size_t, sizeof...(_Tp)> -{ -}; - -template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {}; - -template <bool _ApplyLV, bool _ApplyConst, bool _ApplyVolatile> -struct __apply_cv_mf; -template <> -struct __apply_cv_mf<false, false, false> { - template <class _Tp> using __apply = _Tp; -}; -template <> -struct __apply_cv_mf<false, true, false> { - template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const _Tp; -}; -template <> -struct __apply_cv_mf<false, false, true> { - template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = volatile _Tp; -}; -template <> -struct __apply_cv_mf<false, true, true> { - template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const volatile _Tp; -}; -template <> -struct __apply_cv_mf<true, false, false> { - template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = _Tp&; -}; -template <> -struct __apply_cv_mf<true, true, false> { - template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const _Tp&; -}; -template <> -struct __apply_cv_mf<true, false, true> { - template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = volatile _Tp&; -}; -template <> -struct __apply_cv_mf<true, true, true> { - template <class _Tp> using __apply _LIBCPP_NODEBUG_TYPE = const volatile _Tp&; -}; -template <class _Tp, class _RawTp = typename remove_reference<_Tp>::type> -using __apply_cv_t _LIBCPP_NODEBUG_TYPE = __apply_cv_mf< - is_lvalue_reference<_Tp>::value, - is_const<_RawTp>::value, - is_volatile<_RawTp>::value>; - -// __make_tuple_types - -// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a -// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep). -// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a -// lvalue_reference type, then __tuple_types<_Types&...> is the result. - -template <class _TupleTypes, class _TupleIndices> -struct __make_tuple_types_flat; - -template <template <class...> class _Tuple, class ..._Types, size_t ..._Idx> -struct __make_tuple_types_flat<_Tuple<_Types...>, __tuple_indices<_Idx...>> { - // Specialization for pair, tuple, and __tuple_types - template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>> - using __apply_quals _LIBCPP_NODEBUG_TYPE = __tuple_types< - typename _ApplyFn::template __apply<__type_pack_element<_Idx, _Types...>>... - >; -}; - -template <class _Vt, size_t _Np, size_t ..._Idx> -struct __make_tuple_types_flat<array<_Vt, _Np>, __tuple_indices<_Idx...>> { - template <size_t> - using __value_type = _Vt; - template <class _Tp, class _ApplyFn = __apply_cv_t<_Tp>> - using __apply_quals = __tuple_types< - typename _ApplyFn::template __apply<__value_type<_Idx>>... - >; -}; - -template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, - size_t _Sp = 0, - bool _SameSize = (_Ep == tuple_size<typename remove_reference<_Tp>::type>::value)> -struct __make_tuple_types -{ - static_assert(_Sp <= _Ep, "__make_tuple_types input error"); - using _RawTp = typename remove_cv<typename remove_reference<_Tp>::type>::type; - using _Maker = __make_tuple_types_flat<_RawTp, typename __make_tuple_indices<_Ep, _Sp>::type>; - using type = typename _Maker::template __apply_quals<_Tp>; -}; - -template <class ..._Types, size_t _Ep> -struct __make_tuple_types<tuple<_Types...>, _Ep, 0, true> { - typedef _LIBCPP_NODEBUG_TYPE __tuple_types<_Types...> type; -}; - -template <class ..._Types, size_t _Ep> -struct __make_tuple_types<__tuple_types<_Types...>, _Ep, 0, true> { - typedef _LIBCPP_NODEBUG_TYPE __tuple_types<_Types...> type; -}; - -template <bool ..._Preds> -struct __all_dummy; - -template <bool ..._Pred> -using __all = _IsSame<__all_dummy<_Pred...>, __all_dummy<((void)_Pred, true)...>>; - -struct __tuple_sfinae_base { - template <template <class, class...> class _Trait, - class ..._LArgs, class ..._RArgs> - static auto __do_test(__tuple_types<_LArgs...>, __tuple_types<_RArgs...>) - -> __all<typename enable_if<_Trait<_LArgs, _RArgs>::value, bool>::type{true}...>; - template <template <class...> class> - static auto __do_test(...) -> false_type; - - template <class _FromArgs, class _ToArgs> - using __constructible = decltype(__do_test<is_constructible>(_ToArgs{}, _FromArgs{})); - template <class _FromArgs, class _ToArgs> - using __convertible = decltype(__do_test<is_convertible>(_FromArgs{}, _ToArgs{})); - template <class _FromArgs, class _ToArgs> - using __assignable = decltype(__do_test<is_assignable>(_ToArgs{}, _FromArgs{})); -}; - -// __tuple_convertible - -template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, - bool = __tuple_like<_Up>::value> -struct __tuple_convertible - : public false_type {}; - -template <class _Tp, class _Up> -struct __tuple_convertible<_Tp, _Up, true, true> - : public __tuple_sfinae_base::__convertible< - typename __make_tuple_types<_Tp>::type - , typename __make_tuple_types<_Up>::type - > -{}; - -// __tuple_constructible - -template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, - bool = __tuple_like<_Up>::value> -struct __tuple_constructible - : public false_type {}; - -template <class _Tp, class _Up> -struct __tuple_constructible<_Tp, _Up, true, true> - : public __tuple_sfinae_base::__constructible< - typename __make_tuple_types<_Tp>::type - , typename __make_tuple_types<_Up>::type - > -{}; - -// __tuple_assignable - -template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value, - bool = __tuple_like<_Up>::value> -struct __tuple_assignable - : public false_type {}; - -template <class _Tp, class _Up> -struct __tuple_assignable<_Tp, _Up, true, true> - : public __tuple_sfinae_base::__assignable< - typename __make_tuple_types<_Tp>::type - , typename __make_tuple_types<_Up&>::type - > -{}; - - -template <size_t _Ip, class ..._Tp> -struct _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, tuple<_Tp...> > -{ - typedef _LIBCPP_NODEBUG_TYPE typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type; -}; - -#if _LIBCPP_STD_VER > 11 -template <size_t _Ip, class ..._Tp> -using tuple_element_t _LIBCPP_NODEBUG_TYPE = typename tuple_element <_Ip, _Tp...>::type; -#endif - -template <bool _IsTuple, class _SizeTrait, size_t _Expected> -struct __tuple_like_with_size_imp : false_type {}; - -template <class _SizeTrait, size_t _Expected> -struct __tuple_like_with_size_imp<true, _SizeTrait, _Expected> - : integral_constant<bool, _SizeTrait::value == _Expected> {}; - -template <class _Tuple, size_t _ExpectedSize, - class _RawTuple = typename __uncvref<_Tuple>::type> -using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __tuple_like_with_size_imp< - __tuple_like<_RawTuple>::value, - tuple_size<_RawTuple>, _ExpectedSize - >; - -struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail { - - static constexpr bool __enable_explicit_default() { return false; } - static constexpr bool __enable_implicit_default() { return false; } - template <class ...> - static constexpr bool __enable_explicit() { return false; } - template <class ...> - static constexpr bool __enable_implicit() { return false; } - template <class ...> - static constexpr bool __enable_assign() { return false; } -}; -#endif // !defined(_LIBCPP_CXX03_LANG) - -#if _LIBCPP_STD_VER > 14 - -template <bool _CanCopy, bool _CanMove> -struct __sfinae_ctor_base {}; -template <> -struct __sfinae_ctor_base<false, false> { - __sfinae_ctor_base() = default; - __sfinae_ctor_base(__sfinae_ctor_base const&) = delete; - __sfinae_ctor_base(__sfinae_ctor_base &&) = delete; - __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; - __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; -}; -template <> -struct __sfinae_ctor_base<true, false> { - __sfinae_ctor_base() = default; - __sfinae_ctor_base(__sfinae_ctor_base const&) = default; - __sfinae_ctor_base(__sfinae_ctor_base &&) = delete; - __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; - __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; -}; -template <> -struct __sfinae_ctor_base<false, true> { - __sfinae_ctor_base() = default; - __sfinae_ctor_base(__sfinae_ctor_base const&) = delete; - __sfinae_ctor_base(__sfinae_ctor_base &&) = default; - __sfinae_ctor_base& operator=(__sfinae_ctor_base const&) = default; - __sfinae_ctor_base& operator=(__sfinae_ctor_base&&) = default; -}; - -template <bool _CanCopy, bool _CanMove> -struct __sfinae_assign_base {}; -template <> -struct __sfinae_assign_base<false, false> { - __sfinae_assign_base() = default; - __sfinae_assign_base(__sfinae_assign_base const&) = default; - __sfinae_assign_base(__sfinae_assign_base &&) = default; - __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; - __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete; -}; -template <> -struct __sfinae_assign_base<true, false> { - __sfinae_assign_base() = default; - __sfinae_assign_base(__sfinae_assign_base const&) = default; - __sfinae_assign_base(__sfinae_assign_base &&) = default; - __sfinae_assign_base& operator=(__sfinae_assign_base const&) = default; - __sfinae_assign_base& operator=(__sfinae_assign_base&&) = delete; -}; -template <> -struct __sfinae_assign_base<false, true> { - __sfinae_assign_base() = default; - __sfinae_assign_base(__sfinae_assign_base const&) = default; - __sfinae_assign_base(__sfinae_assign_base &&) = default; - __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; - __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default; -}; -#endif // _LIBCPP_STD_VER > 14 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___TUPLE diff --git a/gnu/llvm/libcxx/include/__utility/__decay_copy.h b/gnu/llvm/libcxx/include/__utility/__decay_copy.h deleted file mode 100644 index eda8db6a60f..00000000000 --- a/gnu/llvm/libcxx/include/__utility/__decay_copy.h +++ /dev/null @@ -1,39 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___TYPE_TRAITS_DECAY_COPY_H -#define _LIBCPP___TYPE_TRAITS_DECAY_COPY_H - -#include <__config> -#include <__utility/forward.h> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY typename decay<_Tp>::type __decay_copy(_Tp&& __t) -#if _LIBCPP_STD_VER > 17 - noexcept(is_nothrow_convertible_v<_Tp, remove_reference_t<_Tp> >) -#endif -{ - return _VSTD::forward<_Tp>(__t); -} - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___TYPE_TRAITS_DECAY_COPY_H diff --git a/gnu/llvm/libcxx/include/algorithm b/gnu/llvm/libcxx/include/algorithm index 60c5cabc078..cb2d27cbc80 100644 --- a/gnu/llvm/libcxx/include/algorithm +++ b/gnu/llvm/libcxx/include/algorithm @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-------------------------- algorithm ---------------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -19,7 +19,60 @@ namespace std { namespace ranges { - template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> + + // [algorithms.results], algorithm result types + template <class I, class F> + struct in_fun_result; // since C++20 + + template <class I1, class I2> + struct in_in_result; // since C++20 + + template <class I, class O> + struct in_out_result; // since C++20 + + template <class I1, class I2, class O> + struct in_in_out_result; // since C++20 + + template <class I, class O1, class O2> + struct in_out_out_result; // since C++20 + + template <class I1, class I2> + struct min_max_result; // since C++20 + + template <class I> + struct in_found_result; // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 + constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); + + template<forward_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 + constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {}); + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> + constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<class I1, class I2> + using mismatch_result = in_in_result<I1, I2>; + + template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr mismatch_result<_I1, _I2> + mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 + + template <input_range R1, input_range R2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> + mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 + requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 @@ -45,6 +98,958 @@ namespace ranges { indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr borrowed_iterator_t<R> find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<class T, class Proj = identity, + indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> + constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + + template<copyable T, class Proj = identity, + indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> + constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> + constexpr range_value_t<R> + min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<class T, class Proj = identity, + indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> + constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + + template<copyable T, class Proj = identity, + indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> + constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> + constexpr range_value_t<R> + max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<class I, class O> + using unary_transform_result = in_out_result<I, O>; // since C++20 + + template<class I1, class I2, class O> + using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 + + template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, + copy_constructible F, class Proj = identity> + requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>> + constexpr ranges::unary_transform_result<I, O> + transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 + + template<input_range R, weakly_incrementable O, copy_constructible F, + class Proj = identity> + requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>> + constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O> + transform(R&& r, O result, F op, Proj proj = {}); // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + weakly_incrementable O, copy_constructible F, class Proj1 = identity, + class Proj2 = identity> + requires indirectly_writable<O, indirect_result_t<F&, projected<I1, Proj1>, + projected<I2, Proj2>>> + constexpr ranges::binary_transform_result<I1, I2, O> + transform(I1 first1, S1 last1, I2 first2, S2 last2, O result, + F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, input_range R2, weakly_incrementable O, + copy_constructible F, class Proj1 = identity, class Proj2 = identity> + requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R1>, Proj1>, + projected<iterator_t<R2>, Proj2>>> + constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> + transform(R1&& r1, R2&& r2, O result, + F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> + constexpr iter_difference_t<I> + count(I first, S last, const T& value, Proj proj = {}); // since C++20 + + template<input_range R, class T, class Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> + constexpr range_difference_t<R> + count(R&& r, const T& value, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr iter_difference_t<I> + count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr range_difference_t<R> + count_if(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<class T> + using minmax_result = min_max_result<T>; + + template<class T, class Proj = identity, + indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> + constexpr ranges::minmax_result<const T&> + minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + + template<copyable T, class Proj = identity, + indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> + constexpr ranges::minmax_result<T> + minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> + constexpr ranges::minmax_result<range_value_t<R>> + minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<class I> + using minmax_element_result = min_max_result<I>; + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> + constexpr ranges::minmax_element_result<I> + minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + constexpr ranges::minmax_element_result<borrowed_iterator_t<R>> + minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<class I, class O> + using copy_result = in_out_result<I, O>; // since C++20 + + template<class I, class O> + using copy_n_result = in_out_result<I, O>; // since C++20 + + template<class I, class O> + using copy_if_result = in_out_result<I, O>; // since C++20 + + template<class I1, class I2> + using copy_backward_result = in_out_result<I1, I2>; // since C++20 + + template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> + requires indirectly_copyable<I, O> + constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result); // since C++20 + + template<input_range R, weakly_incrementable O> + requires indirectly_copyable<iterator_t<R>, O> + constexpr ranges::copy_result<borrowed_iterator_t<R>, O> ranges::copy(R&& r, O result); // since C++20 + + template<input_iterator I, weakly_incrementable O> + requires indirectly_copyable<I, O> + constexpr ranges::copy_n_result<I, O> + ranges::copy_n(I first, iter_difference_t<I> n, O result); // since C++20 + + template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + requires indirectly_copyable<I, O> + constexpr ranges::copy_if_result<I, O> + ranges::copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, weakly_incrementable O, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + requires indirectly_copyable<iterator_t<R>, O> + constexpr ranges::copy_if_result<borrowed_iterator_t<R>, O> + ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20 + + template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> + requires indirectly_copyable<I1, I2> + constexpr ranges::copy_backward_result<I1, I2> + ranges::copy_backward(I1 first, S1 last, I2 result); // since C++20 + + template<bidirectional_range R, bidirectional_iterator I> + requires indirectly_copyable<iterator_t<R>, I> + constexpr ranges::copy_backward_result<borrowed_iterator_t<R>, I> + ranges::copy_backward(R&& r, I result); // since C++20 + + template<class I, class F> + using for_each_result = in_fun_result<I, F>; // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirectly_unary_invocable<projected<I, Proj>> Fun> + constexpr ranges::for_each_result<I, Fun> + ranges::for_each(I first, S last, Fun f, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirectly_unary_invocable<projected<iterator_t<R>, Proj>> Fun> + constexpr ranges::for_each_result<borrowed_iterator_t<R>, Fun> + ranges::for_each(R&& r, Fun f, Proj proj = {}); // since C++20 + + template<input_iterator I, class Proj = identity, + indirectly_unary_invocable<projected<I, Proj>> Fun> + constexpr ranges::for_each_n_result<I, Fun> + ranges::for_each_n(I first, iter_difference_t<I> n, Fun f, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr bool ranges::is_partitioned(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr bool ranges::is_partitioned(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr I + ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr borrowed_iterator_t<R> + ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr I + ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr borrowed_iterator_t<R> + ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr I + ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr borrowed_iterator_t<R> + ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr I + ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr borrowed_iterator_t<R> + ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> + constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + + template<random_access_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> + constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + + template<random_access_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + constexpr borrowed_iterator_t<R> + is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + + template<bidirectional_iterator I, sentinel_for<I> S> + requires permutable<I> + constexpr I ranges::reverse(I first, S last); // since C++20 + + template<bidirectional_range R> + requires permutable<iterator_t<R>> + constexpr borrowed_iterator_t<R> ranges::reverse(R&& r); // since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr I + ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr borrowed_iterator_t<R> + ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + borrowed_iterator_t<R> + ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr I + ranges::partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr borrowed_iterator_t<R> + ranges::partial_sort(R&& r, iterator_t<R> middle, Comp comp = {}, Proj proj = {}); // since C++20 + + template<class T, output_iterator<const T&> O, sentinel_for<O> S> + constexpr O ranges::fill(O first, S last, const T& value); // since C++20 + + template<class T, output_range<const T&> R> + constexpr borrowed_iterator_t<R> ranges::fill(R&& r, const T& value); // since C++20 + + template<class T, output_iterator<const T&> O> + constexpr O ranges::fill_n(O first, iter_difference_t<O> n, const T& value); // since C++20 + + template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F> + requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> + constexpr O generate(O first, S last, F gen); // Since C++20 + + template<class R, copy_constructible F> + requires invocable<F&> && output_range<R, invoke_result_t<F&>> + constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // Since C++20 + + template<input_or_output_iterator O, copy_constructible F> + requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> + constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // Since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr bool ranges::equal(I1 first1, S1 last1, I2 first2, S2 last2, + Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, input_range R2, class Pred = ranges::equal_to, + class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr bool ranges::equal(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<input_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, + random_access_iterator I2, sentinel_for<I2> S2, + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> + requires indirectly_copyable<I1, I2> && sortable<I2, Comp, Proj2> && + indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>> + constexpr partial_sort_copy_result<I1, I2> + partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + + template<input_range R1, random_access_range R2, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires indirectly_copyable<iterator_t<R1>, iterator_t<R2>> && + sortable<iterator_t<R2>, Comp, Proj2> && + indirect_strict_weak_order<Comp, projected<iterator_t<R1>, Proj1>, + projected<iterator_t<R2>, Proj2>> + constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> + partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> + constexpr bool ranges::is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + constexpr bool ranges::is_sorted(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> + constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class Proj = identity, + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> + constexpr borrowed_iterator_t<R> + ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr I + ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20 + + template<random_access_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr borrowed_iterator_t<R> + ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> + constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = + ranges::less> + constexpr borrowed_iterator_t<R> + upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> + constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, + Proj proj = {}); // since C++20 + template<forward_range R, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = + ranges::less> + constexpr borrowed_iterator_t<R> + lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> + constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, + Proj proj = {}); // since C++20 + + template<forward_range R, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = + ranges::less> + constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, + Proj proj = {}); // since C++20 + + template<permutable I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr subrange<I> + partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20 + + template<forward_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + requires permutable<iterator_t<R>> + constexpr borrowed_subrange_t<R> + partition(R&& r, Pred pred, Proj proj = {}); // Since C++20 + + template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + requires permutable<I> + subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20 + + template<bidirectional_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + requires permutable<iterator_t<R>> + borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // Since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr I1 ranges::find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, + Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, forward_range R2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr borrowed_iterator_t<R1> + ranges::find_first_of(R1&& r1, R2&& r2, + Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_binary_predicate<projected<I, Proj>, + projected<I, Proj>> Pred = ranges::equal_to> + constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C+20 + + template<forward_range R, class Proj = identity, + indirect_binary_predicate<projected<iterator_t<R>, Proj>, + projected<iterator_t<R>, Proj>> Pred = ranges::equal_to> + constexpr borrowed_iterator_t<R> ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class T1, class T2, class Proj = identity> + requires indirectly_writable<I, const T2&> && + indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> + constexpr I + ranges::replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 + + template<input_range R, class T1, class T2, class Proj = identity> + requires indirectly_writable<iterator_t<R>, const T2&> && + indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T1*> + constexpr borrowed_iterator_t<R> + ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); // since C++20 + + template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + requires indirectly_writable<I, const T&> + constexpr I ranges::replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); // since C++20 + + template<input_range R, class T, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + requires indirectly_writable<iterator_t<R>, const T&> + constexpr borrowed_iterator_t<R> + ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); // since C++20 + + template<class T, class Proj = identity, + indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> + constexpr const T& + ranges::clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + class Proj1 = identity, class Proj2 = identity, + indirect_strict_weak_order<projected<I1, Proj1>, + projected<I2, Proj2>> Comp = ranges::less> + constexpr bool + ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, input_range R2, class Proj1 = identity, + class Proj2 = identity, + indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, + projected<iterator_t<R2>, Proj2>> Comp = ranges::less> + constexpr bool + ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> + requires indirectly_movable<I1, I2> + constexpr ranges::move_backward_result<I1, I2> + ranges::move_backward(I1 first, S1 last, I2 result); // since C++20 + + template<bidirectional_range R, bidirectional_iterator I> + requires indirectly_movable<iterator_t<R>, I> + constexpr ranges::move_backward_result<borrowed_iterator_t<R>, I> + ranges::move_backward(R&& r, I result); // since C++20 + + template<input_iterator I, sentinel_for<I> S, weakly_incrementable O> + requires indirectly_movable<I, O> + constexpr ranges::move_result<I, O> + ranges::move(I first, S last, O result); // since C++20 + + template<input_range R, weakly_incrementable O> + requires indirectly_movable<iterator_t<R>, O> + constexpr ranges::move_result<borrowed_iterator_t<R>, O> + ranges::move(R&& r, O result); // since C++20 + + template<class I, class O1, class O2> + using partition_copy_result = in_out_out_result<I, O1, O2>; // since C++20 + + template<input_iterator I, sentinel_for<I> S, + weakly_incrementable O1, weakly_incrementable O2, + class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> + requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2> + constexpr partition_copy_result<I, O1, O2> + partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred, + Proj proj = {}); // Since C++20 + + template<input_range R, weakly_incrementable O1, weakly_incrementable O2, + class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + requires indirectly_copyable<iterator_t<R>, O1> && + indirectly_copyable<iterator_t<R>, O2> + constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2> + partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // Since C++20 + + template<forward_iterator I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // Since C++20 + + template<forward_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + constexpr borrowed_iterator_t<R> + partition_point(R&& r, Pred pred, Proj proj = {}); // Since C++20 + + template<class I1, class I2, class O> + using merge_result = in_in_out_result<I1, I2, O>; // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity, + class Proj2 = identity> + requires mergeable<I1, I2, O, Comp, Proj1, Proj2> + constexpr merge_result<I1, I2, O> + merge(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, input_range R2, weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> + constexpr merge_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> + merge(R1&& r1, R2&& r2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<permutable I, sentinel_for<I> S, class T, class Proj = identity> + requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> + constexpr subrange<I> ranges::remove(I first, S last, const T& value, Proj proj = {}); // since C++20 + + template<forward_range R, class T, class Proj = identity> + requires permutable<iterator_t<R>> && + indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> + constexpr borrowed_subrange_t<R> + ranges::remove(R&& r, const T& value, Proj proj = {}); // since C++20 + + template<permutable I, sentinel_for<I> S, class Proj = identity, + indirect_unary_predicate<projected<I, Proj>> Pred> + constexpr subrange<I> ranges::remove_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 + + template<forward_range R, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + requires permutable<iterator_t<R>> + constexpr borrowed_subrange_t<R> + ranges::remove_if(R&& r, Pred pred, Proj proj = {}); // since C++20 + + template<class I, class O> + using set_difference_result = in_out_result<I, O>; // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable<I1, I2, O, Comp, Proj1, Proj2> + constexpr set_difference_result<I1, O> + set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, input_range R2, weakly_incrementable O, + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> + requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> + constexpr set_difference_result<borrowed_iterator_t<R1>, O> + set_difference(R1&& r1, R2&& r2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<class I1, class I2, class O> + using set_intersection_result = in_in_out_result<I1, I2, O>; // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable<I1, I2, O, Comp, Proj1, Proj2> + constexpr set_intersection_result<I1, I2, O> + set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable<I1, I2, O, Comp, Proj1, Proj2> + constexpr set_intersection_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> + set_intersection(R1&& r1, R2&& r2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template <class _InIter, class _OutIter> + using reverse_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 + + template<bidirectional_iterator I, sentinel_for<I> S, weakly_incrementable O> + requires indirectly_copyable<I, O> + constexpr ranges::reverse_copy_result<I, O> + ranges::reverse_copy(I first, S last, O result); // since C++20 + + template<bidirectional_range R, weakly_incrementable O> + requires indirectly_copyable<iterator_t<R>, O> + constexpr ranges::reverse_copy_result<borrowed_iterator_t<R>, O> + ranges::reverse_copy(R&& r, O result); // since C++20 + + template<permutable I, sentinel_for<I> S> + constexpr subrange<I> rotate(I first, I middle, S last); // since C++20 + + template<forward_range R> + requires permutable<iterator_t<R>> + constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // Since C++20 + + template <class _InIter, class _OutIter> + using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 + + template<forward_iterator I, sentinel_for<I> S, weakly_incrementable O> + requires indirectly_copyable<I, O> + constexpr ranges::rotate_copy_result<I, O> + ranges::rotate_copy(I first, I middle, S last, O result); // since C++20 + + template<forward_range R, weakly_incrementable O> + requires indirectly_copyable<iterator_t<R>, O> + constexpr ranges::rotate_copy_result<borrowed_iterator_t<R>, O> + ranges::rotate_copy(R&& r, iterator_t<R> middle, O result); // since C++20 + + template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Gen> + requires (forward_iterator<I> || random_access_iterator<O>) && + indirectly_copyable<I, O> && + uniform_random_bit_generator<remove_reference_t<Gen>> + O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // Since C++20 + + template<input_range R, weakly_incrementable O, class Gen> + requires (forward_range<R> || random_access_iterator<O>) && + indirectly_copyable<iterator_t<R>, O> && + uniform_random_bit_generator<remove_reference_t<Gen>> + O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // Since C++20 + + template<random_access_iterator I, sentinel_for<I> S, class Gen> + requires permutable<I> && + uniform_random_bit_generator<remove_reference_t<Gen>> + I shuffle(I first, S last, Gen&& g); // Since C++20 + + template<random_access_range R, class Gen> + requires permutable<iterator_t<R>> && + uniform_random_bit_generator<remove_reference_t<Gen>> + borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // Since C++20 + + template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, + sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity, + indirect_equivalence_relation<projected<I1, Proj1>, + projected<I2, Proj2>> Pred = ranges::equal_to> + constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2, + Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + + template<forward_range R1, forward_range R2, + class Proj1 = identity, class Proj2 = identity, + indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>, + projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to> + constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + + template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, + sentinel_for<I2> S2, class Pred = ranges::equal_to, + class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr subrange<I1> + ranges::search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<forward_range R1, forward_range R2, class Pred = ranges::equal_to, + class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr borrowed_subrange_t<R1> + ranges::search(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class T, + class Pred = ranges::equal_to, class Proj = identity> + requires indirectly_comparable<I, const T*, Pred, Proj> + constexpr subrange<I> + ranges::search_n(I first, S last, iter_difference_t<I> count, + const T& value, Pred pred = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class T, class Pred = ranges::equal_to, + class Proj = identity> + requires indirectly_comparable<iterator_t<R>, const T*, Pred, Proj> + constexpr borrowed_subrange_t<R> + ranges::search_n(R&& r, range_difference_t<R> count, + const T& value, Pred pred = {}, Proj proj = {}); // since C++20 + + template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> + constexpr subrange<I1> + ranges::find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<forward_range R1, forward_range R2, + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> + requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> + constexpr borrowed_subrange_t<R1> + ranges::find_end(R1&& r1, R2&& r2, Pred pred = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<class I1, class I2, class O> + using set_symmetric_difference_result = in_in_out_result<I1, I2, O>; // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable<I1, I2, O, Comp, Proj1, Proj2> + constexpr set_symmetric_difference_result<I1, I2, O> + set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, + Proj2 proj2 = {}); // since C++20 + + template<input_range R1, input_range R2, weakly_incrementable O, + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> + requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> + constexpr set_symmetric_difference_result<borrowed_iterator_t<R1>, + borrowed_iterator_t<R2>, O> + set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> + constexpr subrange<I> + equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + + template<forward_range R, class T, class Proj = identity, + indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = + ranges::less> + constexpr borrowed_subrange_t<R> + equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + + template<class I1, class I2, class O> + using set_union_result = in_in_out_result<I1, I2, O>; // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable<I1, I2, O, Comp, Proj1, Proj2> + constexpr set_union_result<I1, I2, O> + set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_range R1, input_range R2, weakly_incrementable O, + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> + requires mergeable<iterator_t<R1>, iterator_t<R2>, O, Comp, Proj1, Proj2> + constexpr set_union_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> + set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + + template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, + class Proj1 = identity, class Proj2 = identity, + indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp = + ranges::less> + constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + + template<input_range R1, input_range R2, class Proj1 = identity, + class Proj2 = identity, + indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, + projected<iterator_t<R2>, Proj2>> Comp = ranges::less> + constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + + template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + + template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + borrowed_iterator_t<R> + inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, + Proj proj = {}); // Since C++20 + + template<permutable I, sentinel_for<I> S, class Proj = identity, + indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> + constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // Since C++20 + + template<forward_range R, class Proj = identity, + indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> + requires permutable<iterator_t<R>> + constexpr borrowed_subrange_t<R> + unique(R&& r, C comp = {}, Proj proj = {}); // Since C++20 + + template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, + indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> + requires indirectly_copyable<I, O> && + (forward_iterator<I> || + (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) || + indirectly_copyable_storable<I, O>) + constexpr unique_copy_result<I, O> + unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // Since C++20 + + template<input_range R, weakly_incrementable O, class Proj = identity, + indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> + requires indirectly_copyable<iterator_t<R>, O> && + (forward_iterator<iterator_t<R>> || + (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) || + indirectly_copyable_storable<iterator_t<R>, O>) + constexpr unique_copy_result<borrowed_iterator_t<R>, O> + unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // Since C++20 + + template<class I, class O> + using remove_copy_result = in_out_result<I, O>; // Since C++20 + + template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T, + class Proj = identity> + indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> + constexpr remove_copy_result<I, O> + remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // Since C++20 + + template<input_range R, weakly_incrementable O, class T, class Proj = identity> + requires indirectly_copyable<iterator_t<R>, O> && + indirect_binary_predicate<ranges::equal_to, + projected<iterator_t<R>, Proj>, const T*> + constexpr remove_copy_result<borrowed_iterator_t<R>, O> + remove_copy(R&& r, O result, const T& value, Proj proj = {}); // Since C++20 + + template<class I, class O> + using remove_copy_if_result = in_out_result<I, O>; // Since C++20 + + template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, + class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> + requires indirectly_copyable<I, O> + constexpr remove_copy_if_result<I, O> + remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // Since C++20 + + template<input_range R, weakly_incrementable O, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + requires indirectly_copyable<iterator_t<R>, O> + constexpr remove_copy_if_result<borrowed_iterator_t<R>, O> + remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // Since C++20 + + template<class I, class O> + using replace_copy_result = in_out_result<I, O>; // Since C++20 + + template<input_iterator I, sentinel_for<I> S, class T1, class T2, + output_iterator<const T2&> O, class Proj = identity> + requires indirectly_copyable<I, O> && + indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> + constexpr replace_copy_result<I, O> + replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, + Proj proj = {}); // Since C++20 + + template<input_range R, class T1, class T2, output_iterator<const T2&> O, + class Proj = identity> + requires indirectly_copyable<iterator_t<R>, O> && + indirect_binary_predicate<ranges::equal_to, + projected<iterator_t<R>, Proj>, const T1*> + constexpr replace_copy_result<borrowed_iterator_t<R>, O> + replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, + Proj proj = {}); // Since C++20 + + template<class I, class O> + using replace_copy_if_result = in_out_result<I, O>; // Since C++20 + + template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O, + class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> + requires indirectly_copyable<I, O> + constexpr replace_copy_if_result<I, O> + replace_copy_if(I first, S last, O result, Pred pred, const T& new_value, + Proj proj = {}); // Since C++20 + + template<input_range R, class T, output_iterator<const T&> O, class Proj = identity, + indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> + requires indirectly_copyable<iterator_t<R>, O> + constexpr replace_copy_if_result<borrowed_iterator_t<R>, O> + replace_copy_if(R&& r, O result, Pred pred, const T& new_value, + Proj proj = {}); // Since C++20 + + template<class I> + using prev_permutation_result = in_found_result<I>; // Since C++20 + + template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr ranges::prev_permutation_result<I> + ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + + template<bidirectional_range R, class Comp = ranges::less, + class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>> + ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + + template<class I> + using next_permutation_result = in_found_result<I>; // Since C++20 + + template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, + class Proj = identity> + requires sortable<I, Comp, Proj> + constexpr ranges::next_permutation_result<I> + ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + + template<bidirectional_range R, class Comp = ranges::less, + class Proj = identity> + requires sortable<iterator_t<R>, Comp, Proj> + constexpr ranges::next_permutation_result<borrowed_iterator_t<R>> + ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + } template <class InputIterator, class Predicate> @@ -213,10 +1218,35 @@ template <class BidirectionalIterator1, class BidirectionalIterator2> copy_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, BidirectionalIterator2 result); +// [alg.move], move +template<class InputIterator, class OutputIterator> + constexpr OutputIterator move(InputIterator first, InputIterator last, + OutputIterator result); + +template<class BidirectionalIterator1, class BidirectionalIterator2> + constexpr BidirectionalIterator2 + move_backward(BidirectionalIterator1 first, BidirectionalIterator1 last, + BidirectionalIterator2 result); + template <class ForwardIterator1, class ForwardIterator2> constexpr ForwardIterator2 // constexpr in C++20 swap_ranges(ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2); +namespace ranges { + template<class I1, class I2> + using swap_ranges_result = in_in_result<I1, I2>; + +template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2> + requires indirectly_swappable<I1, I2> + constexpr ranges::swap_ranges_result<I1, I2> + swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); + +template<input_range R1, input_range R2> + requires indirectly_swappable<iterator_t<R1>, iterator_t<R2>> + constexpr ranges::swap_ranges_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> + swap_ranges(R1&& r1, R2&& r2); +} + template <class ForwardIterator1, class ForwardIterator2> constexpr void // constexpr in C++20 iter_swap(ForwardIterator1 a, ForwardIterator2 b); @@ -669,24 +1699,15 @@ template <class BidirectionalIterator> template <class BidirectionalIterator, class Compare> constexpr bool // constexpr in C++20 prev_permutation(BidirectionalIterator first, BidirectionalIterator last, Compare comp); - } // std */ +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> -#include <__bits> // __libcpp_clz #include <cstddef> -#include <cstring> -#include <functional> -#include <initializer_list> -#include <utility> // needed to provide swap_ranges. -#include <memory> -#include <iterator> -#include <memory> #include <type_traits> -#include <utility> // swap_ranges #include <version> #include <__algorithm/adjacent_find.h> @@ -704,8 +1725,8 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/count_if.h> #include <__algorithm/equal.h> #include <__algorithm/equal_range.h> -#include <__algorithm/fill_n.h> #include <__algorithm/fill.h> +#include <__algorithm/fill_n.h> #include <__algorithm/find.h> #include <__algorithm/find_end.h> #include <__algorithm/find_first_of.h> @@ -713,9 +1734,15 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/find_if_not.h> #include <__algorithm/for_each.h> #include <__algorithm/for_each_n.h> -#include <__algorithm/generate_n.h> #include <__algorithm/generate.h> +#include <__algorithm/generate_n.h> #include <__algorithm/half_positive.h> +#include <__algorithm/in_found_result.h> +#include <__algorithm/in_fun_result.h> +#include <__algorithm/in_in_out_result.h> +#include <__algorithm/in_in_result.h> +#include <__algorithm/in_out_out_result.h> +#include <__algorithm/in_out_result.h> #include <__algorithm/includes.h> #include <__algorithm/inplace_merge.h> #include <__algorithm/is_heap.h> @@ -733,6 +1760,7 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/merge.h> #include <__algorithm/min.h> #include <__algorithm/min_element.h> +#include <__algorithm/min_max_result.h> #include <__algorithm/minmax.h> #include <__algorithm/minmax_element.h> #include <__algorithm/mismatch.h> @@ -749,9 +1777,91 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/pop_heap.h> #include <__algorithm/prev_permutation.h> #include <__algorithm/push_heap.h> +#include <__algorithm/ranges_adjacent_find.h> +#include <__algorithm/ranges_all_of.h> +#include <__algorithm/ranges_any_of.h> +#include <__algorithm/ranges_binary_search.h> +#include <__algorithm/ranges_clamp.h> +#include <__algorithm/ranges_copy.h> +#include <__algorithm/ranges_copy_backward.h> +#include <__algorithm/ranges_copy_if.h> +#include <__algorithm/ranges_copy_n.h> +#include <__algorithm/ranges_count.h> +#include <__algorithm/ranges_count_if.h> +#include <__algorithm/ranges_equal.h> +#include <__algorithm/ranges_equal_range.h> +#include <__algorithm/ranges_fill.h> +#include <__algorithm/ranges_fill_n.h> #include <__algorithm/ranges_find.h> +#include <__algorithm/ranges_find_end.h> +#include <__algorithm/ranges_find_first_of.h> #include <__algorithm/ranges_find_if.h> #include <__algorithm/ranges_find_if_not.h> +#include <__algorithm/ranges_for_each.h> +#include <__algorithm/ranges_for_each_n.h> +#include <__algorithm/ranges_generate.h> +#include <__algorithm/ranges_generate_n.h> +#include <__algorithm/ranges_includes.h> +#include <__algorithm/ranges_inplace_merge.h> +#include <__algorithm/ranges_is_heap.h> +#include <__algorithm/ranges_is_heap_until.h> +#include <__algorithm/ranges_is_partitioned.h> +#include <__algorithm/ranges_is_permutation.h> +#include <__algorithm/ranges_is_sorted.h> +#include <__algorithm/ranges_is_sorted_until.h> +#include <__algorithm/ranges_lexicographical_compare.h> +#include <__algorithm/ranges_lower_bound.h> +#include <__algorithm/ranges_make_heap.h> +#include <__algorithm/ranges_max.h> +#include <__algorithm/ranges_max_element.h> +#include <__algorithm/ranges_merge.h> +#include <__algorithm/ranges_min.h> +#include <__algorithm/ranges_min_element.h> +#include <__algorithm/ranges_minmax.h> +#include <__algorithm/ranges_minmax_element.h> +#include <__algorithm/ranges_mismatch.h> +#include <__algorithm/ranges_move.h> +#include <__algorithm/ranges_move_backward.h> +#include <__algorithm/ranges_next_permutation.h> +#include <__algorithm/ranges_none_of.h> +#include <__algorithm/ranges_nth_element.h> +#include <__algorithm/ranges_partial_sort.h> +#include <__algorithm/ranges_partial_sort_copy.h> +#include <__algorithm/ranges_partition.h> +#include <__algorithm/ranges_partition_copy.h> +#include <__algorithm/ranges_partition_point.h> +#include <__algorithm/ranges_pop_heap.h> +#include <__algorithm/ranges_prev_permutation.h> +#include <__algorithm/ranges_push_heap.h> +#include <__algorithm/ranges_remove.h> +#include <__algorithm/ranges_remove_copy.h> +#include <__algorithm/ranges_remove_copy_if.h> +#include <__algorithm/ranges_remove_if.h> +#include <__algorithm/ranges_replace.h> +#include <__algorithm/ranges_replace_copy.h> +#include <__algorithm/ranges_replace_copy_if.h> +#include <__algorithm/ranges_replace_if.h> +#include <__algorithm/ranges_reverse.h> +#include <__algorithm/ranges_reverse_copy.h> +#include <__algorithm/ranges_rotate.h> +#include <__algorithm/ranges_rotate_copy.h> +#include <__algorithm/ranges_sample.h> +#include <__algorithm/ranges_search.h> +#include <__algorithm/ranges_search_n.h> +#include <__algorithm/ranges_set_difference.h> +#include <__algorithm/ranges_set_intersection.h> +#include <__algorithm/ranges_set_symmetric_difference.h> +#include <__algorithm/ranges_set_union.h> +#include <__algorithm/ranges_shuffle.h> +#include <__algorithm/ranges_sort.h> +#include <__algorithm/ranges_sort_heap.h> +#include <__algorithm/ranges_stable_partition.h> +#include <__algorithm/ranges_stable_sort.h> +#include <__algorithm/ranges_swap_ranges.h> +#include <__algorithm/ranges_transform.h> +#include <__algorithm/ranges_unique.h> +#include <__algorithm/ranges_unique_copy.h> +#include <__algorithm/ranges_upper_bound.h> #include <__algorithm/remove.h> #include <__algorithm/remove_copy.h> #include <__algorithm/remove_copy_if.h> @@ -781,22 +1891,36 @@ template <class BidirectionalIterator, class Compare> #include <__algorithm/stable_sort.h> #include <__algorithm/swap_ranges.h> #include <__algorithm/transform.h> -#include <__algorithm/unique_copy.h> #include <__algorithm/unique.h> +#include <__algorithm/unique_copy.h> #include <__algorithm/unwrap_iter.h> #include <__algorithm/upper_bound.h> +// standard-mandated includes + +// [algorithm.syn] +#include <initializer_list> + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header +# pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> +#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 +# include <__pstl_algorithm> +#endif -_LIBCPP_POP_MACROS +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17 +# include <chrono> +#endif -#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 -# include <__pstl_algorithm> +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> +# include <concepts> +# include <cstring> +# include <iterator> +# include <memory> +# include <stdexcept> +# include <utility> #endif #endif // _LIBCPP_ALGORITHM diff --git a/gnu/llvm/libcxx/include/experimental/filesystem b/gnu/llvm/libcxx/include/experimental/filesystem deleted file mode 100644 index d2e6237df34..00000000000 --- a/gnu/llvm/libcxx/include/experimental/filesystem +++ /dev/null @@ -1,256 +0,0 @@ -// -*- C++ -*- -//===--------------------------- filesystem -------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -#ifndef _LIBCPP_EXPERIMENTAL_FILESYSTEM -#define _LIBCPP_EXPERIMENTAL_FILESYSTEM -/* - filesystem synopsis - - namespace std { namespace experimental { namespace filesystem { inline namespace v1 { - - class path; - - void swap(path& lhs, path& rhs) noexcept; - size_t hash_value(const path& p) noexcept; - - bool operator==(const path& lhs, const path& rhs) noexcept; - bool operator!=(const path& lhs, const path& rhs) noexcept; - bool operator< (const path& lhs, const path& rhs) noexcept; - bool operator<=(const path& lhs, const path& rhs) noexcept; - bool operator> (const path& lhs, const path& rhs) noexcept; - bool operator>=(const path& lhs, const path& rhs) noexcept; - - path operator/ (const path& lhs, const path& rhs); - - // fs.path.io operators are friends of path. - template <class charT, class traits> - friend basic_ostream<charT, traits>& - operator<<(basic_ostream<charT, traits>& os, const path& p); - - template <class charT, class traits> - friend basic_istream<charT, traits>& - operator>>(basic_istream<charT, traits>& is, path& p); - - template <class Source> - path u8path(const Source& source); - template <class InputIterator> - path u8path(InputIterator first, InputIterator last); - - class filesystem_error; - class directory_entry; - - class directory_iterator; - - // enable directory_iterator range-based for statements - directory_iterator begin(directory_iterator iter) noexcept; - directory_iterator end(const directory_iterator&) noexcept; - - class recursive_directory_iterator; - - // enable recursive_directory_iterator range-based for statements - recursive_directory_iterator begin(recursive_directory_iterator iter) noexcept; - recursive_directory_iterator end(const recursive_directory_iterator&) noexcept; - - class file_status; - - struct space_info - { - uintmax_t capacity; - uintmax_t free; - uintmax_t available; - }; - - enum class file_type; - enum class perms; - enum class perm_options; - enum class copy_options; - enum class directory_options; - - typedef chrono::time_point<trivial-clock> file_time_type; - - // operational functions - - path absolute(const path& p); - path absolute(const path& p, error_code &ec); - - path canonical(const path& p); - path canonical(const path& p, error_code& ec); - - void copy(const path& from, const path& to); - void copy(const path& from, const path& to, error_code& ec); - void copy(const path& from, const path& to, copy_options options); - void copy(const path& from, const path& to, copy_options options, - error_code& ec); - - bool copy_file(const path& from, const path& to); - bool copy_file(const path& from, const path& to, error_code& ec); - bool copy_file(const path& from, const path& to, copy_options option); - bool copy_file(const path& from, const path& to, copy_options option, - error_code& ec); - - void copy_symlink(const path& existing_symlink, const path& new_symlink); - void copy_symlink(const path& existing_symlink, const path& new_symlink, - error_code& ec) noexcept; - - bool create_directories(const path& p); - bool create_directories(const path& p, error_code& ec); - - bool create_directory(const path& p); - bool create_directory(const path& p, error_code& ec) noexcept; - - bool create_directory(const path& p, const path& attributes); - bool create_directory(const path& p, const path& attributes, - error_code& ec) noexcept; - - void create_directory_symlink(const path& to, const path& new_symlink); - void create_directory_symlink(const path& to, const path& new_symlink, - error_code& ec) noexcept; - - void create_hard_link(const path& to, const path& new_hard_link); - void create_hard_link(const path& to, const path& new_hard_link, - error_code& ec) noexcept; - - void create_symlink(const path& to, const path& new_symlink); - void create_symlink(const path& to, const path& new_symlink, - error_code& ec) noexcept; - - path current_path(); - path current_path(error_code& ec); - void current_path(const path& p); - void current_path(const path& p, error_code& ec) noexcept; - - bool exists(file_status s) noexcept; - bool exists(const path& p); - bool exists(const path& p, error_code& ec) noexcept; - - bool equivalent(const path& p1, const path& p2); - bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept; - - uintmax_t file_size(const path& p); - uintmax_t file_size(const path& p, error_code& ec) noexcept; - - uintmax_t hard_link_count(const path& p); - uintmax_t hard_link_count(const path& p, error_code& ec) noexcept; - - bool is_block_file(file_status s) noexcept; - bool is_block_file(const path& p); - bool is_block_file(const path& p, error_code& ec) noexcept; - - bool is_character_file(file_status s) noexcept; - bool is_character_file(const path& p); - bool is_character_file(const path& p, error_code& ec) noexcept; - - bool is_directory(file_status s) noexcept; - bool is_directory(const path& p); - bool is_directory(const path& p, error_code& ec) noexcept; - - bool is_empty(const path& p); - bool is_empty(const path& p, error_code& ec) noexcept; - - bool is_fifo(file_status s) noexcept; - bool is_fifo(const path& p); - bool is_fifo(const path& p, error_code& ec) noexcept; - - bool is_other(file_status s) noexcept; - bool is_other(const path& p); - bool is_other(const path& p, error_code& ec) noexcept; - - bool is_regular_file(file_status s) noexcept; - bool is_regular_file(const path& p); - bool is_regular_file(const path& p, error_code& ec) noexcept; - - bool is_socket(file_status s) noexcept; - bool is_socket(const path& p); - bool is_socket(const path& p, error_code& ec) noexcept; - - bool is_symlink(file_status s) noexcept; - bool is_symlink(const path& p); - bool is_symlink(const path& p, error_code& ec) noexcept; - - file_time_type last_write_time(const path& p); - file_time_type last_write_time(const path& p, error_code& ec) noexcept; - void last_write_time(const path& p, file_time_type new_time); - void last_write_time(const path& p, file_time_type new_time, - error_code& ec) noexcept; - - void permissions(const path& p, perms prms, - perm_options opts=perm_options::replace); - void permissions(const path& p, perms prms, error_code& ec) noexcept; - void permissions(const path& p, perms prms, perm_options opts, - error_code& ec); - - path proximate(const path& p, error_code& ec); - path proximate(const path& p, const path& base = current_path()); - path proximate(const path& p, const path& base, error_code &ec); - - path read_symlink(const path& p); - path read_symlink(const path& p, error_code& ec); - - path relative(const path& p, error_code& ec); - path relative(const path& p, const path& base=current_path()); - path relative(const path& p, const path& base, error_code& ec); - - bool remove(const path& p); - bool remove(const path& p, error_code& ec) noexcept; - - uintmax_t remove_all(const path& p); - uintmax_t remove_all(const path& p, error_code& ec); - - void rename(const path& from, const path& to); - void rename(const path& from, const path& to, error_code& ec) noexcept; - - void resize_file(const path& p, uintmax_t size); - void resize_file(const path& p, uintmax_t size, error_code& ec) noexcept; - - space_info space(const path& p); - space_info space(const path& p, error_code& ec) noexcept; - - file_status status(const path& p); - file_status status(const path& p, error_code& ec) noexcept; - - bool status_known(file_status s) noexcept; - - file_status symlink_status(const path& p); - file_status symlink_status(const path& p, error_code& ec) noexcept; - - path temp_directory_path(); - path temp_directory_path(error_code& ec); - - path weakly_canonical(path const& p); - path weakly_canonical(path const& p, error_code& ec); - - -} } } } // namespaces std::experimental::filesystem::v1 - -*/ - -#include <experimental/__config> -#include <filesystem> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -#ifndef _LIBCPP_CXX03_LANG - -#define __cpp_lib_experimental_filesystem 201406 - -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM - -using namespace _VSTD_FS; - -_LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM - -#endif // !_LIBCPP_CXX03_LANG - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP_EXPERIMENTAL_FILESYSTEM diff --git a/gnu/llvm/libcxx/include/locale b/gnu/llvm/libcxx/include/locale index 8e584005da0..874866f6982 100644 --- a/gnu/llvm/libcxx/include/locale +++ b/gnu/llvm/libcxx/include/locale @@ -1,5 +1,5 @@ // -*- C++ -*- -//===-------------------------- locale ------------------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -187,26 +187,36 @@ template <class charT> class messages_byname; */ +#include <__algorithm/copy.h> +#include <__algorithm/equal.h> +#include <__algorithm/find.h> +#include <__algorithm/max.h> +#include <__algorithm/reverse.h> +#include <__algorithm/unwrap_iter.h> +#include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__debug> +#include <__iterator/access.h> +#include <__iterator/back_insert_iterator.h> +#include <__iterator/istreambuf_iterator.h> +#include <__iterator/ostreambuf_iterator.h> #include <__locale> -#include <algorithm> -#ifndef __APPLE__ -# include <cstdarg> -#endif +#include <__memory/unique_ptr.h> #include <cstdio> #include <cstdlib> #include <ctime> #include <ios> -#include <iterator> #include <limits> -#include <memory> +#include <new> #include <streambuf> #include <version> +// TODO: Fix __bsd_locale_defaults.h +// NOLINTBEGIN(libcpp-robust-against-adl) + #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) // Most unix variants have catopen. These are the specific ones that don't. -# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) +# if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__) # define _LIBCPP_HAS_CATOPEN 1 # include <nl_types.h> # endif @@ -219,7 +229,7 @@ template <class charT> class messages_byname; #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header +# pragma GCC system_header #endif _LIBCPP_PUSH_MACROS @@ -230,7 +240,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if defined(__APPLE__) || defined(__FreeBSD__) # define _LIBCPP_GET_C_LOCALE 0 -#elif defined(__CloudABI__) || defined(__NetBSD__) +#elif defined(__NetBSD__) # define _LIBCPP_GET_C_LOCALE LC_C_LOCALE #else # define _LIBCPP_GET_C_LOCALE __cloc() @@ -258,7 +268,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // If the input is "a", the first keyword matches and eofbit is set. // If the input is "abc", no match is found and "ab" are consumed. template <class _InputIterator, class _ForwardIterator, class _Ctype> -_LIBCPP_HIDDEN +_LIBCPP_HIDE_FROM_ABI _ForwardIterator __scan_keyword(_InputIterator& __b, _InputIterator __e, _ForwardIterator __kb, _ForwardIterator __ke, @@ -416,11 +426,11 @@ struct __num_get unsigned& __dc, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, const _CharT* __atoms); private: - template<typename T> - const T* __do_widen_p(ios_base& __iob, T* __atoms) const + template<typename _Tp> + const _Tp* __do_widen_p(ios_base& __iob, _Tp* __atoms) const { locale __loc = __iob.getloc(); - use_facet<ctype<T> >(__loc).widen(__src, __src + 26, __atoms); + use_facet<ctype<_Tp> >(__loc).widen(__src, __src + 26, __atoms); return __atoms; } @@ -439,8 +449,8 @@ string __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep) { locale __loc = __iob.getloc(); - use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms); - const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); + std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 26, __atoms); + const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc); __thousands_sep = __np.thousands_sep(); return __np.grouping(); } @@ -452,8 +462,8 @@ __num_get<_CharT>::__stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& _CharT& __thousands_sep) { locale __loc = __iob.getloc(); - use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms); - const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc); + std::use_facet<ctype<_CharT> >(__loc).widen(__src, __src + 32, __atoms); + const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__loc); __decimal_point = __np.decimal_point(); __thousands_sep = __np.thousands_sep(); return __np.grouping(); @@ -487,7 +497,7 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& } return 0; } - ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms; + ptrdiff_t __f = std::find(__atoms, __atoms + 26, __ct) - __atoms; if (__f >= 24) return -1; switch (__base) @@ -540,13 +550,13 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex } return 0; } - ptrdiff_t __f = find(__atoms, __atoms + 32, __ct) - __atoms; + ptrdiff_t __f = std::find(__atoms, __atoms + 32, __ct) - __atoms; if (__f >= 32) return -1; char __x = __src[__f]; if (__x == '-' || __x == '+') { - if (__a_end == __a || (__a_end[-1] & 0x5F) == (__exp & 0x7F)) + if (__a_end == __a || (std::toupper(__a_end[-1]) == std::toupper(__exp))) { *__a_end++ = __x; return 0; @@ -555,9 +565,9 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex } if (__x == 'x' || __x == 'X') __exp = 'P'; - else if ((__x & 0x5F) == __exp) + else if (std::toupper(__x) == __exp) { - __exp |= (char) 0x80; + __exp = std::tolower(__exp); if (__in_units) { __in_units = false; @@ -572,8 +582,10 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex return 0; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>) +extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>; +#endif template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS num_get @@ -668,8 +680,7 @@ public: static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~num_get() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_get() override {} template <class _Fp> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS @@ -738,17 +749,17 @@ locale::id num_get<_CharT, _InputIterator>::id; template <class _Tp> -_LIBCPP_HIDDEN _Tp +_LIBCPP_HIDE_FROM_ABI _Tp __num_get_signed_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) { if (__a != __a_end) { - typename remove_reference<decltype(errno)>::type __save_errno = errno; + __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno; errno = 0; char *__p2; long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); - typename remove_reference<decltype(errno)>::type __current_errno = errno; + __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno; if (__current_errno == 0) errno = __save_errno; if (__p2 != __a_end) @@ -773,7 +784,7 @@ __num_get_signed_integral(const char* __a, const char* __a_end, } template <class _Tp> -_LIBCPP_HIDDEN _Tp +_LIBCPP_HIDE_FROM_ABI _Tp __num_get_unsigned_integral(const char* __a, const char* __a_end, ios_base::iostate& __err, int __base) { @@ -784,11 +795,11 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end, __err = ios_base::failbit; return 0; } - typename remove_reference<decltype(errno)>::type __save_errno = errno; + __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno; errno = 0; char *__p2; unsigned long long __ll = strtoull_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE); - typename remove_reference<decltype(errno)>::type __current_errno = errno; + __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno; if (__current_errno == 0) errno = __save_errno; if (__p2 != __a_end) @@ -832,17 +843,17 @@ long double __do_strtod<long double>(const char* __a, char** __p2) { } template <class _Tp> -_LIBCPP_HIDDEN +_LIBCPP_HIDE_FROM_ABI _Tp __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err) { if (__a != __a_end) { - typename remove_reference<decltype(errno)>::type __save_errno = errno; + __libcpp_remove_reference_t<decltype(errno)> __save_errno = errno; errno = 0; char *__p2; - _Tp __ld = __do_strtod<_Tp>(__a, &__p2); - typename remove_reference<decltype(errno)>::type __current_errno = errno; + _Tp __ld = std::__do_strtod<_Tp>(__a, &__p2); + __libcpp_remove_reference_t<decltype(errno)> __current_errno = errno; if (__current_errno == 0) errno = __save_errno; if (__p2 != __a_end) @@ -884,8 +895,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, } return __b; } - const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__iob.getloc()); - const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__iob.getloc()); + const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__iob.getloc()); + const numpunct<_CharT>& __np = std::use_facet<numpunct<_CharT> >(__iob.getloc()); typedef typename numpunct<_CharT>::string_type string_type; const string_type __names[2] = {__np.truename(), __np.falsename()}; const string_type* __i = _VSTD::__scan_keyword(__b, __e, __names, __names+2, @@ -942,7 +953,7 @@ num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e, if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz) *__g_end++ = __dc; // Stage 3 - __v = __num_get_signed_integral<_Signed>(__a, __a_end, __err, __base); + __v = std::__num_get_signed_integral<_Signed>(__a, __a_end, __err, __base); // Digit grouping checked __check_grouping(__grouping, __g, __g_end, __err); // EOF checked @@ -999,7 +1010,7 @@ num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e, if (__grouping.size() != 0 && __g_end-__g < __num_get_base::__num_get_buf_sz) *__g_end++ = __dc; // Stage 3 - __v = __num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base); + __v = std::__num_get_unsigned_integral<_Unsigned>(__a, __a_end, __err, __base); // Digit grouping checked __check_grouping(__grouping, __g, __g_end, __err); // EOF checked @@ -1054,7 +1065,7 @@ num_get<_CharT, _InputIterator>::__do_get_floating_point(iter_type __b, iter_typ if (__grouping.size() != 0 && __in_units && __g_end-__g < __num_get_base::__num_get_buf_sz) *__g_end++ = __dc; // Stage 3 - __v = __num_get_float<_Fp>(__a, __a_end, __err); + __v = std::__num_get_float<_Fp>(__a, __a_end, __err); // Digit grouping checked __check_grouping(__grouping, __g, __g_end, __err); // EOF checked @@ -1076,8 +1087,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, char_type __atoms[26]; char_type __thousands_sep = 0; string __grouping; - use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src, - __num_get_base::__src + 26, __atoms); + std::use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src, + __num_get_base::__src + 26, __atoms); string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; @@ -1110,8 +1121,10 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>; +#endif struct _LIBCPP_TYPE_VIS __num_put_base { @@ -1142,8 +1155,8 @@ __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) { - const ctype<_CharT>& __ct = use_facet<ctype<_CharT> > (__loc); - const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc); + const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc); + const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc); string __grouping = __npt.grouping(); if (__grouping.empty()) { @@ -1162,7 +1175,7 @@ __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne, *__oe++ = __ct.widen(*__nf++); *__oe++ = __ct.widen(*__nf++); } - reverse(__nf, __ne); + std::reverse(__nf, __ne); _CharT __thousands_sep = __npt.thousands_sep(); unsigned __dc = 0; unsigned __dg = 0; @@ -1179,7 +1192,7 @@ __num_put<_CharT>::__widen_and_group_int(char* __nb, char* __np, char* __ne, *__oe++ = __ct.widen(*__p); ++__dc; } - reverse(__ob + (__nf - __nb), __oe); + std::reverse(__ob + (__nf - __nb), __oe); } if (__np == __ne) __op = __oe; @@ -1193,8 +1206,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, _CharT* __ob, _CharT*& __op, _CharT*& __oe, const locale& __loc) { - const ctype<_CharT>& __ct = use_facet<ctype<_CharT> > (__loc); - const numpunct<_CharT>& __npt = use_facet<numpunct<_CharT> >(__loc); + const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> > (__loc); + const numpunct<_CharT>& __npt = std::use_facet<numpunct<_CharT> >(__loc); string __grouping = __npt.grouping(); __oe = __ob; char* __nf = __nb; @@ -1223,7 +1236,7 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, } else { - reverse(__nf, __ns); + std::reverse(__nf, __ns); _CharT __thousands_sep = __npt.thousands_sep(); unsigned __dc = 0; unsigned __dg = 0; @@ -1239,7 +1252,7 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, *__oe++ = __ct.widen(*__p); ++__dc; } - reverse(__ob + (__nf - __nb), __oe); + std::reverse(__ob + (__nf - __nb), __oe); } for (__nf = __ns; __nf < __ne; ++__nf) { @@ -1260,8 +1273,10 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne, __op = __ob + (__np - __nb); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>) +extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>; +#endif template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS num_put @@ -1335,8 +1350,7 @@ public: static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~num_put() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~num_put() override {} virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, bool __v) const; @@ -1354,6 +1368,18 @@ protected: long double __v) const; virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const; + + template <class _Integral> + _LIBCPP_HIDE_FROM_ABI inline + _OutputIterator __do_put_integral(iter_type __s, ios_base& __iob, + char_type __fl, _Integral __v, + char const* __len) const; + + template <class _Float> + _LIBCPP_HIDE_FROM_ABI inline + _OutputIterator __do_put_floating_point(iter_type __s, ios_base& __iob, + char_type __fl, _Float __v, + char const* __len) const; }; template <class _CharT, class _OutputIterator> @@ -1361,7 +1387,7 @@ locale::id num_put<_CharT, _OutputIterator>::id; template <class _CharT, class _OutputIterator> -_LIBCPP_HIDDEN +_LIBCPP_HIDE_FROM_ABI _OutputIterator __pad_and_output(_OutputIterator __s, const _CharT* __ob, const _CharT* __op, const _CharT* __oe, @@ -1384,7 +1410,7 @@ __pad_and_output(_OutputIterator __s, } template <class _CharT, class _Traits> -_LIBCPP_HIDDEN +_LIBCPP_HIDE_FROM_ABI ostreambuf_iterator<_CharT, _Traits> __pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s, const _CharT* __ob, const _CharT* __op, const _CharT* __oe, @@ -1436,9 +1462,9 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, { if ((__iob.flags() & ios_base::boolalpha) == 0) return do_put(__s, __iob, __fl, (unsigned long)__v); - const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc()); + const numpunct<char_type>& __np = std::use_facet<numpunct<char_type> >(__iob.getloc()); typedef typename numpunct<char_type>::string_type string_type; -#if _LIBCPP_DEBUG_LEVEL == 2 +#ifdef _LIBCPP_ENABLE_DEBUG_MODE string_type __tmp(__v ? __np.truename() : __np.falsename()); string_type __nm = _VSTD::move(__tmp); #else @@ -1450,22 +1476,29 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, } template <class _CharT, class _OutputIterator> +template <class _Integral> +_LIBCPP_HIDE_FROM_ABI inline _OutputIterator -num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, - char_type __fl, long __v) const +num_put<_CharT, _OutputIterator>::__do_put_integral(iter_type __s, ios_base& __iob, + char_type __fl, _Integral __v, + char const* __len) const { // Stage 1 - Get number in narrow char - char __fmt[6] = {'%', 0}; - const char* __len = "l"; - this->__format_int(__fmt+1, __len, true, __iob.flags()); + char __fmt[8] = {'%', 0}; + this->__format_int(__fmt+1, __len, is_signed<_Integral>::value, __iob.flags()); // Worst case is octal, with showbase enabled. Note that octal is always // printed as an unsigned value. + using _Unsigned = typename make_unsigned<_Integral>::type; _LIBCPP_CONSTEXPR const unsigned __nbuf - = (numeric_limits<unsigned long>::digits / 3) // 1 char per 3 bits - + ((numeric_limits<unsigned long>::digits % 3) != 0) // round up + = (numeric_limits<_Unsigned>::digits / 3) // 1 char per 3 bits + + ((numeric_limits<_Unsigned>::digits % 3) != 0) // round up + 2; // base prefix + terminating null character char __nar[__nbuf]; + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") + _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); + _LIBCPP_DIAGNOSTIC_POP char* __ne = __nar + __nc; char* __np = this->__identify_padding(__nar, __ne, __iob); // Stage 2 - Widen __nar while adding thousands separators @@ -1475,7 +1508,15 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); // [__o, __oe) contains thousands_sep'd wide number // Stage 3 & 4 - return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); + return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl); +} + +template <class _CharT, class _OutputIterator> +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, long __v) const +{ + return this->__do_put_integral(__s, __iob, __fl, __v, "l"); } template <class _CharT, class _OutputIterator> @@ -1483,28 +1524,7 @@ _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long long __v) const { - // Stage 1 - Get number in narrow char - char __fmt[8] = {'%', 0}; - const char* __len = "ll"; - this->__format_int(__fmt+1, __len, true, __iob.flags()); - // Worst case is octal, with showbase enabled. Note that octal is always - // printed as an unsigned value. - _LIBCPP_CONSTEXPR const unsigned __nbuf - = (numeric_limits<unsigned long long>::digits / 3) // 1 char per 3 bits - + ((numeric_limits<unsigned long long>::digits % 3) != 0) // round up - + 2; // base prefix + terminating null character - char __nar[__nbuf]; - int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); - char* __ne = __nar + __nc; - char* __np = this->__identify_padding(__nar, __ne, __iob); - // Stage 2 - Widen __nar while adding thousands separators - char_type __o[2*(__nbuf-1) - 1]; - char_type* __op; // pad here - char_type* __oe; // end of output - this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); - // [__o, __oe) contains thousands_sep'd wide number - // Stage 3 & 4 - return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); + return this->__do_put_integral(__s, __iob, __fl, __v, "ll"); } template <class _CharT, class _OutputIterator> @@ -1512,27 +1532,7 @@ _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long __v) const { - // Stage 1 - Get number in narrow char - char __fmt[6] = {'%', 0}; - const char* __len = "l"; - this->__format_int(__fmt+1, __len, false, __iob.flags()); - // Worst case is octal, with showbase enabled. - _LIBCPP_CONSTEXPR const unsigned __nbuf - = (numeric_limits<unsigned long>::digits / 3) // 1 char per 3 bits - + ((numeric_limits<unsigned long>::digits % 3) != 0) // round up - + 2; // base prefix + terminating null character - char __nar[__nbuf]; - int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); - char* __ne = __nar + __nc; - char* __np = this->__identify_padding(__nar, __ne, __iob); - // Stage 2 - Widen __nar while adding thousands separators - char_type __o[2*(__nbuf-1) - 1]; - char_type* __op; // pad here - char_type* __oe; // end of output - this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); - // [__o, __oe) contains thousands_sep'd wide number - // Stage 3 & 4 - return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); + return this->__do_put_integral(__s, __iob, __fl, __v, "l"); } template <class _CharT, class _OutputIterator> @@ -1540,42 +1540,27 @@ _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, unsigned long long __v) const { - // Stage 1 - Get number in narrow char - char __fmt[8] = {'%', 0}; - const char* __len = "ll"; - this->__format_int(__fmt+1, __len, false, __iob.flags()); - // Worst case is octal, with showbase enabled. - _LIBCPP_CONSTEXPR const unsigned __nbuf - = (numeric_limits<unsigned long long>::digits / 3) // 1 char per 3 bits - + ((numeric_limits<unsigned long long>::digits % 3) != 0) // round up - + 2; // base prefix + terminating null character - char __nar[__nbuf]; - int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); - char* __ne = __nar + __nc; - char* __np = this->__identify_padding(__nar, __ne, __iob); - // Stage 2 - Widen __nar while adding thousands separators - char_type __o[2*(__nbuf-1) - 1]; - char_type* __op; // pad here - char_type* __oe; // end of output - this->__widen_and_group_int(__nar, __np, __ne, __o, __op, __oe, __iob.getloc()); - // [__o, __oe) contains thousands_sep'd wide number - // Stage 3 & 4 - return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); + return this->__do_put_integral(__s, __iob, __fl, __v, "ll"); } template <class _CharT, class _OutputIterator> +template <class _Float> +_LIBCPP_HIDE_FROM_ABI inline _OutputIterator -num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, - char_type __fl, double __v) const +num_put<_CharT, _OutputIterator>::__do_put_floating_point(iter_type __s, ios_base& __iob, + char_type __fl, _Float __v, + char const* __len) const { // Stage 1 - Get number in narrow char char __fmt[8] = {'%', 0}; - const char* __len = ""; bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags()); const unsigned __nbuf = 30; char __nar[__nbuf]; char* __nb = __nar; int __nc; + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") + _LIBCPP_GCC_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") if (__specify_precision) __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); @@ -1592,6 +1577,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, __throw_bad_alloc(); __nbh.reset(__nb); } + _LIBCPP_DIAGNOSTIC_POP char* __ne = __nb + __nc; char* __np = this->__identify_padding(__nb, __ne, __iob); // Stage 2 - Widen __nar while adding thousands separators @@ -1610,59 +1596,24 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc()); // [__o, __oe) contains thousands_sep'd wide number // Stage 3 & 4 - __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl); + __s = std::__pad_and_output(__s, __ob, __op, __oe, __iob, __fl); return __s; } template <class _CharT, class _OutputIterator> _OutputIterator num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, + char_type __fl, double __v) const +{ + return this->__do_put_floating_point(__s, __iob, __fl, __v, ""); +} + +template <class _CharT, class _OutputIterator> +_OutputIterator +num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, long double __v) const { - // Stage 1 - Get number in narrow char - char __fmt[8] = {'%', 0}; - const char* __len = "L"; - bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags()); - const unsigned __nbuf = 30; - char __nar[__nbuf]; - char* __nb = __nar; - int __nc; - if (__specify_precision) - __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, - (int)__iob.precision(), __v); - else - __nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v); - unique_ptr<char, void(*)(void*)> __nbh(nullptr, free); - if (__nc > static_cast<int>(__nbuf-1)) - { - if (__specify_precision) - __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); - else - __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); - if (__nc == -1) - __throw_bad_alloc(); - __nbh.reset(__nb); - } - char* __ne = __nb + __nc; - char* __np = this->__identify_padding(__nb, __ne, __iob); - // Stage 2 - Widen __nar while adding thousands separators - char_type __o[2*(__nbuf-1) - 1]; - char_type* __ob = __o; - unique_ptr<char_type, void(*)(void*)> __obh(0, free); - if (__nb != __nar) - { - __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type)); - if (__ob == 0) - __throw_bad_alloc(); - __obh.reset(__ob); - } - char_type* __op; // pad here - char_type* __oe; // end of output - this->__widen_and_group_float(__nb, __np, __ne, __ob, __op, __oe, __iob.getloc()); - // [__o, __oe) contains thousands_sep'd wide number - // Stage 3 & 4 - __s = __pad_and_output(__s, __ob, __op, __oe, __iob, __fl); - return __s; + return this->__do_put_floating_point(__s, __iob, __fl, __v, "L"); } template <class _CharT, class _OutputIterator> @@ -1671,17 +1622,16 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, char_type __fl, const void* __v) const { // Stage 1 - Get pointer in narrow char - char __fmt[6] = "%p"; const unsigned __nbuf = 20; char __nar[__nbuf]; - int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, __fmt, __v); + int __nc = __libcpp_snprintf_l(__nar, sizeof(__nar), _LIBCPP_GET_C_LOCALE, "%p", __v); char* __ne = __nar + __nc; char* __np = this->__identify_padding(__nar, __ne, __iob); // Stage 2 - Widen __nar char_type __o[2*(__nbuf-1) - 1]; char_type* __op; // pad here char_type* __oe; // end of output - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); __ct.widen(__nar, __ne, __o); __oe = __o + (__ne - __nar); if (__np == __ne) @@ -1690,14 +1640,16 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob, __op = __o + (__np - __nar); // [__o, __oe) contains wide number // Stage 3 & 4 - return __pad_and_output(__s, __o, __op, __oe, __iob, __fl); + return std::__pad_and_output(__s, __o, __op, __oe, __iob, __fl); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>; +#endif template <class _CharT, class _InputIterator> -_LIBCPP_HIDDEN +_LIBCPP_HIDE_FROM_ABI int __get_up_to_n_digits(_InputIterator& __b, _InputIterator __e, ios_base::iostate& __err, const ctype<_CharT>& __ct, int __n) @@ -1761,6 +1713,7 @@ template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__r() con template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__x() const; template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__X() const; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage<wchar_t>::__weeks() const; template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage<wchar_t>::__months() const; template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage<wchar_t>::__am_pm() const; @@ -1768,6 +1721,7 @@ template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__c() template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__r() const; template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__x() const; template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__X() const; +#endif template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS time_get @@ -1841,8 +1795,7 @@ public: static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~time_get() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get() override {} virtual dateorder do_date_order() const; virtual iter_type do_get_time(iter_type __b, iter_type __e, ios_base& __iob, @@ -1973,8 +1926,8 @@ time_get<_CharT, _InputIterator>::__get_month(int& __m, ios_base::iostate& __err, const ctype<char_type>& __ct) const { - int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1; - if (!(__err & ios_base::failbit) && __t <= 11) + int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2) - 1; + if (!(__err & ios_base::failbit) && 0 <= __t && __t <= 11) __m = __t; else __err |= ios_base::failbit; @@ -1987,7 +1940,7 @@ time_get<_CharT, _InputIterator>::__get_year(int& __y, ios_base::iostate& __err, const ctype<char_type>& __ct) const { - int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4); + int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4); if (!(__err & ios_base::failbit)) { if (__t < 69) @@ -2005,7 +1958,7 @@ time_get<_CharT, _InputIterator>::__get_year4(int& __y, ios_base::iostate& __err, const ctype<char_type>& __ct) const { - int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 4); + int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 4); if (!(__err & ios_base::failbit)) __y = __t - 1900; } @@ -2017,7 +1970,7 @@ time_get<_CharT, _InputIterator>::__get_hour(int& __h, ios_base::iostate& __err, const ctype<char_type>& __ct) const { - int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); + int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2); if (!(__err & ios_base::failbit) && __t <= 23) __h = __t; else @@ -2031,7 +1984,7 @@ time_get<_CharT, _InputIterator>::__get_12_hour(int& __h, ios_base::iostate& __err, const ctype<char_type>& __ct) const { - int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); + int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2); if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 12) __h = __t; else @@ -2045,7 +1998,7 @@ time_get<_CharT, _InputIterator>::__get_minute(int& __m, ios_base::iostate& __err, const ctype<char_type>& __ct) const { - int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); + int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2); if (!(__err & ios_base::failbit) && __t <= 59) __m = __t; else @@ -2059,7 +2012,7 @@ time_get<_CharT, _InputIterator>::__get_second(int& __s, ios_base::iostate& __err, const ctype<char_type>& __ct) const { - int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2); + int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 2); if (!(__err & ios_base::failbit) && __t <= 60) __s = __t; else @@ -2073,7 +2026,7 @@ time_get<_CharT, _InputIterator>::__get_weekday(int& __w, ios_base::iostate& __err, const ctype<char_type>& __ct) const { - int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 1); + int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 1); if (!(__err & ios_base::failbit) && __t <= 6) __w = __t; else @@ -2087,7 +2040,7 @@ time_get<_CharT, _InputIterator>::__get_day_year_num(int& __d, ios_base::iostate& __err, const ctype<char_type>& __ct) const { - int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 3); + int __t = std::__get_up_to_n_digits(__b, __e, __err, __ct, 3); if (!(__err & ios_base::failbit) && __t <= 365) __d = __t; else @@ -2152,7 +2105,7 @@ time_get<_CharT, _InputIterator>::get(iter_type __b, iter_type __e, ios_base::iostate& __err, tm* __tm, const char_type* __fmtb, const char_type* __fmte) const { - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); __err = ios_base::goodbit; while (__fmtb != __fmte && __err == ios_base::goodbit) { @@ -2239,7 +2192,7 @@ time_get<_CharT, _InputIterator>::do_get_weekday(iter_type __b, iter_type __e, ios_base::iostate& __err, tm* __tm) const { - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); __get_weekdayname(__tm->tm_wday, __b, __e, __err, __ct); return __b; } @@ -2251,7 +2204,7 @@ time_get<_CharT, _InputIterator>::do_get_monthname(iter_type __b, iter_type __e, ios_base::iostate& __err, tm* __tm) const { - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); __get_monthname(__tm->tm_mon, __b, __e, __err, __ct); return __b; } @@ -2263,7 +2216,7 @@ time_get<_CharT, _InputIterator>::do_get_year(iter_type __b, iter_type __e, ios_base::iostate& __err, tm* __tm) const { - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); __get_year(__tm->tm_year, __b, __e, __err, __ct); return __b; } @@ -2276,7 +2229,7 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, char __fmt, char) const { __err = ios_base::goodbit; - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); switch (__fmt) { case 'a': @@ -2379,8 +2332,10 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>; +#endif class _LIBCPP_TYPE_VIS __time_get { @@ -2433,7 +2388,9 @@ extern template _LIBCPP_FUNC_VIS __time_get_storage<_CharT>::string_type __time_ /**/ _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(char) +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION(wchar_t) +#endif #undef _LIBCPP_TIME_GET_STORAGE_EXPLICIT_INSTANTIATION template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > @@ -2457,30 +2414,23 @@ public: __time_get_storage<_CharT>(__nm) {} protected: - _LIBCPP_INLINE_VISIBILITY - ~time_get_byname() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_get_byname() override {} - _LIBCPP_INLINE_VISIBILITY - virtual dateorder do_date_order() const {return this->__do_date_order();} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL dateorder do_date_order() const override {return this->__do_date_order();} private: - _LIBCPP_INLINE_VISIBILITY - virtual const string_type* __weeks() const {return this->__weeks_;} - _LIBCPP_INLINE_VISIBILITY - virtual const string_type* __months() const {return this->__months_;} - _LIBCPP_INLINE_VISIBILITY - virtual const string_type* __am_pm() const {return this->__am_pm_;} - _LIBCPP_INLINE_VISIBILITY - virtual const string_type& __c() const {return this->__c_;} - _LIBCPP_INLINE_VISIBILITY - virtual const string_type& __r() const {return this->__r_;} - _LIBCPP_INLINE_VISIBILITY - virtual const string_type& __x() const {return this->__x_;} - _LIBCPP_INLINE_VISIBILITY - virtual const string_type& __X() const {return this->__X_;} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __weeks() const override {return this->__weeks_;} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __months() const override {return this->__months_;} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type* __am_pm() const override {return this->__am_pm_;} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __c() const override {return this->__c_;} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __r() const override {return this->__r_;} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __x() const override {return this->__x_;} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL const string_type& __X() const override {return this->__X_;} }; -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>; +#endif class _LIBCPP_TYPE_VIS __time_put { @@ -2492,8 +2442,10 @@ protected: ~__time_put(); void __do_put(char* __nb, char*& __ne, const tm* __tm, char __fmt, char __mod) const; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS void __do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm, char __fmt, char __mod) const; +#endif }; template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > @@ -2522,8 +2474,7 @@ public: static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~time_put() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put() override {} virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm, char __fmt, char __mod) const; @@ -2548,7 +2499,7 @@ time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob, const char_type* __pb, const char_type* __pe) const { - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc()); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__iob.getloc()); for (; __pb != __pe; ++__pb) { if (__ct.narrow(*__pb, 0) == '%') @@ -2592,8 +2543,10 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&, return _VSTD::copy(__nb, __ne, __s); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>; +#endif template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS time_put_byname @@ -2609,12 +2562,13 @@ public: : time_put<_CharT, _OutputIterator>(__nm, __refs) {} protected: - _LIBCPP_INLINE_VISIBILITY - ~time_put_byname() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~time_put_byname() override {} }; -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>; +#endif // money_base @@ -2656,8 +2610,7 @@ public: static const bool intl = _International; protected: - _LIBCPP_INLINE_VISIBILITY - ~moneypunct() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct() override {} virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();} virtual char_type do_thousands_sep() const {return numeric_limits<char_type>::max();} @@ -2680,10 +2633,12 @@ template <class _CharT, bool _International> const bool moneypunct<_CharT, _International>::intl; -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>; +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>; +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>; +#endif // moneypunct_byname @@ -2705,18 +2660,17 @@ public: : moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());} protected: - _LIBCPP_INLINE_VISIBILITY - ~moneypunct_byname() {} - - virtual char_type do_decimal_point() const {return __decimal_point_;} - virtual char_type do_thousands_sep() const {return __thousands_sep_;} - virtual string do_grouping() const {return __grouping_;} - virtual string_type do_curr_symbol() const {return __curr_symbol_;} - virtual string_type do_positive_sign() const {return __positive_sign_;} - virtual string_type do_negative_sign() const {return __negative_sign_;} - virtual int do_frac_digits() const {return __frac_digits_;} - virtual pattern do_pos_format() const {return __pos_format_;} - virtual pattern do_neg_format() const {return __neg_format_;} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~moneypunct_byname() override {} + + char_type do_decimal_point() const override {return __decimal_point_;} + char_type do_thousands_sep() const override {return __thousands_sep_;} + string do_grouping() const override {return __grouping_;} + string_type do_curr_symbol() const override {return __curr_symbol_;} + string_type do_positive_sign() const override {return __positive_sign_;} + string_type do_negative_sign() const override {return __negative_sign_;} + int do_frac_digits() const override {return __frac_digits_;} + pattern do_pos_format() const override {return __pos_format_;} + pattern do_neg_format() const override {return __neg_format_;} private: char_type __decimal_point_; @@ -2734,13 +2688,15 @@ private: template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, false>::init(const char*); template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, true>::init(const char*); +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>; +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>; + +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, false>::init(const char*); template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, true>::init(const char*); - -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>; +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>; +#endif // money_get @@ -2771,7 +2727,7 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, if (__intl) { const moneypunct<char_type, true>& __mp = - use_facet<moneypunct<char_type, true> >(__loc); + std::use_facet<moneypunct<char_type, true> >(__loc); __pat = __mp.neg_format(); __nsn = __mp.negative_sign(); __psn = __mp.positive_sign(); @@ -2784,7 +2740,7 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, else { const moneypunct<char_type, false>& __mp = - use_facet<moneypunct<char_type, false> >(__loc); + std::use_facet<moneypunct<char_type, false> >(__loc); __pat = __mp.neg_format(); __nsn = __mp.negative_sign(); __psn = __mp.positive_sign(); @@ -2796,8 +2752,10 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc, } } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>; +#endif template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS money_get @@ -2830,9 +2788,7 @@ public: static locale::id id; protected: - - _LIBCPP_INLINE_VISIBILITY - ~money_get() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_get() override {} virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl, ios_base& __iob, ios_base::iostate& __err, @@ -2857,7 +2813,7 @@ money_get<_CharT, _InputIterator>::id; _LIBCPP_FUNC_VIS void __do_nothing(void*); template <class _Tp> -_LIBCPP_HIDDEN +_LIBCPP_HIDE_FROM_ABI void __double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e) { @@ -2868,7 +2824,7 @@ __double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e) if (__new_cap == 0) __new_cap = sizeof(_Tp); size_t __n_off = static_cast<size_t>(__n - __b.get()); - _Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap); + _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap); if (__t == 0) __throw_bad_alloc(); if (__owns) @@ -2891,6 +2847,10 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, unique_ptr<char_type, void(*)(void*)>& __wb, char_type*& __wn, char_type* __we) { + if (__b == __e) { + __err |= ios_base::failbit; + return false; + } const unsigned __bz = 100; unsigned __gbuf[__bz]; unique_ptr<unsigned, void(*)(void*)> __gb(__gbuf, __do_nothing); @@ -2935,51 +2895,31 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, } break; case money_base::sign: - if (__psn.size() + __nsn.size() > 0) + if (__psn.size() > 0 && *__b == __psn[0]) { - if (__psn.size() == 0 || __nsn.size() == 0) - { // sign is optional - if (__psn.size() > 0) - { // __nsn.size() == 0 - if (*__b == __psn[0]) - { - ++__b; - if (__psn.size() > 1) - __trailing_sign = &__psn; - } - else - __neg = true; - } - else if (*__b == __nsn[0]) // __nsn.size() > 0 && __psn.size() == 0 - { - ++__b; - __neg = true; - if (__nsn.size() > 1) - __trailing_sign = &__nsn; - } - } - else // sign is required - { - if (*__b == __psn[0]) - { - ++__b; - if (__psn.size() > 1) - __trailing_sign = &__psn; - } - else if (*__b == __nsn[0]) - { - ++__b; - __neg = true; - if (__nsn.size() > 1) - __trailing_sign = &__nsn; - } - else - { - __err |= ios_base::failbit; - return false; - } - } + ++__b; + __neg = false; + if (__psn.size() > 1) + __trailing_sign = &__psn; + break; + } + if (__nsn.size() > 0 && *__b == __nsn[0]) + { + ++__b; + __neg = true; + if (__nsn.size() > 1) + __trailing_sign = &__nsn; + break; } + if (__psn.size() > 0 && __nsn.size() > 0) + { // sign is required + __err |= ios_base::failbit; + return false; + } + if (__psn.size() == 0 && __nsn.size() == 0) + // locale has no way of specifying a sign. Use the initial value of __neg as a default + break; + __neg = (__nsn.size() == 0); break; case money_base::symbol: { @@ -2999,7 +2939,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, ++__sym_space_end; const size_t __num_spaces = __sym_space_end - __sym.begin(); if (__num_spaces > __spaces.size() || - !equal(__spaces.end() - __num_spaces, __spaces.end(), + !std::equal(__spaces.end() - __num_spaces, __spaces.end(), __sym.begin())) { // No match. Put __sym_space_end back at the // beginning of __sym, which will prevent a @@ -3030,14 +2970,14 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, if (__ct.is(ctype_base::digit, __c)) { if (__wn == __we) - __double_or_nothing(__wb, __wn, __we); + std::__double_or_nothing(__wb, __wn, __we); *__wn++ = __c; ++__ng; } else if (__grp.size() > 0 && __ng > 0 && __c == __ts) { if (__gn == __ge) - __double_or_nothing(__gb, __gn, __ge); + std::__double_or_nothing(__gb, __gn, __ge); *__gn++ = __ng; __ng = 0; } @@ -3047,7 +2987,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, if (__gb.get() != __gn && __ng > 0) { if (__gn == __ge) - __double_or_nothing(__gb, __gn, __ge); + std::__double_or_nothing(__gb, __gn, __ge); *__gn++ = __ng; } if (__fd > 0) @@ -3065,7 +3005,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e, return false; } if (__wn == __we) - __double_or_nothing(__wb, __wn, __we); + std::__double_or_nothing(__wb, __wn, __we); *__wn++ = *__b; } } @@ -3115,7 +3055,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, char_type* __wn; char_type* __we = __wbuf + __bz; locale __loc = __iob.getloc(); - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc); bool __neg = false; if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, __wb, __wn, __we)) @@ -3136,7 +3076,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, if (__neg) *__nc++ = '-'; for (const char_type* __w = __wb.get(); __w < __wn; ++__w, ++__nc) - *__nc = __src[find(__atoms, _VSTD::end(__atoms), *__w) - __atoms]; + *__nc = __src[std::find(__atoms, _VSTD::end(__atoms), *__w) - __atoms]; *__nc = char(); if (sscanf(__nbuf, "%Lf", &__v) != 1) __throw_runtime_error("money_get error"); @@ -3159,7 +3099,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, char_type* __wn; char_type* __we = __wbuf + __bz; locale __loc = __iob.getloc(); - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc); bool __neg = false; if (__do_get(__b, __e, __intl, __loc, __iob.flags(), __err, __neg, __ct, __wb, __wn, __we)) @@ -3179,8 +3119,10 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e, return __b; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>; +#endif // money_put @@ -3219,7 +3161,7 @@ __money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc, if (__intl) { const moneypunct<char_type, true>& __mp = - use_facet<moneypunct<char_type, true> >(__loc); + std::use_facet<moneypunct<char_type, true> >(__loc); if (__neg) { __pat = __mp.neg_format(); @@ -3239,7 +3181,7 @@ __money_put<_CharT>::__gather_info(bool __intl, bool __neg, const locale& __loc, else { const moneypunct<char_type, false>& __mp = - use_facet<moneypunct<char_type, false> >(__loc); + std::use_facet<moneypunct<char_type, false> >(__loc); if (__neg) { __pat = __mp.neg_format(); @@ -3270,9 +3212,9 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m int __fd) { __me = __mb; - for (unsigned __p = 0; __p < 4; ++__p) + for (char __p : __pat.field) { - switch (__pat.field[__p]) + switch (__p) { case money_base::none: __mi = __me; @@ -3339,7 +3281,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m } } // reverse it - reverse(__t, __me); + std::reverse(__t, __me); } break; } @@ -3354,8 +3296,10 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m __mi = __mb; } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>; +#endif template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> > class _LIBCPP_TEMPLATE_VIS money_put @@ -3388,8 +3332,7 @@ public: static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~money_put() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~money_put() override {} virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob, char_type __fl, long double __units) const; @@ -3430,7 +3373,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, } // gather info locale __loc = __iob.getloc(); - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc); __ct.widen(__bb, __bb + __n, __db); bool __neg = __n > 0 && __bb[0] == '-'; money_base::pattern __pat; @@ -3462,7 +3405,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, this->__format(__mb, __mi, __me, __iob.flags(), __db, __db + __n, __ct, __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd); - return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); + return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl); } template <class _CharT, class _OutputIterator> @@ -3473,7 +3416,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, { // gather info locale __loc = __iob.getloc(); - const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__loc); + const ctype<char_type>& __ct = std::use_facet<ctype<char_type> >(__loc); bool __neg = __digits.size() > 0 && __digits[0] == __ct.widen('-'); money_base::pattern __pat; char_type __dp; @@ -3504,11 +3447,13 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl, this->__format(__mb, __mi, __me, __iob.flags(), __digits.data(), __digits.data() + __digits.size(), __ct, __neg, __pat, __dp, __ts, __grp, __sym, __sn, __fd); - return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl); + return std::__pad_and_output(__s, __mb, __mi, __me, __iob, __fl); } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>; +#endif // messages @@ -3555,8 +3500,7 @@ public: static locale::id id; protected: - _LIBCPP_INLINE_VISIBILITY - ~messages() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages() override {} virtual catalog do_open(const basic_string<char>&, const locale&) const; virtual string_type do_get(catalog, int __set, int __msgid, @@ -3590,7 +3534,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid, { #ifdef _LIBCPP_HAS_CATOPEN string __ndflt; - __narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt), + __narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__ndflt), __dflt.c_str(), __dflt.c_str() + __dflt.size()); if (__c != -1) @@ -3598,7 +3542,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid, nl_catd __cat = (nl_catd)__c; char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str()); string_type __w; - __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w), + __widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(std::back_inserter(__w), __n, __n + _VSTD::strlen(__n)); return __w; #else // !_LIBCPP_HAS_CATOPEN @@ -3623,8 +3567,10 @@ messages<_CharT>::do_close(catalog __c) const #endif // _LIBCPP_HAS_CATOPEN } -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>; +#endif template <class _CharT> class _LIBCPP_TEMPLATE_VIS messages_byname @@ -3643,17 +3589,18 @@ public: : messages<_CharT>(__refs) {} protected: - _LIBCPP_INLINE_VISIBILITY - ~messages_byname() {} + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~messages_byname() override {} }; -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>) -_LIBCPP_EXTERN_TEMPLATE_EVEN_IN_DEBUG_MODE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>) +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>; +#endif template<class _Codecvt, class _Elem = wchar_t, class _Wide_alloc = allocator<_Elem>, class _Byte_alloc = allocator<char> > -class _LIBCPP_TEMPLATE_VIS wstring_convert +class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wstring_convert { public: typedef basic_string<char, char_traits<char>, _Byte_alloc> byte_string; @@ -3720,6 +3667,7 @@ public: state_type state() const {return __cvtstate_;} }; +_LIBCPP_SUPPRESS_DEPRECATED_PUSH template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> inline wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: @@ -3727,6 +3675,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: : __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0) { } +_LIBCPP_SUPPRESS_DEPRECATED_POP template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> inline @@ -3761,6 +3710,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: #endif // _LIBCPP_CXX03_LANG +_LIBCPP_SUPPRESS_DEPRECATED_PUSH template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc> wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert() { @@ -3772,6 +3722,7 @@ typename wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::wide_string wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: from_bytes(const char* __frm, const char* __frm_end) { +_LIBCPP_SUPPRESS_DEPRECATED_POP __cvtcount_ = 0; if (__cvtptr_ != nullptr) { @@ -3918,7 +3869,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>:: } template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> > -class _LIBCPP_TEMPLATE_VIS wbuffer_convert +class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 wbuffer_convert : public basic_streambuf<_Elem, _Tr> { public: @@ -3995,6 +3946,7 @@ private: wbuffer_convert* __close(); }; +_LIBCPP_SUPPRESS_DEPRECATED_PUSH template <class _Codecvt, class _Elem, class _Tr> wbuffer_convert<_Codecvt, _Elem, _Tr>:: wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state) @@ -4030,13 +3982,14 @@ template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() { +_LIBCPP_SUPPRESS_DEPRECATED_POP if (__cv_ == 0 || __bufptr_ == 0) return traits_type::eof(); bool __initial = __read_mode(); char_type __1buf; if (this->gptr() == 0) this->setg(&__1buf, &__1buf+1, &__1buf+1); - const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4); + const size_t __unget_sz = __initial ? 0 : std::min<size_t>((this->egptr() - this->eback()) / 2, 4); int_type __c = traits_type::eof(); if (this->gptr() == this->egptr()) { @@ -4055,9 +4008,11 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() } else { - _LIBCPP_ASSERT(!(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" ); - if (__extbufend_ != __extbufnext_) + if (__extbufend_ != __extbufnext_) { + _LIBCPP_ASSERT(__extbufnext_ != nullptr, "underflow moving from nullptr"); + _LIBCPP_ASSERT(__extbuf_ != nullptr, "underflow moving into nullptr"); _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); + } __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz), @@ -4094,10 +4049,12 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow() return __c; } +_LIBCPP_SUPPRESS_DEPRECATED_PUSH template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c) { +_LIBCPP_SUPPRESS_DEPRECATED_POP if (__cv_ != 0 && __bufptr_ != 0 && this->eback() < this->gptr()) { if (traits_type::eq_int_type(__c, traits_type::eof())) @@ -4115,10 +4072,12 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::pbackfail(int_type __c) return traits_type::eof(); } +_LIBCPP_SUPPRESS_DEPRECATED_PUSH template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::int_type wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c) { +_LIBCPP_SUPPRESS_DEPRECATED_POP if (__cv_ == 0 || __bufptr_ == 0) return traits_type::eof(); __write_mode(); @@ -4177,10 +4136,12 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c) return traits_type::not_eof(__c); } +_LIBCPP_SUPPRESS_DEPRECATED_PUSH template <class _Codecvt, class _Elem, class _Tr> basic_streambuf<_Elem, _Tr>* wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n) { +_LIBCPP_SUPPRESS_DEPRECATED_POP this->setg(0, 0, 0); this->setp(0, 0); if (__owns_eb_) @@ -4230,6 +4191,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::setbuf(char_type* __s, streamsize __n) return this; } +_LIBCPP_SUPPRESS_DEPRECATED_PUSH template <class _Codecvt, class _Elem, class _Tr> typename wbuffer_convert<_Codecvt, _Elem, _Tr>::pos_type wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir __way, @@ -4261,6 +4223,7 @@ template <class _Codecvt, class _Elem, class _Tr> int wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() { +_LIBCPP_SUPPRESS_DEPRECATED_POP if (__cv_ == 0 || __bufptr_ == 0) return 0; if (__cm_ & ios_base::out) @@ -4297,7 +4260,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() { if (this->gptr() != this->egptr()) { - reverse(this->gptr(), this->egptr()); + std::reverse(this->gptr(), this->egptr()); codecvt_base::result __r; const char_type* __e = this->gptr(); char* __extbe; @@ -4329,6 +4292,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::sync() return 0; } +_LIBCPP_SUPPRESS_DEPRECATED_PUSH template <class _Codecvt, class _Elem, class _Tr> bool wbuffer_convert<_Codecvt, _Elem, _Tr>::__read_mode() @@ -4383,8 +4347,22 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::__close() return __rt; } +_LIBCPP_SUPPRESS_DEPRECATED_POP + _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS +// NOLINTEND(libcpp-robust-against-adl) + +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> +# include <concepts> +# include <cstdarg> +# include <iterator> +# include <stdexcept> +# include <type_traits> +# include <typeinfo> +#endif + #endif // _LIBCPP_LOCALE diff --git a/gnu/llvm/libcxx/include/math.h b/gnu/llvm/libcxx/include/math.h index 77762d55451..a23d1ff3ed3 100644 --- a/gnu/llvm/libcxx/include/math.h +++ b/gnu/llvm/libcxx/include/math.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===---------------------------- math.h ----------------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -294,10 +294,12 @@ long double truncl(long double x); #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header +# pragma GCC system_header #endif -#include_next <math.h> +# if __has_include_next(<math.h>) +# include_next <math.h> +# endif #ifdef __cplusplus @@ -305,478 +307,237 @@ long double truncl(long double x); // back to C++ linkage before including these C++ headers. extern "C++" { -#include <stdlib.h> -#include <type_traits> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_floating_point.h> +#include <__type_traits/is_integral.h> +#include <__type_traits/is_same.h> +#include <__type_traits/promote.h> #include <limits> +#include <stdlib.h> -// signbit -#ifdef signbit +# ifdef fpclassify +# undef fpclassify +# endif -template <class _A1> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT -{ -#if __has_builtin(__builtin_signbit) - return __builtin_signbit(__lcpp_x); -#else - return signbit(__lcpp_x); -#endif -} +# ifdef signbit +# undef signbit +# endif -#undef signbit +# ifdef isfinite +# undef isfinite +# endif -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type -signbit(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); -} +# ifdef isinf +# undef isinf +# endif -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type -signbit(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x < 0; } +# ifdef isnan +# undef isnan +# endif -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type -signbit(_A1) _NOEXCEPT -{ return false; } - -#elif defined(_LIBCPP_MSVCRT) - -template <typename _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type -signbit(_A1 __lcpp_x) _NOEXCEPT -{ - return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); -} +# ifdef isnormal +# undef isnormal +# endif -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type -signbit(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x < 0; } +# ifdef isgreater +# undef isgreater +# endif -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type -signbit(_A1) _NOEXCEPT -{ return false; } +# ifdef isgreaterequal +# undef isgreaterequal +# endif -#endif // signbit +# ifdef isless +# undef isless +# endif -// fpclassify +# ifdef islessequal +# undef islessequal +# endif -#ifdef fpclassify +# ifdef islessgreater +# undef islessgreater +# endif -template <class _A1> -_LIBCPP_INLINE_VISIBILITY -int -__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT -{ -#if __has_builtin(__builtin_fpclassify) - return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, - FP_ZERO, __lcpp_x); -#else - return fpclassify(__lcpp_x); -#endif -} +# ifdef isunordered +# undef isunordered +# endif -#undef fpclassify +// signbit -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_floating_point<_A1>::value, int>::type -fpclassify(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); +template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { + return __builtin_signbit(__x); } -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_integral<_A1>::value, int>::type -fpclassify(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } +template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value && std::is_signed<_A1>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { + return __x < 0; +} -#elif defined(_LIBCPP_MSVCRT) +template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value && !std::is_signed<_A1>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1) _NOEXCEPT { + return false; +} -template <typename _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type -fpclassify(_A1 __lcpp_x) _NOEXCEPT -{ - return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x)); +// fpclassify + +template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { + return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); } -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_integral<_A1>::value, int>::type -fpclassify(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; } +template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { + return __x == 0 ? FP_ZERO : FP_NORMAL; +} -#endif // fpclassify +// The MSVC runtime already provides these functions as templates +#ifndef _LIBCPP_MSVCRT // isfinite -#ifdef isfinite - -template <class _A1> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isfinite) - return __builtin_isfinite(__lcpp_x); -#else - return isfinite(__lcpp_x); -#endif +template <class _A1, + std::__enable_if_t<std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, int> = 0> +_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1 __x) _NOEXCEPT { + return __builtin_isfinite((typename std::__promote<_A1>::type)__x); } -#undef isfinite - -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, - bool>::type -isfinite(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); +template <class _A1, + std::__enable_if_t<std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, int> = 0> +_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isfinite(_A1) _NOEXCEPT { + return true; } -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, - bool>::type -isfinite(_A1) _NOEXCEPT -{ return true; } - -#endif // isfinite - // isinf -#ifdef isinf +template <class _A1, + std::__enable_if_t<std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, int> = 0> +_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(_A1 __x) _NOEXCEPT { + return __builtin_isinf((typename std::__promote<_A1>::type)__x); +} template <class _A1> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isinf) - return __builtin_isinf(__lcpp_x); -#else - return isinf(__lcpp_x); -#endif +_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI + typename std::enable_if< std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, bool>::type + isinf(_A1) _NOEXCEPT { + return false; } -#undef isinf - -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, - bool>::type -isinf(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); +# ifdef _LIBCPP_PREFERRED_OVERLOAD +_LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(float __x) _NOEXCEPT { + return __builtin_isinf(__x); } -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if< - std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, - bool>::type -isinf(_A1) _NOEXCEPT -{ return false; } - -#ifdef _LIBCPP_PREFERRED_OVERLOAD -inline _LIBCPP_INLINE_VISIBILITY -bool -isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD -bool -isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } - -inline _LIBCPP_INLINE_VISIBILITY -bool -isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } -#endif +_LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isinf(double __x) _NOEXCEPT { + return __builtin_isinf(__x); +} -#endif // isinf +_LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isinf(long double __x) _NOEXCEPT { + return __builtin_isinf(__x); +} +# endif // isnan -#ifdef isnan - -template <class _A1> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isnan) - return __builtin_isnan(__lcpp_x); -#else - return isnan(__lcpp_x); -#endif +template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> +_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1 __x) _NOEXCEPT { + return __builtin_isnan(__x); } -#undef isnan +template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> +_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(_A1) _NOEXCEPT { + return false; +} -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type -isnan(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); +# ifdef _LIBCPP_PREFERRED_OVERLOAD +_LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(float __x) _NOEXCEPT { + return __builtin_isnan(__x); } -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_integral<_A1>::value, bool>::type -isnan(_A1) _NOEXCEPT -{ return false; } - -#ifdef _LIBCPP_PREFERRED_OVERLOAD -inline _LIBCPP_INLINE_VISIBILITY -bool -isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD -bool -isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } - -inline _LIBCPP_INLINE_VISIBILITY -bool -isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } -#endif +_LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isnan(double __x) _NOEXCEPT { + return __builtin_isnan(__x); +} -#endif // isnan +_LIBCPP_NODISCARD_EXT inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnan(long double __x) _NOEXCEPT { + return __builtin_isnan(__x); +} +# endif // isnormal -#ifdef isnormal - -template <class _A1> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isnormal) - return __builtin_isnormal(__lcpp_x); -#else - return isnormal(__lcpp_x); -#endif +template <class _A1, std::__enable_if_t<std::is_floating_point<_A1>::value, int> = 0> +_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { + return __builtin_isnormal(__x); } -#undef isnormal - -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type -isnormal(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); +template <class _A1, std::__enable_if_t<std::is_integral<_A1>::value, int> = 0> +_LIBCPP_NODISCARD_EXT _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { + return __x != 0; } -template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if<std::is_integral<_A1>::value, bool>::type -isnormal(_A1 __lcpp_x) _NOEXCEPT -{ return __lcpp_x != 0; } - -#endif // isnormal - // isgreater -#ifdef isgreater - -template <class _A1, class _A2> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return isgreater(__lcpp_x, __lcpp_y); -} - -#undef isgreater - -template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y); +template <class _A1, + class _A2, + std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreater(_A1 __x, _A2 __y) _NOEXCEPT { + typedef typename std::__promote<_A1, _A2>::type type; + return __builtin_isgreater((type)__x, (type)__y); } -#endif // isgreater - // isgreaterequal -#ifdef isgreaterequal - -template <class _A1, class _A2> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return isgreaterequal(__lcpp_x, __lcpp_y); -} - -#undef isgreaterequal - -template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y); +template <class _A1, + class _A2, + std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT { + typedef typename std::__promote<_A1, _A2>::type type; + return __builtin_isgreaterequal((type)__x, (type)__y); } -#endif // isgreaterequal - // isless -#ifdef isless - -template <class _A1, class _A2> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return isless(__lcpp_x, __lcpp_y); +template <class _A1, + class _A2, + std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isless(_A1 __x, _A2 __y) _NOEXCEPT { + typedef typename std::__promote<_A1, _A2>::type type; + return __builtin_isless((type)__x, (type)__y); } -#undef isless - -template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y); -} - -#endif // isless - // islessequal -#ifdef islessequal - -template <class _A1, class _A2> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return islessequal(__lcpp_x, __lcpp_y); +template <class _A1, + class _A2, + std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessequal(_A1 __x, _A2 __y) _NOEXCEPT { + typedef typename std::__promote<_A1, _A2>::type type; + return __builtin_islessequal((type)__x, (type)__y); } -#undef islessequal - -template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y); -} - -#endif // islessequal - // islessgreater -#ifdef islessgreater - -template <class _A1, class _A2> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return islessgreater(__lcpp_x, __lcpp_y); -} - -#undef islessgreater - -template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y); +template <class _A1, + class _A2, + std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool islessgreater(_A1 __x, _A2 __y) _NOEXCEPT { + typedef typename std::__promote<_A1, _A2>::type type; + return __builtin_islessgreater((type)__x, (type)__y); } -#endif // islessgreater - // isunordered -#ifdef isunordered - -template <class _A1, class _A2> -_LIBCPP_INLINE_VISIBILITY -bool -__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return isunordered(__lcpp_x, __lcpp_y); +template <class _A1, + class _A2, + std::__enable_if_t<std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int> = 0> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI bool isunordered(_A1 __x, _A2 __y) _NOEXCEPT { + typedef typename std::__promote<_A1, _A2>::type type; + return __builtin_isunordered((type)__x, (type)__y); } -#undef isunordered - -template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y); -} - -#endif // isunordered +#endif // _LIBCPP_MSVCRT // abs // @@ -786,960 +547,1146 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT // // handled in stdlib.h +// We have to provide double overloads for <math.h> to work on platforms that don't provide the full set of math +// functions. To make the overload set work with multiple functions that take the same arguments, we make our overloads +// templates. Functions are preferred over function templates during overload resolution, which means that our overload +// will only be selected when the C library doesn't provide one. + // acos -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float acos(float __x) _NOEXCEPT {return __builtin_acosf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double acos(double __x) _NOEXCEPT { + return __builtin_acos(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double acos(long double __x) _NOEXCEPT {return __builtin_acosl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);} +acos(_A1 __x) _NOEXCEPT {return __builtin_acos((double)__x);} // asin -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float asin(float __x) _NOEXCEPT {return __builtin_asinf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double asin(double __x) _NOEXCEPT { + return __builtin_asin(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double asin(long double __x) _NOEXCEPT {return __builtin_asinl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);} +asin(_A1 __x) _NOEXCEPT {return __builtin_asin((double)__x);} // atan -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float atan(float __x) _NOEXCEPT {return __builtin_atanf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double atan(double __x) _NOEXCEPT { + return __builtin_atan(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double atan(long double __x) _NOEXCEPT {return __builtin_atanl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);} +atan(_A1 __x) _NOEXCEPT {return __builtin_atan((double)__x);} // atan2 -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float atan2(float __y, float __x) _NOEXCEPT {return __builtin_atan2f(__y, __x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double atan2(double __x, double __y) _NOEXCEPT { + return __builtin_atan2(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double atan2(long double __y, long double __x) _NOEXCEPT {return __builtin_atan2l(__y, __x);} +# endif template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT +atan2(_A1 __y, _A2 __x) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x); + return ::atan2((__result_type)__y, (__result_type)__x); } // ceil -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);} -#endif +# if !defined(__sun__) +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float ceil(float __x) _NOEXCEPT {return __builtin_ceilf(__x);} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double ceil(double __x) _NOEXCEPT { + return __builtin_ceil(__x); +} + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double ceil(long double __x) _NOEXCEPT {return __builtin_ceill(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);} +ceil(_A1 __x) _NOEXCEPT {return __builtin_ceil((double)__x);} // cos -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float cos(float __x) _NOEXCEPT {return __builtin_cosf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double cos(double __x) _NOEXCEPT { + return __builtin_cos(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double cos(long double __x) _NOEXCEPT {return __builtin_cosl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);} +cos(_A1 __x) _NOEXCEPT {return __builtin_cos((double)__x);} // cosh -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float cosh(float __x) _NOEXCEPT {return __builtin_coshf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double cosh(double __x) _NOEXCEPT { + return __builtin_cosh(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double cosh(long double __x) _NOEXCEPT {return __builtin_coshl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);} +cosh(_A1 __x) _NOEXCEPT {return __builtin_cosh((double)__x);} // exp -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float exp(float __x) _NOEXCEPT {return __builtin_expf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double exp(double __x) _NOEXCEPT { + return __builtin_exp(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double exp(long double __x) _NOEXCEPT {return __builtin_expl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);} +exp(_A1 __x) _NOEXCEPT {return __builtin_exp((double)__x);} // fabs -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);} -#endif +# if !defined(__sun__) +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float fabs(float __x) _NOEXCEPT {return __builtin_fabsf(__x);} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fabs(double __x) _NOEXCEPT { + return __builtin_fabs(__x); +} + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fabs(long double __x) _NOEXCEPT {return __builtin_fabsl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);} +fabs(_A1 __x) _NOEXCEPT {return __builtin_fabs((double)__x);} // floor -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);} -#endif +# if !defined(__sun__) +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float floor(float __x) _NOEXCEPT {return __builtin_floorf(__x);} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double floor(double __x) _NOEXCEPT { + return __builtin_floor(__x); +} + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double floor(long double __x) _NOEXCEPT {return __builtin_floorl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);} +floor(_A1 __x) _NOEXCEPT {return __builtin_floor((double)__x);} // fmod -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float fmod(float __x, float __y) _NOEXCEPT {return __builtin_fmodf(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double fmod(double __x, double __y) _NOEXCEPT { + return __builtin_fmod(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double fmod(long double __x, long double __y) _NOEXCEPT {return __builtin_fmodl(__x, __y);} +# endif template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +fmod(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y); + return ::fmod((__result_type)__x, (__result_type)__y); } // frexp -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);} -inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float frexp(float __x, int* __e) _NOEXCEPT {return __builtin_frexpf(__x, __e);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double frexp(double __x, int* __e) _NOEXCEPT { + return __builtin_frexp(__x, __e); +} + +inline _LIBCPP_HIDE_FROM_ABI long double frexp(long double __x, int* __e) _NOEXCEPT {return __builtin_frexpl(__x, __e);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);} +frexp(_A1 __x, int* __e) _NOEXCEPT {return __builtin_frexp((double)__x, __e);} // ldexp -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);} -inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float ldexp(float __x, int __e) _NOEXCEPT {return __builtin_ldexpf(__x, __e);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double ldexp(double __x, int __e) _NOEXCEPT { + return __builtin_ldexp(__x, __e); +} + +inline _LIBCPP_HIDE_FROM_ABI long double ldexp(long double __x, int __e) _NOEXCEPT {return __builtin_ldexpl(__x, __e);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);} +ldexp(_A1 __x, int __e) _NOEXCEPT {return __builtin_ldexp((double)__x, __e);} // log -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float log(float __x) _NOEXCEPT {return __builtin_logf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double log(double __x) _NOEXCEPT { + return __builtin_log(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double log(long double __x) _NOEXCEPT {return __builtin_logl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);} +log(_A1 __x) _NOEXCEPT {return __builtin_log((double)__x);} // log10 -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float log10(float __x) _NOEXCEPT {return __builtin_log10f(__x);} + + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double log10(double __x) _NOEXCEPT { + return __builtin_log10(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double log10(long double __x) _NOEXCEPT {return __builtin_log10l(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);} +log10(_A1 __x) _NOEXCEPT {return __builtin_log10((double)__x);} // modf -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float modf(float __x, float* __y) _NOEXCEPT {return __builtin_modff(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double modf(double __x, double* __y) _NOEXCEPT { + return __builtin_modf(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double modf(long double __x, long double* __y) _NOEXCEPT {return __builtin_modfl(__x, __y);} +# endif // pow -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float pow(float __x, float __y) _NOEXCEPT {return __builtin_powf(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double pow(double __x, double __y) _NOEXCEPT { + return __builtin_pow(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double pow(long double __x, long double __y) _NOEXCEPT {return __builtin_powl(__x, __y);} +# endif template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +pow(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y); + return ::pow((__result_type)__x, (__result_type)__y); } // sin -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);} +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float sin(float __x) _NOEXCEPT {return __builtin_sinf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double sin(double __x) _NOEXCEPT { + return __builtin_sin(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double sin(long double __x) _NOEXCEPT {return __builtin_sinl(__x);} #endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);} +sin(_A1 __x) _NOEXCEPT {return __builtin_sin((double)__x);} // sinh -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float sinh(float __x) _NOEXCEPT {return __builtin_sinhf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double sinh(double __x) _NOEXCEPT { + return __builtin_sinh(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double sinh(long double __x) _NOEXCEPT {return __builtin_sinhl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);} +sinh(_A1 __x) _NOEXCEPT {return __builtin_sinh((double)__x);} // sqrt -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float sqrt(float __x) _NOEXCEPT {return __builtin_sqrtf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double sqrt(double __x) _NOEXCEPT { + return __builtin_sqrt(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double sqrt(long double __x) _NOEXCEPT {return __builtin_sqrtl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);} +sqrt(_A1 __x) _NOEXCEPT {return __builtin_sqrt((double)__x);} // tan -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float tan(float __x) _NOEXCEPT {return __builtin_tanf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double tan(double __x) _NOEXCEPT { + return __builtin_tan(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double tan(long double __x) _NOEXCEPT {return __builtin_tanl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);} +tan(_A1 __x) _NOEXCEPT {return __builtin_tan((double)__x);} // tanh -#if !(defined(_AIX) || defined(__sun__)) -inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);} -#endif +# if !defined(__sun__) +inline _LIBCPP_HIDE_FROM_ABI float tanh(float __x) _NOEXCEPT {return __builtin_tanhf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double tanh(double __x) _NOEXCEPT { + return __builtin_tanh(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double tanh(long double __x) _NOEXCEPT {return __builtin_tanhl(__x);} +# endif template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);} +tanh(_A1 __x) _NOEXCEPT {return __builtin_tanh((double)__x);} // acosh -inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float acosh(float __x) _NOEXCEPT {return __builtin_acoshf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double acosh(double __x) _NOEXCEPT { + return __builtin_acosh(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double acosh(long double __x) _NOEXCEPT {return __builtin_acoshl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);} +acosh(_A1 __x) _NOEXCEPT {return __builtin_acosh((double)__x);} // asinh -inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float asinh(float __x) _NOEXCEPT {return __builtin_asinhf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double asinh(double __x) _NOEXCEPT { + return __builtin_asinh(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double asinh(long double __x) _NOEXCEPT {return __builtin_asinhl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);} +asinh(_A1 __x) _NOEXCEPT {return __builtin_asinh((double)__x);} // atanh -inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float atanh(float __x) _NOEXCEPT {return __builtin_atanhf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double atanh(double __x) _NOEXCEPT { + return __builtin_atanh(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double atanh(long double __x) _NOEXCEPT {return __builtin_atanhl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);} +atanh(_A1 __x) _NOEXCEPT {return __builtin_atanh((double)__x);} // cbrt -inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);} +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float cbrt(float __x) _NOEXCEPT {return __builtin_cbrtf(__x);} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double cbrt(double __x) _NOEXCEPT { + return __builtin_cbrt(__x); +} + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double cbrt(long double __x) _NOEXCEPT {return __builtin_cbrtl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);} +cbrt(_A1 __x) _NOEXCEPT {return __builtin_cbrt((double)__x);} // copysign -#if __has_builtin(__builtin_copysignf) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_INLINE_VISIBILITY float __libcpp_copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT { -#if __has_builtin(__builtin_copysignf) - return __builtin_copysignf(__lcpp_x, __lcpp_y); -#else - return ::copysignf(__lcpp_x, __lcpp_y); -#endif -} - -#if __has_builtin(__builtin_copysign) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_INLINE_VISIBILITY double __libcpp_copysign(double __lcpp_x, double __lcpp_y) _NOEXCEPT { -#if __has_builtin(__builtin_copysign) - return __builtin_copysign(__lcpp_x, __lcpp_y); -#else - return ::copysign(__lcpp_x, __lcpp_y); -#endif +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT { + return ::__builtin_copysignf(__x, __y); } -#if __has_builtin(__builtin_copysignl) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_INLINE_VISIBILITY long double __libcpp_copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { -#if __has_builtin(__builtin_copysignl) - return __builtin_copysignl(__lcpp_x, __lcpp_y); -#else - return ::copysignl(__lcpp_x, __lcpp_y); -#endif +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT { + return ::__builtin_copysignl(__x, __y); } template <class _A1, class _A2> -#if __has_builtin(__builtin_copysign) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -__libcpp_copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { - typedef typename std::__promote<_A1, _A2>::type __result_type; - static_assert((!(std::_IsSame<_A1, __result_type>::value && - std::_IsSame<_A2, __result_type>::value)), ""); -#if __has_builtin(__builtin_copysign) - return __builtin_copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); -#else - return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y); -#endif + copysign(_A1 __x, _A2 __y) _NOEXCEPT { + return ::__builtin_copysign(__x, __y); } -inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x, float __lcpp_y) _NOEXCEPT { - return ::__libcpp_copysign(__lcpp_x, __lcpp_y); -} +// erf -inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT { - return ::__libcpp_copysign(__lcpp_x, __lcpp_y); -} +inline _LIBCPP_HIDE_FROM_ABI float erf(float __x) _NOEXCEPT {return __builtin_erff(__x);} -template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - std::__promote<_A1, _A2> ->::type - copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { - return ::__libcpp_copysign(__lcpp_x, __lcpp_y); +template <class = int> +_LIBCPP_HIDE_FROM_ABI double erf(double __x) _NOEXCEPT { + return __builtin_erf(__x); } -// erf - -inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI long double erf(long double __x) _NOEXCEPT {return __builtin_erfl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);} +erf(_A1 __x) _NOEXCEPT {return __builtin_erf((double)__x);} // erfc -inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float erfc(float __x) _NOEXCEPT {return __builtin_erfcf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double erfc(double __x) _NOEXCEPT { + return __builtin_erfc(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double erfc(long double __x) _NOEXCEPT {return __builtin_erfcl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);} +erfc(_A1 __x) _NOEXCEPT {return __builtin_erfc((double)__x);} // exp2 -inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float exp2(float __x) _NOEXCEPT {return __builtin_exp2f(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double exp2(double __x) _NOEXCEPT { + return __builtin_exp2(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double exp2(long double __x) _NOEXCEPT {return __builtin_exp2l(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);} +exp2(_A1 __x) _NOEXCEPT {return __builtin_exp2((double)__x);} // expm1 -inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float expm1(float __x) _NOEXCEPT {return __builtin_expm1f(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double expm1(double __x) _NOEXCEPT { + return __builtin_expm1(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double expm1(long double __x) _NOEXCEPT {return __builtin_expm1l(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);} +expm1(_A1 __x) _NOEXCEPT {return __builtin_expm1((double)__x);} // fdim -inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);} +inline _LIBCPP_HIDE_FROM_ABI float fdim(float __x, float __y) _NOEXCEPT {return __builtin_fdimf(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double fdim(double __x, double __y) _NOEXCEPT { + return __builtin_fdim(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double fdim(long double __x, long double __y) _NOEXCEPT {return __builtin_fdiml(__x, __y);} template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +fdim(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y); + return ::fdim((__result_type)__x, (__result_type)__y); } // fma -inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT +inline _LIBCPP_HIDE_FROM_ABI float fma(float __x, float __y, float __z) _NOEXCEPT { -#if __has_builtin(__builtin_fmaf) - return __builtin_fmaf(__lcpp_x, __lcpp_y, __lcpp_z); -#else - return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z); -#endif + return __builtin_fmaf(__x, __y, __z); +} + + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double fma(double __x, double __y, double __z) _NOEXCEPT { + return __builtin_fma(__x, __y, __z); } -inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT + +inline _LIBCPP_HIDE_FROM_ABI long double fma(long double __x, long double __y, long double __z) _NOEXCEPT { -#if __has_builtin(__builtin_fmal) - return __builtin_fmal(__lcpp_x, __lcpp_y, __lcpp_z); -#else - return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z); -#endif + return __builtin_fmal(__x, __y, __z); } template <class _A1, class _A2, class _A3> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value && std::is_arithmetic<_A3>::value, std::__promote<_A1, _A2, _A3> >::type -fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT +fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT { typedef typename std::__promote<_A1, _A2, _A3>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value && std::_IsSame<_A3, __result_type>::value)), ""); -#if __has_builtin(__builtin_fma) - return __builtin_fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); -#else - return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z); -#endif + return __builtin_fma((__result_type)__x, (__result_type)__y, (__result_type)__z); } // fmax -inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);} +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float fmax(float __x, float __y) _NOEXCEPT {return __builtin_fmaxf(__x, __y);} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fmax(double __x, double __y) _NOEXCEPT { + return __builtin_fmax(__x, __y); +} + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fmax(long double __x, long double __y) _NOEXCEPT {return __builtin_fmaxl(__x, __y);} template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +fmax(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y); + return ::fmax((__result_type)__x, (__result_type)__y); } // fmin -inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);} +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float fmin(float __x, float __y) _NOEXCEPT {return __builtin_fminf(__x, __y);} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double fmin(double __x, double __y) _NOEXCEPT { + return __builtin_fmin(__x, __y); +} + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double fmin(long double __x, long double __y) _NOEXCEPT {return __builtin_fminl(__x, __y);} template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +fmin(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y); + return ::fmin((__result_type)__x, (__result_type)__y); } // hypot -inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y) _NOEXCEPT {return __builtin_hypotf(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y) _NOEXCEPT { + return __builtin_hypot(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y) _NOEXCEPT {return __builtin_hypotl(__x, __y);} template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +hypot(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y); + return ::hypot((__result_type)__x, (__result_type)__y); } // ilogb -inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI int ilogb(float __x) _NOEXCEPT {return __builtin_ilogbf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double ilogb(double __x) _NOEXCEPT { + return __builtin_ilogb(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI int ilogb(long double __x) _NOEXCEPT {return __builtin_ilogbl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, int>::type -ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);} +ilogb(_A1 __x) _NOEXCEPT {return __builtin_ilogb((double)__x);} // lgamma -inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float lgamma(float __x) _NOEXCEPT {return __builtin_lgammaf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double lgamma(double __x) _NOEXCEPT { + return __builtin_lgamma(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double lgamma(long double __x) _NOEXCEPT {return __builtin_lgammal(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);} +lgamma(_A1 __x) _NOEXCEPT {return __builtin_lgamma((double)__x);} // llrint -inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT +inline _LIBCPP_HIDE_FROM_ABI long long llrint(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_llrintf) - return __builtin_llrintf(__lcpp_x); -#else - return ::llrintf(__lcpp_x); -#endif + return __builtin_llrintf(__x); +} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI long long llrint(double __x) _NOEXCEPT { + return __builtin_llrint(__x); } -inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT + +inline _LIBCPP_HIDE_FROM_ABI long long llrint(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_llrintl) - return __builtin_llrintl(__lcpp_x); -#else - return ::llrintl(__lcpp_x); -#endif + return __builtin_llrintl(__x); } template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, long long>::type -llrint(_A1 __lcpp_x) _NOEXCEPT +llrint(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_llrint) - return __builtin_llrint((double)__lcpp_x); -#else - return ::llrint((double)__lcpp_x); -#endif + return __builtin_llrint((double)__x); } // llround -inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT +inline _LIBCPP_HIDE_FROM_ABI long long llround(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_llroundf) - return __builtin_llroundf(__lcpp_x); -#else - return ::llroundf(__lcpp_x); -#endif + return __builtin_llroundf(__x); +} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI long long llround(double __x) _NOEXCEPT { + return __builtin_llround(__x); } -inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT + +inline _LIBCPP_HIDE_FROM_ABI long long llround(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_llroundl) - return __builtin_llroundl(__lcpp_x); -#else - return ::llroundl(__lcpp_x); -#endif + return __builtin_llroundl(__x); } template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, long long>::type -llround(_A1 __lcpp_x) _NOEXCEPT +llround(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_llround) - return __builtin_llround((double)__lcpp_x); -#else - return ::llround((double)__lcpp_x); -#endif + return __builtin_llround((double)__x); } // log1p -inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float log1p(float __x) _NOEXCEPT {return __builtin_log1pf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double log1p(double __x) _NOEXCEPT { + return __builtin_log1p(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double log1p(long double __x) _NOEXCEPT {return __builtin_log1pl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);} +log1p(_A1 __x) _NOEXCEPT {return __builtin_log1p((double)__x);} // log2 -inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float log2(float __x) _NOEXCEPT {return __builtin_log2f(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double log2(double __x) _NOEXCEPT { + return __builtin_log2(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double log2(long double __x) _NOEXCEPT {return __builtin_log2l(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);} +log2(_A1 __x) _NOEXCEPT {return __builtin_log2((double)__x);} // logb -inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float logb(float __x) _NOEXCEPT {return __builtin_logbf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double logb(double __x) _NOEXCEPT { + return __builtin_logb(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double logb(long double __x) _NOEXCEPT {return __builtin_logbl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);} +logb(_A1 __x) _NOEXCEPT {return __builtin_logb((double)__x);} // lrint -inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT +inline _LIBCPP_HIDE_FROM_ABI long lrint(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_lrintf) - return __builtin_lrintf(__lcpp_x); -#else - return ::lrintf(__lcpp_x); -#endif + return __builtin_lrintf(__x); +} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI long lrint(double __x) _NOEXCEPT { + return __builtin_lrint(__x); } -inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT + +inline _LIBCPP_HIDE_FROM_ABI long lrint(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_lrintl) - return __builtin_lrintl(__lcpp_x); -#else - return ::lrintl(__lcpp_x); -#endif + return __builtin_lrintl(__x); } template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, long>::type -lrint(_A1 __lcpp_x) _NOEXCEPT +lrint(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_lrint) - return __builtin_lrint((double)__lcpp_x); -#else - return ::lrint((double)__lcpp_x); -#endif + return __builtin_lrint((double)__x); } // lround -inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT +inline _LIBCPP_HIDE_FROM_ABI long lround(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_lroundf) - return __builtin_lroundf(__lcpp_x); -#else - return ::lroundf(__lcpp_x); -#endif + return __builtin_lroundf(__x); +} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI long lround(double __x) _NOEXCEPT { + return __builtin_lround(__x); } -inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT + +inline _LIBCPP_HIDE_FROM_ABI long lround(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_lroundl) - return __builtin_lroundl(__lcpp_x); -#else - return ::lroundl(__lcpp_x); -#endif + return __builtin_lroundl(__x); } template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, long>::type -lround(_A1 __lcpp_x) _NOEXCEPT +lround(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_lround) - return __builtin_lround((double)__lcpp_x); -#else - return ::lround((double)__lcpp_x); -#endif + return __builtin_lround((double)__x); } // nan // nearbyint -inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);} +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float nearbyint(float __x) _NOEXCEPT {return __builtin_nearbyintf(__x);} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double nearbyint(double __x) _NOEXCEPT { + return __builtin_nearbyint(__x); +} + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double nearbyint(long double __x) _NOEXCEPT {return __builtin_nearbyintl(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);} +nearbyint(_A1 __x) _NOEXCEPT {return __builtin_nearbyint((double)__x);} // nextafter -inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_HIDE_FROM_ABI float nextafter(float __x, float __y) _NOEXCEPT {return __builtin_nextafterf(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double nextafter(double __x, double __y) _NOEXCEPT { + return __builtin_nextafter(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double nextafter(long double __x, long double __y) _NOEXCEPT {return __builtin_nextafterl(__x, __y);} template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +nextafter(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y); + return ::nextafter((__result_type)__x, (__result_type)__y); } // nexttoward -inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_HIDE_FROM_ABI float nexttoward(float __x, long double __y) _NOEXCEPT {return __builtin_nexttowardf(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double nexttoward(double __x, long double __y) _NOEXCEPT { + return __builtin_nexttoward(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double nexttoward(long double __x, long double __y) _NOEXCEPT {return __builtin_nexttowardl(__x, __y);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);} +nexttoward(_A1 __x, long double __y) _NOEXCEPT {return __builtin_nexttoward((double)__x, __y);} // remainder -inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_HIDE_FROM_ABI float remainder(float __x, float __y) _NOEXCEPT {return __builtin_remainderf(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double remainder(double __x, double __y) _NOEXCEPT { + return __builtin_remainder(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double remainder(long double __x, long double __y) _NOEXCEPT {return __builtin_remainderl(__x, __y);} template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +remainder(_A1 __x, _A2 __y) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y); + return ::remainder((__result_type)__x, (__result_type)__y); } // remquo -inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);} -inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);} +inline _LIBCPP_HIDE_FROM_ABI float remquo(float __x, float __y, int* __z) _NOEXCEPT {return __builtin_remquof(__x, __y, __z);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double remquo(double __x, double __y, int* __z) _NOEXCEPT { + return __builtin_remquo(__x, __y, __z); +} + +inline _LIBCPP_HIDE_FROM_ABI long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return __builtin_remquol(__x, __y, __z);} template <class _A1, class _A2> -inline _LIBCPP_INLINE_VISIBILITY -typename std::_EnableIf +inline _LIBCPP_HIDE_FROM_ABI +typename std::__enable_if_t < std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, std::__promote<_A1, _A2> >::type -remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT +remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT { typedef typename std::__promote<_A1, _A2>::type __result_type; static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value)), ""); - return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z); + return ::remquo((__result_type)__x, (__result_type)__y, __z); } // rint -inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float rint(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_rintf) - return __builtin_rintf(__lcpp_x); -#else - return ::rintf(__lcpp_x); -#endif + return __builtin_rintf(__x); +} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double rint(double __x) _NOEXCEPT { + return __builtin_rint(__x); } -inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_rintl) - return __builtin_rintl(__lcpp_x); -#else - return ::rintl(__lcpp_x); -#endif + return __builtin_rintl(__x); } template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -rint(_A1 __lcpp_x) _NOEXCEPT +rint(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_rint) - return __builtin_rint((double)__lcpp_x); -#else - return ::rint((double)__lcpp_x); -#endif + return __builtin_rint((double)__x); } // round -inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_round) - return __builtin_round(__lcpp_x); -#else - return ::round(__lcpp_x); -#endif + return __builtin_round(__x); +} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double round(double __x) _NOEXCEPT { + return __builtin_round(__x); } -inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_roundl) - return __builtin_roundl(__lcpp_x); -#else - return ::roundl(__lcpp_x); -#endif + return __builtin_roundl(__x); } template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -round(_A1 __lcpp_x) _NOEXCEPT +round(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_round) - return __builtin_round((double)__lcpp_x); -#else - return ::round((double)__lcpp_x); -#endif + return __builtin_round((double)__x); } // scalbln -inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_HIDE_FROM_ABI float scalbln(float __x, long __y) _NOEXCEPT {return __builtin_scalblnf(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double scalbln(double __x, long __y) _NOEXCEPT { + return __builtin_scalbln(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double scalbln(long double __x, long __y) _NOEXCEPT {return __builtin_scalblnl(__x, __y);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);} +scalbln(_A1 __x, long __y) _NOEXCEPT {return __builtin_scalbln((double)__x, __y);} // scalbn -inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);} -inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);} +inline _LIBCPP_HIDE_FROM_ABI float scalbn(float __x, int __y) _NOEXCEPT {return __builtin_scalbnf(__x, __y);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double scalbn(double __x, int __y) _NOEXCEPT { + return __builtin_scalbn(__x, __y); +} + +inline _LIBCPP_HIDE_FROM_ABI long double scalbn(long double __x, int __y) _NOEXCEPT {return __builtin_scalbnl(__x, __y);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);} +scalbn(_A1 __x, int __y) _NOEXCEPT {return __builtin_scalbn((double)__x, __y);} // tgamma -inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);} -inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);} +inline _LIBCPP_HIDE_FROM_ABI float tgamma(float __x) _NOEXCEPT {return __builtin_tgammaf(__x);} + +template <class = int> +_LIBCPP_HIDE_FROM_ABI double tgamma(double __x) _NOEXCEPT { + return __builtin_tgamma(__x); +} + +inline _LIBCPP_HIDE_FROM_ABI long double tgamma(long double __x) _NOEXCEPT {return __builtin_tgammal(__x);} template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);} +tgamma(_A1 __x) _NOEXCEPT {return __builtin_tgamma((double)__x);} // trunc -inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_trunc) - return __builtin_trunc(__lcpp_x); -#else - return ::trunc(__lcpp_x); -#endif + return __builtin_trunc(__x); +} + +template <class = int> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI double trunc(double __x) _NOEXCEPT { + return __builtin_trunc(__x); } -inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT + +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_truncl) - return __builtin_truncl(__lcpp_x); -#else - return ::truncl(__lcpp_x); -#endif + return __builtin_truncl(__x); } template <class _A1> -inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, double>::type -trunc(_A1 __lcpp_x) _NOEXCEPT +trunc(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_trunc) - return __builtin_trunc((double)__lcpp_x); -#else - return ::trunc((double)__lcpp_x); -#endif + return __builtin_trunc((double)__x); } } // extern "C++" diff --git a/gnu/llvm/libcxx/include/module.modulemap b/gnu/llvm/libcxx/include/module.modulemap deleted file mode 100644 index d02a2b2852e..00000000000 --- a/gnu/llvm/libcxx/include/module.modulemap +++ /dev/null @@ -1,900 +0,0 @@ -// define the module for __config outside of the top level 'std' module -// since __config may be included from C headers which may create an -// include cycle. -module std_config [system] [extern_c] { - header "__config" -} - -module std [system] { - export std_config - // FIXME: The standard does not require that each of these submodules - // re-exports its imported modules. We should provide an alternative form of - // export that issues a warning if a name from the submodule is used, and - // use that to provide a 'strict mode' for libc++. - - // Deprecated C-compatibility headers. These can all be included from within - // an 'extern "C"' context. - module depr [extern_c] { - // <assert.h> provided by C library. - module ctype_h { - header "ctype.h" - export * - } - module errno_h { - header "errno.h" - export * - } - module fenv_h { - header "fenv.h" - export * - } - // <float.h> provided by compiler or C library. - module inttypes_h { - header "inttypes.h" - export stdint_h - export * - } - // <iso646.h> provided by compiler. - // <limits.h> provided by compiler or C library. - module locale_h { - header "locale.h" - export * - } - module math_h { - header "math.h" - export * - } - module setjmp_h { - header "setjmp.h" - export * - } - // FIXME: <stdalign.h> is missing. - // <signal.h> provided by C library. - // <stdarg.h> provided by compiler. - // <stdbool.h> provided by compiler. - module stddef_h { - // <stddef.h>'s __need_* macros require textual inclusion. - textual header "stddef.h" - } - module stdint_h { - header "stdint.h" - export * - // FIXME: This module only exists on OS X and for some reason the - // wildcard above doesn't export it. - export Darwin.C.stdint - } - module stdio_h { - // <stdio.h>'s __need_* macros require textual inclusion. - textual header "stdio.h" - export * - export Darwin.C.stdio - } - module stdlib_h { - // <stdlib.h>'s __need_* macros require textual inclusion. - textual header "stdlib.h" - export * - } - module string_h { - header "string.h" - export * - } - // FIXME: <uchar.h> is missing. - // <time.h> provided by C library. - module wchar_h { - // <wchar.h>'s __need_* macros require textual inclusion. - textual header "wchar.h" - export * - } - module wctype_h { - header "wctype.h" - export * - } - } - - // <complex.h> and <tgmath.h> are not C headers in any real sense, do not - // allow their use in extern "C" contexts. - module complex_h { - header "complex.h" - export ccomplex - export * - } - module tgmath_h { - header "tgmath.h" - export ccomplex - export cmath - export * - } - - // C compatibility headers. - module compat { - module cassert { - // <cassert>'s use of NDEBUG requires textual inclusion. - textual header "cassert" - } - module ccomplex { - header "ccomplex" - export complex - export * - } - module cctype { - header "cctype" - export * - } - module cerrno { - header "cerrno" - export * - } - module cfenv { - header "cfenv" - export * - } - module cfloat { - header "cfloat" - export * - } - module cinttypes { - header "cinttypes" - export cstdint - export * - } - module ciso646 { - header "ciso646" - export * - } - module climits { - header "climits" - export * - } - module clocale { - header "clocale" - export * - } - module cmath { - header "cmath" - export * - } - module csetjmp { - header "csetjmp" - export * - } - module csignal { - header "csignal" - export * - } - // FIXME: <cstdalign> is missing. - module cstdarg { - header "cstdarg" - export * - } - module cstdbool { - header "cstdbool" - export * - } - module cstddef { - header "cstddef" - export * - } - module cstdint { - header "cstdint" - export depr.stdint_h - export * - } - module cstdio { - header "cstdio" - export * - } - module cstdlib { - header "cstdlib" - export * - } - module cstring { - header "cstring" - export * - } - module ctgmath { - header "ctgmath" - export ccomplex - export cmath - export * - } - module ctime { - header "ctime" - export * - } - // FIXME: <cuchar> is missing. - module cwchar { - header "cwchar" - export depr.stdio_h - export * - } - module cwctype { - header "cwctype" - export * - } - } - - module algorithm { - header "algorithm" - export initializer_list - export * - - module __algorithm { - module adjacent_find { private header "__algorithm/adjacent_find.h" } - module all_of { private header "__algorithm/all_of.h" } - module any_of { private header "__algorithm/any_of.h" } - module binary_search { private header "__algorithm/binary_search.h" } - module clamp { private header "__algorithm/clamp.h" } - module comp { private header "__algorithm/comp.h" } - module comp_ref_type { private header "__algorithm/comp_ref_type.h" } - module copy { private header "__algorithm/copy.h" } - module copy_backward { private header "__algorithm/copy_backward.h" } - module copy_if { private header "__algorithm/copy_if.h" } - module copy_n { private header "__algorithm/copy_n.h" } - module count { private header "__algorithm/count.h" } - module count_if { private header "__algorithm/count_if.h" } - module equal { private header "__algorithm/equal.h" } - module equal_range { private header "__algorithm/equal_range.h" } - module fill { private header "__algorithm/fill.h" } - module fill_n { private header "__algorithm/fill_n.h" } - module find { private header "__algorithm/find.h" } - module find_end { private header "__algorithm/find_end.h" } - module find_first_of { private header "__algorithm/find_first_of.h" } - module find_if { private header "__algorithm/find_if.h" } - module find_if_not { private header "__algorithm/find_if_not.h" } - module for_each { private header "__algorithm/for_each.h" } - module for_each_n { private header "__algorithm/for_each_n.h" } - module generate { private header "__algorithm/generate.h" } - module generate_n { private header "__algorithm/generate_n.h" } - module half_positive { private header "__algorithm/half_positive.h" } - module includes { private header "__algorithm/includes.h" } - module inplace_merge { private header "__algorithm/inplace_merge.h" } - module is_heap { private header "__algorithm/is_heap.h" } - module is_heap_until { private header "__algorithm/is_heap_until.h" } - module is_partitioned { private header "__algorithm/is_partitioned.h" } - module is_permutation { private header "__algorithm/is_permutation.h" } - module is_sorted { private header "__algorithm/is_sorted.h" } - module is_sorted_until { private header "__algorithm/is_sorted_until.h" } - module iter_swap { private header "__algorithm/iter_swap.h" } - module lexicographical_compare { private header "__algorithm/lexicographical_compare.h" } - module lower_bound { private header "__algorithm/lower_bound.h" } - module make_heap { private header "__algorithm/make_heap.h" } - module max { private header "__algorithm/max.h" } - module max_element { private header "__algorithm/max_element.h" } - module merge { private header "__algorithm/merge.h" } - module min { private header "__algorithm/min.h" } - module min_element { private header "__algorithm/min_element.h" } - module minmax { private header "__algorithm/minmax.h" } - module minmax_element { private header "__algorithm/minmax_element.h" } - module mismatch { private header "__algorithm/mismatch.h" } - module move { private header "__algorithm/move.h" } - module move_backward { private header "__algorithm/move_backward.h" } - module next_permutation { private header "__algorithm/next_permutation.h" } - module none_of { private header "__algorithm/none_of.h" } - module nth_element { private header "__algorithm/nth_element.h" } - module partial_sort { private header "__algorithm/partial_sort.h" } - module partial_sort_copy { private header "__algorithm/partial_sort_copy.h" } - module partition { private header "__algorithm/partition.h" } - module partition_copy { private header "__algorithm/partition_copy.h" } - module partition_point { private header "__algorithm/partition_point.h" } - module pop_heap { private header "__algorithm/pop_heap.h" } - module prev_permutation { private header "__algorithm/prev_permutation.h" } - module push_heap { private header "__algorithm/push_heap.h" } - module ranges_find { private header "__algorithm/ranges_find.h" } - module ranges_find_if { private header "__algorithm/ranges_find_if.h" } - module ranges_find_if_not { private header "__algorithm/ranges_find_if_not.h" } - module remove { private header "__algorithm/remove.h" } - module remove_copy { private header "__algorithm/remove_copy.h" } - module remove_copy_if { private header "__algorithm/remove_copy_if.h" } - module remove_if { private header "__algorithm/remove_if.h" } - module replace { private header "__algorithm/replace.h" } - module replace_copy { private header "__algorithm/replace_copy.h" } - module replace_copy_if { private header "__algorithm/replace_copy_if.h" } - module replace_if { private header "__algorithm/replace_if.h" } - module reverse { private header "__algorithm/reverse.h" } - module reverse_copy { private header "__algorithm/reverse_copy.h" } - module rotate { private header "__algorithm/rotate.h" } - module rotate_copy { private header "__algorithm/rotate_copy.h" } - module sample { private header "__algorithm/sample.h" } - module search { private header "__algorithm/search.h" } - module search_n { private header "__algorithm/search_n.h" } - module set_difference { private header "__algorithm/set_difference.h" } - module set_intersection { private header "__algorithm/set_intersection.h" } - module set_symmetric_difference { private header "__algorithm/set_symmetric_difference.h" } - module set_union { private header "__algorithm/set_union.h" } - module shift_left { private header "__algorithm/shift_left.h" } - module shift_right { private header "__algorithm/shift_right.h" } - module shuffle { private header "__algorithm/shuffle.h" } - module sift_down { private header "__algorithm/sift_down.h" } - module sort { private header "__algorithm/sort.h" } - module sort_heap { private header "__algorithm/sort_heap.h" } - module stable_partition { private header "__algorithm/stable_partition.h" } - module stable_sort { private header "__algorithm/stable_sort.h" } - module swap_ranges { private header "__algorithm/swap_ranges.h" } - module transform { private header "__algorithm/transform.h" } - module unique { private header "__algorithm/unique.h" } - module unique_copy { private header "__algorithm/unique_copy.h" } - module unwrap_iter { private header "__algorithm/unwrap_iter.h" } - module upper_bound { private header "__algorithm/upper_bound.h" } - } - } - module any { - header "any" - export * - } - module array { - header "array" - export initializer_list - export * - } - module atomic { - header "atomic" - export * - } - module barrier { - requires cplusplus14 - header "barrier" - export * - } - module bit { - header "bit" - export * - } - module bitset { - header "bitset" - export string - export iosfwd - export * - } - // No submodule for cassert. It fundamentally needs repeated, textual inclusion. - module charconv { - header "charconv" - export * - } - module chrono { - header "chrono" - export * - } - module codecvt { - header "codecvt" - export * - } - module compare { - header "compare" - export * - } - module complex { - header "complex" - export * - } - module concepts { - header "concepts" - export * - } - module condition_variable { - header "condition_variable" - export * - } - module deque { - header "deque" - export initializer_list - export * - } - module exception { - header "exception" - export * - } - module execution { - header "execution" - export * - } - module filesystem { - header "filesystem" - export * - } - module format { - header "format" - export * - - module __format { - module format_error { private header "__format/format_error.h" } - module format_parse_context { private header "__format/format_parse_context.h" } - } - } - module forward_list { - header "forward_list" - export initializer_list - export * - } - module fstream { - header "fstream" - export * - } - module functional { - header "functional" - export * - - module __functional { - module binary_function { private header "__functional/binary_function.h" } - module binary_negate { private header "__functional/binary_negate.h" } - module bind { private header "__functional/bind.h" } - module bind_front { private header "__functional/bind_front.h" } - module binder1st { private header "__functional/binder1st.h" } - module binder2nd { private header "__functional/binder2nd.h" } - module default_searcher { private header "__functional/default_searcher.h" } - module function { private header "__functional/function.h" } - module hash { private header "__functional/hash.h" } - module identity { private header "__functional/identity.h" } - module is_transparent { private header "__functional/is_transparent.h" } - module invoke { private header "__functional/invoke.h" } - module mem_fn { private header "__functional/mem_fn.h" } - module mem_fun_ref { private header "__functional/mem_fun_ref.h" } - module not_fn { private header "__functional/not_fn.h" } - module operations { private header "__functional/operations.h" } - module perfect_forward { private header "__functional/perfect_forward.h" } - module pointer_to_binary_function { private header "__functional/pointer_to_binary_function.h" } - module pointer_to_unary_function { private header "__functional/pointer_to_unary_function.h" } - module ranges_operations { private header "__functional/ranges_operations.h" } - module reference_wrapper { private header "__functional/reference_wrapper.h" } - module unary_function { private header "__functional/unary_function.h" } - module unary_negate { private header "__functional/unary_negate.h" } - module unwrap_ref { private header "__functional/unwrap_ref.h" } - module weak_result_type { private header "__functional/weak_result_type.h" } - } - } - module future { - header "future" - export * - } - module initializer_list { - header "initializer_list" - export * - } - module iomanip { - header "iomanip" - export * - } - module ios { - header "ios" - export iosfwd - export * - } - module iosfwd { - header "iosfwd" - export * - } - module iostream { - header "iostream" - export ios - export streambuf - export istream - export ostream - export * - } - module istream { - header "istream" - // FIXME: should re-export ios, streambuf? - export * - } - module iterator { - header "iterator" - export * - - module __iterator { - module access { private header "__iterator/access.h" } - module advance { - private header "__iterator/advance.h" - export __function_like - } - module back_insert_iterator { private header "__iterator/back_insert_iterator.h" } - module common_iterator { private header "__iterator/common_iterator.h" } - module concepts { private header "__iterator/concepts.h" } - module counted_iterator { private header "__iterator/counted_iterator.h" } - module data { private header "__iterator/data.h" } - module default_sentinel { private header "__iterator/default_sentinel.h" } - module distance { private header "__iterator/distance.h" } - module empty { private header "__iterator/empty.h" } - module erase_if_container { private header "__iterator/erase_if_container.h" } - module front_insert_iterator { private header "__iterator/front_insert_iterator.h" } - module incrementable_traits { private header "__iterator/incrementable_traits.h" } - module insert_iterator { private header "__iterator/insert_iterator.h" } - module istream_iterator { private header "__iterator/istream_iterator.h" } - module istreambuf_iterator { private header "__iterator/istreambuf_iterator.h" } - module iter_move { private header "__iterator/iter_move.h" } - module iter_swap { private header "__iterator/iter_swap.h" } - module iterator { private header "__iterator/iterator.h" } - module iterator_traits { private header "__iterator/iterator_traits.h" } - module move_iterator { private header "__iterator/move_iterator.h" } - module next { - private header "__iterator/next.h" - export __function_like - } - module ostream_iterator { private header "__iterator/ostream_iterator.h" } - module ostreambuf_iterator { private header "__iterator/ostreambuf_iterator.h" } - module prev { - private header "__iterator/prev.h" - export __function_like - } - module projected { private header "__iterator/projected.h" } - module readable_traits { private header "__iterator/readable_traits.h" } - module reverse_access { private header "__iterator/reverse_access.h" } - module reverse_iterator { private header "__iterator/reverse_iterator.h" } - module size { private header "__iterator/size.h" } - module wrap_iter { private header "__iterator/wrap_iter.h" } - } - } - module latch { - requires cplusplus14 - header "latch" - export * - } - module limits { - header "limits" - export * - } - module list { - header "list" - export initializer_list - export * - } - module locale { - header "locale" - export * - } - module map { - header "map" - export initializer_list - export * - } - module memory { - header "memory" - export * - - module __memory { - module addressof { private header "__memory/addressof.h" } - module allocation_guard { private header "__memory/allocation_guard.h" } - module allocator { private header "__memory/allocator.h" } - module allocator_arg_t { private header "__memory/allocator_arg_t.h" } - module allocator_traits { private header "__memory/allocator_traits.h" } - module auto_ptr { private header "__memory/auto_ptr.h" } - module compressed_pair { private header "__memory/compressed_pair.h" } - module construct_at { private header "__memory/construct_at.h" } - module pointer_safety { private header "__memory/pointer_safety.h" } - module pointer_traits { private header "__memory/pointer_traits.h" } - module raw_storage_iterator { private header "__memory/raw_storage_iterator.h" } - module shared_ptr { private header "__memory/shared_ptr.h" } - module temporary_buffer { private header "__memory/temporary_buffer.h" } - module uninitialized_algorithms { private header "__memory/uninitialized_algorithms.h" } - module unique_ptr { private header "__memory/unique_ptr.h" } - module uses_allocator { private header "__memory/uses_allocator.h" } - } - } - module mutex { - header "mutex" - export * - } - module new { - header "new" - export * - } - module numbers { - header "numbers" - export * - } - module numeric { - header "numeric" - export * - } - module optional { - header "optional" - export * - } - module ostream { - header "ostream" - // FIXME: should re-export ios, streambuf? - export * - } - module queue { - header "queue" - export initializer_list - export * - } - module random { - header "random" - export initializer_list - export * - - module __random { - module uniform_int_distribution { private header "__random/uniform_int_distribution.h" } - } - } - module ranges { - header "ranges" - export compare - export initializer_list - export iterator - export * - - module __ranges { - module access { private header "__ranges/access.h" } - module all { private header "__ranges/all.h" } - module common_view { private header "__ranges/common_view.h" } - module concepts { private header "__ranges/concepts.h" } - module copyable_box { private header "__ranges/copyable_box.h" } - module dangling { private header "__ranges/dangling.h" } - module data { private header "__ranges/data.h" } - module drop_view { private header "__ranges/drop_view.h" } - module empty { private header "__ranges/empty.h" } - module empty_view { private header "__ranges/empty_view.h" } - module enable_borrowed_range { private header "__ranges/enable_borrowed_range.h" } - module enable_view { private header "__ranges/enable_view.h" } - module non_propagating_cache { private header "__ranges/non_propagating_cache.h" } - module ref_view { private header "__ranges/ref_view.h" } - module size { private header "__ranges/size.h" } - module subrange { private header "__ranges/subrange.h" } - module transform_view { private header "__ranges/transform_view.h" } - module view_interface { private header "__ranges/view_interface.h" } - } - } - module ratio { - header "ratio" - export * - } - module regex { - header "regex" - export initializer_list - export * - } - module scoped_allocator { - header "scoped_allocator" - export * - } - module semaphore { - requires cplusplus14 - header "semaphore" - export * - } - module set { - header "set" - export initializer_list - export * - } - module shared_mutex { - header "shared_mutex" - export version - } - module span { - header "span" - export ranges.__ranges.enable_borrowed_range - export version - } - module sstream { - header "sstream" - // FIXME: should re-export istream, ostream, ios, streambuf, string? - export * - } - module stack { - header "stack" - export initializer_list - export * - } - module stdexcept { - header "stdexcept" - export * - } - module streambuf { - header "streambuf" - export * - } - module string { - header "string" - export initializer_list - export string_view - export __string - export * - } - module string_view { - header "string_view" - export initializer_list - export __string - export * - } - module strstream { - header "strstream" - export * - } - module system_error { - header "system_error" - export * - } - module thread { - header "thread" - export * - } - module tuple { - header "tuple" - export * - } - module type_traits { - header "type_traits" - export functional.__functional.unwrap_ref - export * - } - module typeindex { - header "typeindex" - export * - } - module typeinfo { - header "typeinfo" - export * - } - module unordered_map { - header "unordered_map" - export initializer_list - export * - } - module unordered_set { - header "unordered_set" - export initializer_list - export * - } - module utility { - header "utility" - export initializer_list - export * - - module __utility { - module __decay_copy { private header "__utility/__decay_copy.h" } - module as_const { private header "__utility/as_const.h" } - module cmp { private header "__utility/cmp.h" } - module declval { private header "__utility/declval.h" } - module exchange { private header "__utility/exchange.h" } - module forward { private header "__utility/forward.h" } - module in_place { private header "__utility/in_place.h" } - module integer_sequence { private header "__utility/integer_sequence.h" } - module move { private header "__utility/move.h" } - module pair { private header "__utility/pair.h" } - module piecewise_construct { private header "__utility/piecewise_construct.h" } - module rel_ops { private header "__utility/rel_ops.h" } - module swap { private header "__utility/swap.h" } - module to_underlying { private header "__utility/to_underlying.h" } - } - } - module valarray { - header "valarray" - export initializer_list - export * - } - module variant { - header "variant" - export * - - module __variant { - module monostate { private header "__variant/monostate.h" } - } - } - module vector { - header "vector" - export initializer_list - export * - } - module version { - header "version" - export * - } - - // __config not modularised due to a bug in Clang - // FIXME: These should be private. - module __availability { private header "__availability" export * } - module __bit_reference { private header "__bit_reference" export * } - module __bits { private header "__bits" export * } - module __debug { header "__debug" export * } - module __errc { private header "__errc" export * } - module __function_like { private header "__function_like.h" export * } - module __hash_table { header "__hash_table" export * } - module __locale { private header "__locale" export * } - module __mutex_base { private header "__mutex_base" export * } - module __node_handle { private header "__node_handle" export * } - module __nullptr { header "__nullptr" export * } - module __split_buffer { private header "__split_buffer" export * } - module __std_stream { private header "__std_stream" export * } - module __string { private header "__string" export * } - module __threading_support { header "__threading_support" export * } - module __tree { header "__tree" export * } - module __tuple { private header "__tuple" export * } - module __undef_macros { header "__undef_macros" export * } - - module experimental { - requires cplusplus11 - - module algorithm { - header "experimental/algorithm" - export * - } - module coroutine { - requires coroutines - header "experimental/coroutine" - export * - } - module deque { - header "experimental/deque" - export * - } - module filesystem { - header "experimental/filesystem" - export * - } - module forward_list { - header "experimental/forward_list" - export * - } - module functional { - header "experimental/functional" - export * - } - module iterator { - header "experimental/iterator" - export * - } - module list { - header "experimental/list" - export * - } - module map { - header "experimental/map" - export * - } - module memory_resource { - header "experimental/memory_resource" - export * - } - module propagate_const { - header "experimental/propagate_const" - export * - } - module regex { - header "experimental/regex" - export * - } - module simd { - header "experimental/simd" - export * - } - module set { - header "experimental/set" - export * - } - module span { - header "span" - export * - } - module string { - header "experimental/string" - export * - } - module type_traits { - header "experimental/type_traits" - export * - } - module unordered_map { - header "experimental/unordered_map" - export * - } - module unordered_set { - header "experimental/unordered_set" - export * - } - module utility { - header "experimental/utility" - export * - } - module vector { - header "experimental/vector" - export * - } - // FIXME these should be private - module __memory { - header "experimental/__memory" - export * - } - } // end experimental -} diff --git a/gnu/llvm/libcxx/include/stdio.h b/gnu/llvm/libcxx/include/stdio.h index b57268c2641..72ed5c9f94a 100644 --- a/gnu/llvm/libcxx/include/stdio.h +++ b/gnu/llvm/libcxx/include/stdio.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===---------------------------- stdio.h ---------------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,7 +10,7 @@ #if defined(__need_FILE) || defined(__need___FILE) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header +# pragma GCC system_header #endif #include_next <stdio.h> @@ -101,10 +101,12 @@ void perror(const char* s); #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header +# pragma GCC system_header #endif -#include_next <stdio.h> +# if __has_include_next(<stdio.h>) +# include_next <stdio.h> +# endif #ifdef __cplusplus diff --git a/gnu/llvm/libcxx/include/stdlib.h b/gnu/llvm/libcxx/include/stdlib.h index 242eedc22a5..4dd3a9c14ab 100644 --- a/gnu/llvm/libcxx/include/stdlib.h +++ b/gnu/llvm/libcxx/include/stdlib.h @@ -1,5 +1,5 @@ // -*- C++ -*- -//===--------------------------- stdlib.h ---------------------------------===// +//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,7 +10,7 @@ #if defined(__need_malloc_and_calloc) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header +# pragma GCC system_header #endif #include_next <stdlib.h> @@ -87,43 +87,47 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 #include <__config> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header +# pragma GCC system_header #endif -#include_next <stdlib.h> +# if __has_include_next(<stdlib.h>) +# include_next <stdlib.h> +# endif #ifdef __cplusplus extern "C++" { // abs -#undef abs -#undef labs -#ifndef _LIBCPP_HAS_NO_LONG_LONG -#undef llabs +#ifdef abs +# undef abs +#endif +#ifdef labs +# undef labs +#endif +#ifdef llabs +# undef llabs #endif // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined #if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT { return __builtin_labs(__x); } -#ifndef _LIBCPP_HAS_NO_LONG_LONG -inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT { return __builtin_llabs(__x); } -#endif // _LIBCPP_HAS_NO_LONG_LONG #endif // !defined(_LIBCPP_MSVCRT) && !defined(__sun__) #if !defined(__sun__) -inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT { return __builtin_fabsf(__lcpp_x); // Use builtins to prevent needing math.h } -inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT { return __builtin_fabs(__lcpp_x); } -inline _LIBCPP_INLINE_VISIBILITY long double +_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY long double abs(long double __lcpp_x) _NOEXCEPT { return __builtin_fabsl(__lcpp_x); } @@ -131,10 +135,14 @@ abs(long double __lcpp_x) _NOEXCEPT { // div -#undef div -#undef ldiv -#ifndef _LIBCPP_HAS_NO_LONG_LONG -#undef lldiv +#ifdef div +# undef div +#endif +#ifdef ldiv +# undef ldiv +#endif +#ifdef lldiv +# undef lldiv #endif // MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined @@ -142,12 +150,12 @@ abs(long double __lcpp_x) _NOEXCEPT { inline _LIBCPP_INLINE_VISIBILITY ldiv_t div(long __x, long __y) _NOEXCEPT { return ::ldiv(__x, __y); } -#ifndef _LIBCPP_HAS_NO_LONG_LONG +#if !(defined(__FreeBSD__) && !defined(__LONG_LONG_SUPPORTED)) inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT { return ::lldiv(__x, __y); } -#endif // _LIBCPP_HAS_NO_LONG_LONG +#endif #endif // _LIBCPP_MSVCRT / __sun__ } // extern "C++" #endif // __cplusplus |