diff options
Diffstat (limited to 'libstdc++-v3/include/bits')
41 files changed, 238 insertions, 250 deletions
diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h index 130943d..bc757c3 100644 --- a/libstdc++-v3/include/bits/algorithmfwd.h +++ b/libstdc++-v3/include/bits/algorithmfwd.h @@ -39,6 +39,9 @@ #include <initializer_list> #endif +#define __glibcxx_want_constexpr_algorithms +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -191,10 +194,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // adjacent_find -#if __cplusplus > 201703L -# define __cpp_lib_constexpr_algorithms 201806L -#endif - #if __cplusplus >= 201103L template<typename _IIter, typename _Predicate> _GLIBCXX20_CONSTEXPR diff --git a/libstdc++-v3/include/bits/align.h b/libstdc++-v3/include/bits/align.h index 32d9349..4152639 100644 --- a/libstdc++-v3/include/bits/align.h +++ b/libstdc++-v3/include/bits/align.h @@ -32,6 +32,9 @@ #include <bits/c++config.h> +#define __glibcxx_want_assume_aligned +#include <bits/version.h> + #include <bit> // std::has_single_bit #include <stdint.h> // uintptr_t #include <debug/assertions.h> // _GLIBCXX_DEBUG_ASSERT @@ -75,8 +78,7 @@ align(size_t __align, size_t __size, void*& __ptr, size_t& __space) noexcept } } -#if __cplusplus > 201703L -#define __cpp_lib_assume_aligned 201811L +#ifdef __cpp_lib_assume_aligned // C++ >= 20 /** @brief Inform the compiler that a pointer is aligned. * * @tparam _Align An alignment value (i.e. a power of two) @@ -103,7 +105,7 @@ align(size_t __align, size_t __size, void*& __ptr, size_t& __space) noexcept return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Align)); } } -#endif // C++2a +#endif // __cpp_lib_assume_aligned _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h index bc936ec..453278e 100644 --- a/libstdc++-v3/include/bits/alloc_traits.h +++ b/libstdc++-v3/include/bits/alloc_traits.h @@ -40,13 +40,15 @@ # endif #endif +#define __glibcxx_want_constexpr_dynamic_alloc +#define __glibcxx_want_allocator_traits_is_always_equal +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L -#define __cpp_lib_allocator_traits_is_always_equal 201411L - /// @cond undocumented struct __allocator_traits_base { @@ -418,11 +420,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #if _GLIBCXX_HOSTED - -#if __cplusplus > 201703L -# define __cpp_lib_constexpr_dynamic_alloc 201907L -#endif - /// Partial specialization for std::allocator. template<typename _Tp> struct allocator_traits<allocator<_Tp>> diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index abbd753..41e35f8 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -49,7 +49,8 @@ #include <type_traits> #endif -#define __cpp_lib_incomplete_container_elements 201505L +#define __glibcxx_want_incomplete_container_elements +#include <bits/version.h> namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h index 3af6188..4ce04a0 100644 --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -46,6 +46,10 @@ #define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) #endif +#define __glibcxx_want_atomic_value_initialization +#define __glibcxx_want_atomic_flag_test +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -156,10 +160,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __ret; } -#if __cplusplus >= 202002L -# define __cpp_lib_atomic_value_initialization 201911L -#endif - /// @cond undocumented #if __cpp_lib_atomic_value_initialization # define _GLIBCXX20_INIT(I) = I @@ -234,9 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __atomic_test_and_set (&_M_i, int(__m)); } -#if __cplusplus > 201703L -#define __cpp_lib_atomic_flag_test 201907L - +#ifdef __cpp_lib_atomic_flag_test // C++ >= 20 _GLIBCXX_ALWAYS_INLINE bool test(memory_order __m = memory_order_seq_cst) const noexcept { @@ -252,8 +250,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __atomic_load(&_M_i, &__v, int(__m)); return __v == __GCC_ATOMIC_TEST_AND_SET_TRUEVAL; } +#endif -#if __cpp_lib_atomic_wait +#if __cpp_lib_atomic_wait // C++ >= 20 && (linux_futex || gthread) _GLIBCXX_ALWAYS_INLINE void wait(bool __old, memory_order __m = memory_order_seq_cst) const noexcept @@ -279,7 +278,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // TODO add const volatile overload #endif // __cpp_lib_atomic_wait -#endif // C++20 _GLIBCXX_ALWAYS_INLINE void clear(memory_order __m = memory_order_seq_cst) noexcept diff --git a/libstdc++-v3/include/bits/atomic_wait.h b/libstdc++-v3/include/bits/atomic_wait.h index 67c0e3b..9cbfb99 100644 --- a/libstdc++-v3/include/bits/atomic_wait.h +++ b/libstdc++-v3/include/bits/atomic_wait.h @@ -32,8 +32,10 @@ #pragma GCC system_header -#include <bits/c++config.h> -#if defined _GLIBCXX_HAS_GTHREADS || defined _GLIBCXX_HAVE_LINUX_FUTEX +#define __glibcxx_want_atomic_wait +#include <bits/version.h> + +#if __cpp_lib_atomic_wait #include <bits/functional_hash.h> #include <bits/gthr.h> #include <ext/numeric_traits.h> @@ -48,8 +50,6 @@ # include <bits/std_mutex.h> // std::mutex, std::__condvar -#define __cpp_lib_atomic_wait 201907L - namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -476,5 +476,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } _GLIBCXX_END_NAMESPACE_VERSION } // namespace std -#endif // GTHREADS || LINUX_FUTEX +#endif // __cpp_lib_atomic_wait #endif // _GLIBCXX_ATOMIC_WAIT_H diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 170a436..c68e617 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -47,22 +47,20 @@ # include <string_view> #endif +#define __glibcxx_want_constexpr_string +#define __glibcxx_want_string_resize_and_overwrite +#define __glibcxx_want_string_udls +#include <bits/version.h> + #if ! _GLIBCXX_USE_CXX11_ABI # include "cow_string.h" #else + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_CXX11 -#ifdef __cpp_lib_is_constant_evaluated -// Support P0980R1 in C++20. -# define __cpp_lib_constexpr_string 201907L -#elif __cplusplus >= 201703L && _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED -// Support P0426R1 changes to char_traits in C++17. -# define __cpp_lib_constexpr_string 201611L -#endif - /** * @class basic_string basic_string.h <string> * @brief Managing sequences of characters and character-like objects. @@ -1118,8 +1116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #pragma GCC diagnostic pop #endif -#if __cplusplus > 202002L -#define __cpp_lib_string_resize_and_overwrite 202110L +#ifdef __cpp_lib_string_resize_and_overwrite // C++ >= 23 /** Resize the string and call a function to fill it. * * @param __n The maximum size requested. @@ -4491,10 +4488,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; #endif -#if __cplusplus >= 201402L - -#define __cpp_lib_string_udls 201304L - +#ifdef __cpp_lib_string_udls // C++ >= 14 inline namespace literals { inline namespace string_literals @@ -4539,6 +4533,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #pragma GCC diagnostic pop } // inline namespace string_literals } // inline namespace literals +#endif // __cpp_lib_string_udls #if __cplusplus >= 201703L namespace __detail::__variant @@ -4556,7 +4551,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; } // namespace __detail::__variant #endif // C++17 -#endif // C++14 _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index 0928137..e9b4e84 100644 --- a/libstdc++-v3/include/bits/char_traits.h +++ b/libstdc++-v3/include/bits/char_traits.h @@ -61,6 +61,9 @@ # define _GLIBCXX_ALWAYS_INLINE inline __attribute__((__always_inline__)) #endif +#define __glibcxx_want_constexpr_char_traits +#include <bits/version.h> + namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -316,14 +319,6 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION -#ifdef __cpp_lib_is_constant_evaluated -// Unofficial macro indicating P1032R1 support in C++20 -# define __cpp_lib_constexpr_char_traits 201811L -#elif __cplusplus >= 201703L && _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED -// Unofficial macro indicating P0426R1 support in C++17 -# define __cpp_lib_constexpr_char_traits 201611L -#endif - // 21.1 /** * @brief Basis for explicit traits specializations. diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h index b2713d5..50aca84 100644 --- a/libstdc++-v3/include/bits/chrono.h +++ b/libstdc++-v3/include/bits/chrono.h @@ -32,6 +32,10 @@ #pragma GCC system_header +#define __glibcxx_want_chrono +#define __glibcxx_want_chrono_udls +#include <bits/version.h> + #if __cplusplus >= 201103L #include <ratio> @@ -370,9 +374,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; #endif // C++20 -#if __cplusplus >= 201703L -# define __cpp_lib_chrono 201611L - +#ifdef __cpp_lib_chrono // C++ >= 17 && HOSTED /** Convert a `duration` to type `ToDur` and round down. * * If the duration cannot be represented exactly in the result type, @@ -466,7 +468,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Make chrono::ceil<D> also usable as chrono::__detail::ceil<D>. namespace __detail { using chrono::ceil; } -#else // ! C++17 +#else // ! __cpp_lib_chrono // We want to use ceil even when compiling for earlier standards versions. // C++11 only allows a single statement in a constexpr function, so we @@ -488,7 +490,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __detail::__ceil_impl(chrono::duration_cast<_ToDur>(__d), __d); } } -#endif // C++17 +#endif // __cpp_lib_chrono /// duration_values template<typename _Rep> @@ -1312,9 +1314,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) #endif // C++20 } // namespace chrono -#if __cplusplus >= 201402L -#define __cpp_lib_chrono_udls 201304L - +#ifdef __cpp_lib_chrono_udls // C++ >= 14 && HOSTED inline namespace literals { /** ISO C++ 2014 namespace for suffixes for duration literals. @@ -1435,7 +1435,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) { using namespace literals::chrono_literals; } // namespace chrono -#endif // C++14 +#endif // __cpp_lib_chrono_udls #if __cplusplus >= 201703L namespace filesystem diff --git a/libstdc++-v3/include/bits/cow_string.h b/libstdc++-v3/include/bits/cow_string.h index e5f094f..bf676ed 100644 --- a/libstdc++-v3/include/bits/cow_string.h +++ b/libstdc++-v3/include/bits/cow_string.h @@ -36,13 +36,8 @@ #include <ext/atomicity.h> // _Atomic_word, __is_single_threaded -#ifdef __cpp_lib_is_constant_evaluated -// Support P1032R1 in C++20 (but not P0980R1 for COW strings). -# define __cpp_lib_constexpr_string 201811L -#elif __cplusplus >= 201703L && _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED -// Support P0426R1 changes to char_traits in C++17. -# define __cpp_lib_constexpr_string 201611L -#endif +#define __glibcxx_want_constexpr_string +#include <bits/version.h> namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/erase_if.h b/libstdc++-v3/include/bits/erase_if.h index bb1b53d..4ff81e0 100644 --- a/libstdc++-v3/include/bits/erase_if.h +++ b/libstdc++-v3/include/bits/erase_if.h @@ -32,18 +32,16 @@ #pragma GCC system_header -#if __cplusplus >= 201402L - #include <bits/c++config.h> +#define __glibcxx_want_erase_if +#include <bits/version.h> + +#if __cplusplus >= 201402L namespace std { _GLIBCXX_BEGIN_NAMESPACE_VERSION -#if __cplusplus > 201703L -# define __cpp_lib_erase_if 202002L -#endif - namespace __detail { template<typename _Container, typename _UnsafeContainer, @@ -70,7 +68,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace std - #endif // C++14 #endif // _GLIBCXX_ERASE_IF_H diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h index 72b1ef4..c56e430 100644 --- a/libstdc++-v3/include/bits/forward_list.h +++ b/libstdc++-v3/include/bits/forward_list.h @@ -41,6 +41,9 @@ #include <ext/alloc_traits.h> #include <ext/aligned_buffer.h> +#define __glibcxx_want_list_remove_return_type +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -1180,8 +1183,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER /// @} private: -#if __cplusplus > 201703L -# define __cpp_lib_list_remove_return_type 201806L +#ifdef __cpp_lib_list_remove_return_type // C++20 && HOSTED using __remove_return_type = size_type; # define _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG \ __attribute__((__abi_tag__("__cxx20"))) diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index 954a1c7..4c12dc8 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -39,6 +39,9 @@ # include <bits/node_handle.h> #endif +#define __glibcxx_want_generic_unordered_lookup +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -756,9 +759,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::pair<const_iterator, const_iterator> equal_range(const key_type& __k) const; -#if __cplusplus >= 202002L -#define __cpp_lib_generic_unordered_lookup 201811L - +#ifdef __cpp_lib_generic_unordered_lookup // C++ >= 20 && HOSTED template<typename _Kt, typename = __has_is_transparent_t<_Hash, _Kt>, typename = __has_is_transparent_t<_Equal, _Kt>> @@ -788,7 +789,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typename = __has_is_transparent_t<_Equal, _Kt>> pair<const_iterator, const_iterator> _M_equal_range_tr(const _Kt& __k) const; -#endif // C++20 +#endif // __cpp_lib_generic_unordered_lookup private: // Bucket index computation helpers. diff --git a/libstdc++-v3/include/bits/ios_base.h b/libstdc++-v3/include/bits/ios_base.h index addfd05..3253eaa 100644 --- a/libstdc++-v3/include/bits/ios_base.h +++ b/libstdc++-v3/include/bits/ios_base.h @@ -46,6 +46,9 @@ # include <system_error> #endif +#define __glibcxx_want_ios_noreplace +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -473,8 +476,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static const openmode __noreplace = _S_noreplace; -#if __cplusplus >= 202100L -#define __cpp_lib_ios_noreplace 202207L +#ifdef __cpp_lib_ios_noreplace // C++ >= 23 && HOSTED /// Open a file in exclusive mode. static const openmode noreplace = _S_noreplace; #endif diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h index 4a8fcef..00997d6 100644 --- a/libstdc++-v3/include/bits/move.h +++ b/libstdc++-v3/include/bits/move.h @@ -37,6 +37,9 @@ # include <type_traits> // Brings in std::declval too. #endif +#define __glibcxx_want_addressof_constexpr +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -120,11 +123,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // declval, from type_traits. -#if __cplusplus > 201402L - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // 2296. std::addressof should be constexpr -# define __cpp_lib_addressof_constexpr 201603L -#endif /** * @brief Returns the actual address of the object or function * referenced by r, even in the presence of an overloaded diff --git a/libstdc++-v3/include/bits/move_only_function.h b/libstdc++-v3/include/bits/move_only_function.h index 71d5207..0aa5980 100644 --- a/libstdc++-v3/include/bits/move_only_function.h +++ b/libstdc++-v3/include/bits/move_only_function.h @@ -32,7 +32,10 @@ #pragma GCC system_header -#if __cplusplus > 202002L +#define __glibcxx_want_move_only_function +#include <bits/version.h> + +#ifdef __cpp_lib_move_only_function // C++ >= 23 && HOSTED #include <bits/invoke.h> #include <bits/utility.h> @@ -41,8 +44,6 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION -#define __cpp_lib_move_only_function 202110L - template<typename... _Signature> class move_only_function; // not defined @@ -212,5 +213,5 @@ _GLIBCXX_END_NAMESPACE_VERSION #define _GLIBCXX_MOF_REF && #include "mofunc_impl.h" -#endif // C++23 +#endif // __cpp_lib_move_only_function #endif // _GLIBCXX_MOVE_ONLY_FUNCTION_H diff --git a/libstdc++-v3/include/bits/node_handle.h b/libstdc++-v3/include/bits/node_handle.h index 8904a5a..1647135 100644 --- a/libstdc++-v3/include/bits/node_handle.h +++ b/libstdc++-v3/include/bits/node_handle.h @@ -33,8 +33,10 @@ #pragma GCC system_header -#if __cplusplus >= 201703L -# define __cpp_lib_node_extract 201606L +#define __glibcxx_want_node_extract +#include <bits/version.h> + +#ifdef __cpp_lib_node_extract // C++ >= 17 && HOSTED #include <new> #include <bits/alloc_traits.h> @@ -390,5 +392,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_END_NAMESPACE_VERSION } // namespace std -#endif // C++17 +#endif // __cpp_lib_node_extract #endif diff --git a/libstdc++-v3/include/bits/ptr_traits.h b/libstdc++-v3/include/bits/ptr_traits.h index 8a919ec..9e2f4f3 100644 --- a/libstdc++-v3/include/bits/ptr_traits.h +++ b/libstdc++-v3/include/bits/ptr_traits.h @@ -34,12 +34,9 @@ #include <bits/move.h> -/* Duplicate definition with unique_ptr.h. */ -#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc) -# define __cpp_lib_constexpr_memory 202202L -#elif __cplusplus > 201703L -# define __cpp_lib_constexpr_memory 201811L -#endif +#define __glibcxx_want_constexpr_memory +#define __glibcxx_want_to_address +#include <bits/version.h> #if __cplusplus > 201703L #include <concepts> @@ -215,7 +212,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __ptr; } -#if __cplusplus <= 201703L +#ifndef __cpp_lib_to_address // C++ < 20 template<typename _Ptr> constexpr typename std::pointer_traits<_Ptr>::element_type* __to_address(const _Ptr& __ptr) @@ -237,8 +234,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::__to_address(__ptr.operator->()); } -#define __cpp_lib_to_address 201711L - /** * @brief Obtain address referenced by a pointer to an object * @param __ptr A pointer to an object @@ -261,7 +256,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr auto to_address(const _Ptr& __ptr) noexcept { return std::__to_address(__ptr); } -#endif // C++2a +#endif // __cpp_lib_to_address _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h index b7169c6..9751b8e 100644 --- a/libstdc++-v3/include/bits/range_access.h +++ b/libstdc++-v3/include/bits/range_access.h @@ -32,6 +32,10 @@ #pragma GCC system_header +#define __glibcxx_want_nonmember_container_access +#define __glibcxx_want_ssize +#include <bits/version.h> + #if __cplusplus >= 201103L #include <initializer_list> #include <type_traits> // common_type_t, make_signed_t @@ -251,9 +255,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // C++14 -#if __cplusplus >= 201703L -#define __cpp_lib_nonmember_container_access 201411L - +#ifdef __cpp_lib_nonmember_container_access // C++ >= 17 /** * @brief Return the size of a container. * @param __cont Container. @@ -345,9 +347,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr const _Tp* data(initializer_list<_Tp> __il) noexcept { return __il.begin(); } +#endif // __cpp_lib_nonmember_container_access -#if __cplusplus > 201703L -#define __cpp_lib_ssize 201902L +#ifdef __cpp_lib_ssize // C++ >= 20 template<typename _Container> [[nodiscard, __gnu__::__always_inline__]] constexpr auto @@ -364,9 +366,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr ptrdiff_t ssize(const _Tp (&)[_Num]) noexcept { return _Num; } -#endif // C++20 - -#endif // C++17 +#endif // __cpp_lib_ssize _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h index da66ff8..a06794c 100644 --- a/libstdc++-v3/include/bits/ranges_algo.h +++ b/libstdc++-v3/include/bits/ranges_algo.h @@ -39,6 +39,13 @@ #include <bits/ranges_util.h> #include <bits/uniform_int_dist.h> // concept uniform_random_bit_generator +#define __glibcxx_want_ranges_contains +#define __glibcxx_want_ranges_find_last +#define __glibcxx_want_ranges_fold +#define __glibcxx_want_ranges_iota +#define __glibcxx_want_shift +#include <bits/version.h> + #if __cpp_lib_concepts namespace std _GLIBCXX_VISIBILITY(default) { @@ -3465,10 +3472,7 @@ namespace ranges inline constexpr __prev_permutation_fn prev_permutation{}; -#if __cplusplus > 202002L - -#define __cpp_lib_ranges_contains 202207L - +#if __cpp_lib_ranges_contains >= 202207L // C++ >= 23 struct __contains_fn { template<input_iterator _Iter, sentinel_for<_Iter> _Sent, @@ -3522,7 +3526,9 @@ namespace ranges inline constexpr __contains_subrange_fn contains_subrange{}; -#define __cpp_lib_ranges_iota 202202L +#endif // __cpp_lib_ranges_contains + +#if __cpp_lib_ranges_iota >= 202202L // C++ >= 23 template<typename _Out, typename _Tp> struct out_value_result @@ -3572,7 +3578,9 @@ namespace ranges inline constexpr __iota_fn iota{}; -#define __cpp_lib_ranges_find_last 202207L +#endif // __cpp_lib_ranges_iota + +#if __cpp_lib_ranges_find_last >= 202207L // C++ >= 23 struct __find_last_fn { @@ -3700,7 +3708,9 @@ namespace ranges inline constexpr __find_last_if_not_fn find_last_if_not{}; -#define __cpp_lib_ranges_fold 202207L +#endif // __cpp_lib_ranges_find_last + +#if __cpp_lib_ranges_fold >= 202207L // C++ >= 23 template<typename _Iter, typename _Tp> struct in_value_result @@ -3947,10 +3957,9 @@ namespace ranges }; inline constexpr __fold_right_last_fn fold_right_last{}; -#endif // C++23 +#endif // __cpp_lib_ranges_fold } // namespace ranges -#define __cpp_lib_shift 201806L template<typename _ForwardIterator> constexpr _ForwardIterator shift_left(_ForwardIterator __first, _ForwardIterator __last, diff --git a/libstdc++-v3/include/bits/ranges_cmp.h b/libstdc++-v3/include/bits/ranges_cmp.h index 6710d82..96fa796 100644 --- a/libstdc++-v3/include/bits/ranges_cmp.h +++ b/libstdc++-v3/include/bits/ranges_cmp.h @@ -30,6 +30,9 @@ #ifndef _RANGES_CMP_H #define _RANGES_CMP_H 1 +#define __glibcxx_want_ranges +#include <bits/version.h> + #if __cplusplus > 201703L # include <bits/move.h> # include <concepts> @@ -55,14 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using is_transparent = __is_transparent; }; -#ifdef __cpp_lib_concepts -// Define this here, included by all the headers that need to define it. -#if __cplusplus > 202002L -#define __cpp_lib_ranges 202202L -#else -#define __cpp_lib_ranges 202110L -#endif - +#ifdef __cpp_lib_ranges // C++ >= 20 namespace ranges { namespace __detail @@ -179,7 +175,7 @@ namespace ranges }; } // namespace ranges -#endif // library concepts +#endif // __cpp_lib_ranges _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // C++20 diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h index 2c24ead..9b5ee57 100644 --- a/libstdc++-v3/include/bits/shared_ptr.h +++ b/libstdc++-v3/include/bits/shared_ptr.h @@ -52,6 +52,10 @@ #include <iosfwd> // std::basic_ostream #include <bits/shared_ptr_base.h> +#define __glibcxx_want_shared_ptr_weak_type +#define __glibcxx_want_enable_shared_from_this +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -189,8 +193,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// The type pointed to by the stored pointer, remove_extent_t<_Tp> using element_type = typename __shared_ptr<_Tp>::element_type; -#if __cplusplus >= 201703L -# define __cpp_lib_shared_ptr_weak_type 201606L +#ifdef __cpp_lib_shared_ptr_weak_type // C++ >= 17 && HOSTED /// The corresponding weak_ptr type for this shared_ptr /// @since C++17 using weak_type = weak_ptr<_Tp>; @@ -938,8 +941,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION shared_from_this() const { return shared_ptr<const _Tp>(this->_M_weak_this); } -#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 -#define __cpp_lib_enable_shared_from_this 201603L +#ifdef __cpp_lib_enable_shared_from_this // C++ >= 17 && HOSTED /** @{ * Get a `weak_ptr` referring to the object that has `*this` as its base. * @since C++17 diff --git a/libstdc++-v3/include/bits/shared_ptr_atomic.h b/libstdc++-v3/include/bits/shared_ptr_atomic.h index b56b815..ae2d1b7 100644 --- a/libstdc++-v3/include/bits/shared_ptr_atomic.h +++ b/libstdc++-v3/include/bits/shared_ptr_atomic.h @@ -32,6 +32,9 @@ #include <bits/atomic_base.h> +#define __glibcxx_want_atomic_shared_ptr +#include <bits/version.h> + // Annotations for the custom locking in atomic<shared_ptr<T>>. #if defined _GLIBCXX_TSAN && __has_include(<sanitizer/tsan_interface.h>) #include <sanitizer/tsan_interface.h> @@ -355,8 +358,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @} group pointer_abstractions -#if __cplusplus >= 202002L -# define __cpp_lib_atomic_shared_ptr 201711L +#ifdef __cpp_lib_atomic_shared_ptr // C++ >= 20 && HOSTED template<typename _Tp> struct atomic; diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index 2c948d5..33282e5 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -67,6 +67,10 @@ # include <bits/stl_uninitialized.h> #endif +#define __glibcxx_want_smart_ptr_for_overwrite +#define __glibcxx_want_shared_ptr_arrays +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -652,8 +656,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Impl _M_impl; }; -#if __cplusplus >= 202002L -# define __cpp_lib_smart_ptr_for_overwrite 202002L +#ifdef __cpp_lib_smart_ptr_for_overwrite // C++ >= 20 && HOSTED struct _Sp_overwrite_tag { }; // Partial specialization used for make_shared_for_overwrite<non-array>(). @@ -712,13 +715,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_get_deleter(const std::type_info&) noexcept override { return nullptr; } }; -#endif // C++20 - -#if __cplusplus <= 201703L -# define __cpp_lib_shared_ptr_arrays 201611L -#else -# define __cpp_lib_shared_ptr_arrays 201707L +#endif // __cpp_lib_smart_ptr_for_overwrite +#if __cpp_lib_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED struct _Sp_overwrite_tag; // For make_shared<T[]>, make_shared<T[N]>, allocate_shared<T[]> etc. @@ -880,7 +879,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_get_deleter(const std::type_info&) noexcept override { return nullptr; } }; -#endif // C++20 +#endif // __cpp_lib_shared_ptr_arrays >= 201707L // The default deleter for shared_ptr<T[]> and shared_ptr<T[N]>. struct __sp_array_delete @@ -899,7 +898,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Tp> struct __not_alloc_shared_tag<_Sp_alloc_shared_tag<_Tp>> { }; -#if __cpp_lib_shared_ptr_arrays >= 201707L +#if __cpp_lib_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED template<typename _Alloc> struct __not_alloc_shared_tag<_Sp_counted_array_base<_Alloc>> { }; #endif @@ -975,7 +974,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __p = __pi->_M_ptr(); } -#if __cpp_lib_shared_ptr_arrays >= 201707L +#if __cpp_lib_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED template<typename _Tp, typename _Alloc, typename _Init> __shared_count(_Tp*& __p, const _Sp_counted_array_base<_Alloc>& __a, _Init __init) @@ -1717,7 +1716,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend __shared_ptr<_Tp1, _Lp1> __allocate_shared(const _Alloc& __a, _Args&&... __args); -#if __cpp_lib_shared_ptr_arrays >= 201707L +#if __cpp_lib_shared_ptr_arrays >= 201707L // C++ >= 20 && HOSTED // This constructor is non-standard, it is used by allocate_shared<T[]>. template<typename _Alloc, typename _Init = const remove_extent_t<_Tp>*> __shared_ptr(const _Sp_counted_array_base<_Alloc>& __a, diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h index afb1385..fdaaaf4 100644 --- a/libstdc++-v3/include/bits/specfun.h +++ b/libstdc++-v3/include/bits/specfun.h @@ -32,9 +32,9 @@ #include <bits/c++config.h> -#define __STDCPP_MATH_SPEC_FUNCS__ 201003L - -#define __cpp_lib_math_special_functions 201603L +#define __glibcxx_want_math_spec_funcs +#define __glibcxx_want_math_special_functions +#include <bits/version.h> #if __cplusplus <= 201403L && __STDCPP_WANT_MATH_SPEC_FUNCS__ == 0 # error include <cmath> and define __STDCPP_WANT_MATH_SPEC_FUNCS__ diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 3abf0f6..637d53d 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -72,6 +72,10 @@ # endif #endif +#define __glibcxx_want_clamp +#define __glibcxx_want_sample +#include <bits/version.h> + // See concept_check.h for the __glibcxx_*_requires macros. namespace std _GLIBCXX_VISIBILITY(default) @@ -3598,11 +3602,9 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) return std::__is_permutation(__first1, __last1, __first2, __last2, __gnu_cxx::__ops::__iter_comp_iter(__pred)); } +#endif // C++14 -#if __cplusplus >= 201703L - -#define __cpp_lib_clamp 201603L - +#ifdef __cpp_lib_clamp // C++ >= 17 /** * @brief Returns the value clamped between lo and hi. * @ingroup sorting_algorithms @@ -3641,8 +3643,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) __glibcxx_assert(!__comp(__hi, __lo)); return std::min(std::max(__val, __lo, __comp), __hi, __comp); } -#endif // C++17 -#endif // C++14 +#endif // __cpp_lib_clamp /** * @brief Generate two uniformly distributed integers using a @@ -5812,9 +5813,9 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO } return __out; } +#endif // C++14 -#if __cplusplus > 201402L -#define __cpp_lib_sample 201603L +#ifdef __cpp_lib_sample // C++ >= 17 /// Take a random sample from a population. template<typename _PopulationIterator, typename _SampleIterator, typename _Distance, typename _UniformRandomBitGenerator> @@ -5842,8 +5843,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO __sample(__first, __last, __pop_cat{}, __out, __samp_cat{}, __d, std::forward<_UniformRandomBitGenerator>(__g)); } -#endif // C++17 -#endif // C++14 +#endif // __cpp_lib_sample _GLIBCXX_END_NAMESPACE_ALGO _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 2037d6c..2f5a4bd 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -79,6 +79,9 @@ # include <compare> #endif +#define __glibcxx_want_robust_nonmodifying_seq_ops +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -1645,10 +1648,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO } #endif // C++11 -#if __cplusplus > 201103L - -#define __cpp_lib_robust_nonmodifying_seq_ops 201304L - +#ifdef __cpp_lib_robust_nonmodifying_seq_ops // C++ >= 14 /** * @brief Tests a range for element-wise equality. * @ingroup non_mutating_algorithms @@ -1710,7 +1710,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO return _GLIBCXX_STD_A::__equal4(__first1, __last1, __first2, __last2, __binary_pred); } -#endif // C++14 +#endif // __cpp_lib_robust_nonmodifying_seq_ops /** * @brief Performs @b dictionary comparison on ranges. @@ -1952,8 +1952,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO __gnu_cxx::__ops::__iter_comp_iter(__binary_pred)); } -#if __cplusplus > 201103L - +#if __cpp_lib_robust_nonmodifying_seq_ops // C++ >= 14 template<typename _InputIterator1, typename _InputIterator2, typename _BinaryPredicate> _GLIBCXX20_CONSTEXPR diff --git a/libstdc++-v3/include/bits/stl_function.h b/libstdc++-v3/include/bits/stl_function.h index fa03f32b..608d4e9 100644 --- a/libstdc++-v3/include/bits/stl_function.h +++ b/libstdc++-v3/include/bits/stl_function.h @@ -60,6 +60,9 @@ #include <bits/move.h> #endif +#define __glibcxx_want_transparent_operators +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -153,7 +156,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @{ */ -#if __cplusplus > 201103L +#if __cpp_lib_transparent_operators // C++ >= 14 struct __is_transparent; // undefined template<typename _Tp = void> @@ -241,10 +244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #pragma GCC diagnostic pop -#if __cplusplus > 201103L - -#define __cpp_lib_transparent_operators 201510L - +#ifdef __cpp_lib_transparent_operators // C++ >= 14 template<> struct plus<void> { @@ -345,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * * @{ */ -#if __cplusplus > 201103L +#if __cpp_lib_transparent_operators // C++ >= 14 template<typename _Tp = void> struct equal_to; @@ -489,7 +489,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #pragma GCC diagnostic pop -#if __cplusplus >= 201402L +#ifdef __cpp_lib_transparent_operators // C++ >= 14 /// One of the @link comparison_functors comparison functors@endlink. template<> struct equal_to<void> @@ -765,7 +765,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION is_convertible<_Tp, const volatile void*>, is_convertible<_Up, const volatile void*>>; }; -#endif // C++14 +#endif // __cpp_lib_transparent_operators /** @} */ // 20.3.4 logical operations @@ -777,7 +777,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * * @{ */ -#if __cplusplus > 201103L +#ifdef __cpp_lib_transparent_operators // C++ >= 14 template<typename _Tp = void> struct logical_and; @@ -822,7 +822,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #pragma GCC diagnostic pop -#if __cplusplus > 201103L +#ifdef __cpp_lib_transparent_operators // C++ >= 14 /// One of the @link logical_functors Boolean operations functors@endlink. template<> struct logical_and<void> @@ -867,10 +867,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef __is_transparent is_transparent; }; -#endif +#endif // __cpp_lib_transparent_operators /** @} */ -#if __cplusplus > 201103L +#ifdef __cpp_lib_transparent_operators // C++ >= 14 template<typename _Tp = void> struct bit_and; @@ -926,7 +926,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #pragma GCC diagnostic pop -#if __cplusplus > 201103L +#ifdef __cpp_lib_transparent_operators // C++ >= 14 template <> struct bit_and<void> { @@ -1416,7 +1416,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** @} */ -#if __cplusplus >= 201402L +#ifdef __cpp_lib_transparent_operators // C++ >= 14 template<typename _Func, typename _SfinaeType, typename = __void_t<>> struct __has_is_transparent { }; diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index b13f4f8..b75f87e 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -70,12 +70,11 @@ # include <type_traits> #endif -#if __cplusplus > 201703L -# define __cpp_lib_array_constexpr 201811L -# define __cpp_lib_constexpr_iterator 201811L -#elif __cplusplus == 201703L -# define __cpp_lib_array_constexpr 201803L -#endif +#define __glibcxx_want_constexpr_iterator +#define __glibcxx_want_array_constexpr +#define __glibcxx_want_make_reverse_iterator +#define __glibcxx_want_move_iterator_concept +#include <bits/version.h> #if __cplusplus >= 202002L # include <compare> @@ -642,9 +641,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __make_reverse_iterator(_Iterator __i) { return reverse_iterator<_Iterator>(__i); } -# if __cplusplus >= 201402L -# define __cpp_lib_make_reverse_iterator 201402L - +# ifdef __cpp_lib_make_reverse_iterator // C++ >= 14 // _GLIBCXX_RESOLVE_LIB_DEFECTS // DR 2285. make_reverse_iterator /// Generator function for reverse_iterator. @@ -661,7 +658,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION disable_sized_sentinel_for<reverse_iterator<_Iterator1>, reverse_iterator<_Iterator2>> = true; # endif // C++20 -# endif // C++14 +# endif // __cpp_lib_make_reverse_iterator template<typename _Iterator> _GLIBCXX20_CONSTEXPR @@ -1461,7 +1458,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Iter2> friend class move_iterator; -#if __cpp_lib_concepts +#if __cpp_lib_concepts // C++20 && concepts // _GLIBCXX_RESOLVE_LIB_DEFECTS // 3435. three_way_comparable_with<reverse_iterator<int*>, [...]> template<typename _Iter2> @@ -1487,9 +1484,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: using iterator_type = _Iterator; -#if __cplusplus > 201703L && __cpp_lib_concepts - // This is P2520R0, a C++23 change, but we treat it as a DR against C++20. -# define __cpp_lib_move_iterator_concept 202207L +#ifdef __cpp_lib_move_iterator_concept // C++ >= 20 && lib_concepts using iterator_concept = decltype(_S_iter_concept()); // iterator_category defined in __move_iter_cat diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index bf1f1b3..82256b7 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -65,6 +65,9 @@ #include <ext/aligned_buffer.h> #endif +#define __glibcxx_want_list_remove_return_type +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -1761,8 +1764,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #endif private: -#if __cplusplus > 201703L -# define __cpp_lib_list_remove_return_type 201806L +#ifdef __cpp_lib_list_remove_return_type // C++ >= 20 && HOSTED typedef size_type __remove_return_type; # define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \ __attribute__((__abi_tag__("__cxx20"))) diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index 059916d..02cce9b 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -63,6 +63,9 @@ #include <tuple> #endif +#define __glibcxx_want_map_try_emplace +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -696,8 +699,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { merge(__source); } #endif // C++17 -#if __cplusplus > 201402L -#define __cpp_lib_map_try_emplace 201411L +#ifdef __cpp_lib_map_try_emplace // C++ >= 17 && HOSTED /** * @brief Attempts to build and insert a std::pair into the %map. * diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h index 3f1624f..197a909 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -63,9 +63,12 @@ #endif #if __cplusplus >= 202002L # include <compare> -# define __cpp_lib_constexpr_utility 201811L #endif +#define __glibcxx_want_constexpr_utility +#define __glibcxx_want_tuples_by_type +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -1050,10 +1053,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION get(const pair<_Tp1, _Tp2>&& __in) noexcept { return __pair_get<_Int>::__const_move_get(std::move(__in)); } -#if __cplusplus >= 201402L - -#define __cpp_lib_tuples_by_type 201304L +#ifdef __cpp_lib_tuples_by_type // C++ >= 14 template <typename _Tp, typename _Up> constexpr _Tp& get(pair<_Tp, _Up>& __p) noexcept @@ -1093,6 +1094,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr const _Tp&& get(const pair<_Up, _Tp>&& __p) noexcept { return std::move(__p.second); } +#endif // __cpp_lib_tuples_by_type + #if __cplusplus > 202002L template<typename _T1, typename _T2, typename _U1, typename _U2, @@ -1111,7 +1114,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { using type = pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>; }; #endif // C++23 -#endif // C++14 /// @} #endif // C++11 diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h index 8a8dc95..1d22578 100644 --- a/libstdc++-v3/include/bits/stl_queue.h +++ b/libstdc++-v3/include/bits/stl_queue.h @@ -62,6 +62,9 @@ # include <bits/uses_allocator.h> #endif +#define __glibcxx_want_adaptor_iterator_pair_constructor +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -194,10 +197,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename _Alloc, typename _Requires = _Uses<_Alloc>> queue(queue&& __q, const _Alloc& __a) : c(std::move(__q.c), __a) { } +#endif -#if __cplusplus > 202002L -#define __cpp_lib_adaptor_iterator_pair_constructor 202106L - +#ifdef __cpp_lib_adaptor_iterator_pair_constructor // C++ >= 23 && HOSTED template<typename _InputIterator, typename = _RequireInputIter<_InputIterator>> queue(_InputIterator __first, _InputIterator __last) @@ -209,7 +211,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION queue(_InputIterator __first, _InputIterator __last, const _Alloc& __a) : c(__first, __last, __a) { } #endif -#endif /** * Returns true if the %queue is empty. diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h index 006b18c..2d09098 100644 --- a/libstdc++-v3/include/bits/stl_stack.h +++ b/libstdc++-v3/include/bits/stl_stack.h @@ -62,6 +62,9 @@ # include <bits/uses_allocator.h> #endif +#define __glibcxx_want_adaptor_iterator_pair_constructor +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -170,9 +173,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION stack(_Sequence&& __c) : c(std::move(__c)) { } -#if __cplusplus > 202002L -#define __cpp_lib_adaptor_iterator_pair_constructor 202106L - +#ifdef __cpp_lib_adaptor_iterator_pair_constructor // C++ >= 23 && HOSTED template<typename _InputIterator, typename = _RequireInputIter<_InputIterator>> stack(_InputIterator __first, _InputIterator __last) diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index f870f3d..1cf887b 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -72,14 +72,13 @@ # include <bits/node_handle.h> #endif +#define __glibcxx_want_generic_associative_lookup +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION -#if __cplusplus > 201103L -# define __cpp_lib_generic_associative_lookup 201304L -#endif - // Red-black tree class, designed for use in implementing STL // associative containers (set, multiset, map, and multimap). The // insertion and deletion algorithms are based on those in Cormen, diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h index 474a9a1..5174cfb 100644 --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -67,6 +67,9 @@ #include <bits/stl_pair.h> #endif +#define __glibcxx_want_raw_memory_algorithms +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -963,9 +966,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @endcond #endif -#if __cplusplus >= 201703L -# define __cpp_lib_raw_memory_algorithms 201606L - +#ifdef __cpp_lib_raw_memory_algorithms // C++ >= 17 /** * @brief Default-initializes objects in the range [first,last). * @param __first A forward iterator. @@ -1058,7 +1059,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __count, __result); return {__res.first.base(), __res.second}; } -#endif // C++17 +#endif // __cpp_lib_raw_memory_algorithms #if __cplusplus >= 201103L /// @cond undocumented diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 70ced3d..1a35339 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -64,9 +64,11 @@ #endif #if __cplusplus >= 202002L # include <compare> -#define __cpp_lib_constexpr_vector 201907L #endif +#define __glibcxx_want_constexpr_vector +#include <bits/version.h> + #include <debug/assertions.h> #if _GLIBCXX_SANITIZE_STD_ALLOCATOR && _GLIBCXX_SANITIZE_VECTOR diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index f0c6d23..d92fe79 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits/unique_ptr.h @@ -1,3 +1,4 @@ + // unique_ptr implementation -*- C++ -*- // Copyright (C) 2008-2023 Free Software Foundation, Inc. @@ -43,12 +44,9 @@ # endif #endif -/* Duplicate definition with ptr_traits.h. */ -#if __cplusplus > 202002L && defined(__cpp_constexpr_dynamic_alloc) -# define __cpp_lib_constexpr_memory 202202L -#elif __cplusplus > 201703L -# define __cpp_lib_constexpr_memory 201811L -#endif +#define __glibcxx_want_constexpr_memory +#define __glibcxx_want_make_unique +#include <bits/version.h> namespace std _GLIBCXX_VISIBILITY(default) { @@ -1029,9 +1027,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public __uniq_ptr_hash<unique_ptr<_Tp, _Dp>> { }; -#if __cplusplus >= 201402L && _GLIBCXX_HOSTED -#define __cpp_lib_make_unique 201304L - +#ifdef __cpp_lib_make_unique // C++ >= 14 && HOSTED /// @cond undocumented namespace __detail { diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h index 2f63bc5..4c9a6ba 100644 --- a/libstdc++-v3/include/bits/unordered_map.h +++ b/libstdc++-v3/include/bits/unordered_map.h @@ -35,6 +35,9 @@ #include <bits/functional_hash.h> // hash #include <bits/stl_function.h> // equal_to +#define __glibcxx_want_unordered_map_try_emplace +#include <bits/version.h> + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -449,8 +452,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator insert(const_iterator, node_type&& __nh) { return _M_h._M_reinsert_node(std::move(__nh)).position; } +#endif // C++17 -#define __cpp_lib_unordered_map_try_emplace 201411L +#ifdef __cpp_lib_unordered_map_try_emplace // C++ >= 17 && HOSTED /** * @brief Attempts to build and insert a std::pair into the * %unordered_map. @@ -534,7 +538,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER return _M_h.try_emplace(__hint, std::move(__k), std::forward<_Args>(__args)...).first; } -#endif // C++17 +#endif // __cpp_lib_unordered_map_try_emplace ///@{ /** diff --git a/libstdc++-v3/include/bits/uses_allocator_args.h b/libstdc++-v3/include/bits/uses_allocator_args.h index bc038f0..a4eae74 100644 --- a/libstdc++-v3/include/bits/uses_allocator_args.h +++ b/libstdc++-v3/include/bits/uses_allocator_args.h @@ -32,8 +32,10 @@ #pragma GCC system_header -#if __cplusplus > 201703L && __cpp_concepts +#define __glibcxx_want_make_obj_using_allocator +#include <bits/version.h> +#ifdef __cpp_lib_make_obj_using_allocator // C++ >= 20 && concepts #include <new> // for placement operator new #include <tuple> // for tuple, make_tuple, make_from_tuple #include <bits/stl_construct.h> // construct_at @@ -49,10 +51,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** @addtogroup allocators * @{ */ - -// Not specified by C++20, used internally -#define __cpp_lib_make_obj_using_allocator 201811L - template<typename _Tp, typename _Alloc, typename... _Args> constexpr auto uses_allocator_construction_args(const _Alloc& __a, @@ -247,5 +245,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @} _GLIBCXX_END_NAMESPACE_VERSION } // namespace std -#endif // C++20 +#endif // __cpp_lib_make_obj_using_allocator #endif // _USES_ALLOCATOR_ARGS diff --git a/libstdc++-v3/include/bits/utility.h b/libstdc++-v3/include/bits/utility.h index 4692aa0..bed9452 100644 --- a/libstdc++-v3/include/bits/utility.h +++ b/libstdc++-v3/include/bits/utility.h @@ -35,6 +35,11 @@ #pragma GCC system_header +#define __glibcxx_want_tuple_element_t +#define __glibcxx_want_integer_sequence +#define __glibcxx_want_ranges_zip +#include <bits/version.h> + #if __cplusplus >= 201103L #include <type_traits> @@ -123,17 +128,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } return __n; } +#endif // C++14 // The standard says this macro and alias template should be in <tuple> but we // define them here, to be available in <array>, <utility> and <ranges> too. // _GLIBCXX_RESOLVE_LIB_DEFECTS // 3378. tuple_size_v/tuple_element_t should be available when // tuple_size/tuple_element are -#define __cpp_lib_tuple_element_t 201402L - +#ifdef __cpp_lib_tuple_element_t // C++ >= 14 template<size_t __i, typename _Tp> using tuple_element_t = typename tuple_element<__i, _Tp>::type; -#endif // C++14 +#endif // Stores a tuple of indices. Used by tuple and pair, and by bind() to // extract the elements in a tuple. @@ -155,9 +160,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif }; -#if __cplusplus >= 201402L - -#define __cpp_lib_integer_sequence 201304L +#ifdef __cpp_lib_integer_sequence // C++ >= 14 /// Class template integer_sequence template<typename _Tp, _Tp... _Idx> @@ -187,6 +190,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Alias template index_sequence_for template<typename... _Types> using index_sequence_for = make_index_sequence<sizeof...(_Types)>; +#endif // __cpp_lib_integer_sequence #if __cplusplus >= 201703L @@ -222,7 +226,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using __is_in_place_type = bool_constant<__is_in_place_type_v<_Tp>>; #endif // C++17 -#endif // C++14 #if __has_builtin(__type_pack_element) template<size_t _Np, typename... _Types> @@ -269,10 +272,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #endif -#if __cplusplus > 202002L -#define __cpp_lib_ranges_zip 202110L // for <tuple> and <utility> -#endif - _GLIBCXX_END_NAMESPACE_VERSION } // namespace |