aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/std')
-rw-r--r--libstdc++-v3/include/std/algorithm10
-rw-r--r--libstdc++-v3/include/std/any9
-rw-r--r--libstdc++-v3/include/std/array10
-rw-r--r--libstdc++-v3/include/std/atomic69
-rw-r--r--libstdc++-v3/include/std/barrier11
-rw-r--r--libstdc++-v3/include/std/bit30
-rw-r--r--libstdc++-v3/include/std/bitset7
-rw-r--r--libstdc++-v3/include/std/charconv11
-rw-r--r--libstdc++-v3/include/std/chrono5
-rw-r--r--libstdc++-v3/include/std/complex11
-rw-r--r--libstdc++-v3/include/std/concepts10
-rw-r--r--libstdc++-v3/include/std/coroutine20
-rw-r--r--libstdc++-v3/include/std/deque9
-rw-r--r--libstdc++-v3/include/std/execution11
-rw-r--r--libstdc++-v3/include/std/expected8
-rw-r--r--libstdc++-v3/include/std/filesystem9
-rw-r--r--libstdc++-v3/include/std/format19
-rw-r--r--libstdc++-v3/include/std/forward_list10
-rw-r--r--libstdc++-v3/include/std/functional39
-rw-r--r--libstdc++-v3/include/std/iomanip9
-rw-r--r--libstdc++-v3/include/std/iterator5
-rw-r--r--libstdc++-v3/include/std/latch10
-rw-r--r--libstdc++-v3/include/std/list10
-rw-r--r--libstdc++-v3/include/std/memory15
-rw-r--r--libstdc++-v3/include/std/memory_resource20
-rw-r--r--libstdc++-v3/include/std/mutex8
-rw-r--r--libstdc++-v3/include/std/numbers8
-rw-r--r--libstdc++-v3/include/std/numeric35
-rw-r--r--libstdc++-v3/include/std/optional15
-rw-r--r--libstdc++-v3/include/std/ranges62
-rw-r--r--libstdc++-v3/include/std/semaphore9
-rw-r--r--libstdc++-v3/include/std/shared_mutex12
-rw-r--r--libstdc++-v3/include/std/source_location9
-rw-r--r--libstdc++-v3/include/std/span11
-rw-r--r--libstdc++-v3/include/std/spanstream11
-rw-r--r--libstdc++-v3/include/std/stacktrace10
-rw-r--r--libstdc++-v3/include/std/stop_token5
-rw-r--r--libstdc++-v3/include/std/string9
-rw-r--r--libstdc++-v3/include/std/string_view23
-rw-r--r--libstdc++-v3/include/std/syncstream17
-rw-r--r--libstdc++-v3/include/std/thread3
-rw-r--r--libstdc++-v3/include/std/tuple25
-rw-r--r--libstdc++-v3/include/std/type_traits141
-rw-r--r--libstdc++-v3/include/std/utility38
-rw-r--r--libstdc++-v3/include/std/variant15
-rw-r--r--libstdc++-v3/include/std/vector9
46 files changed, 421 insertions, 431 deletions
diff --git a/libstdc++-v3/include/std/algorithm b/libstdc++-v3/include/std/algorithm
index fc393ee..c6ebb86 100644
--- a/libstdc++-v3/include/std/algorithm
+++ b/libstdc++-v3/include/std/algorithm
@@ -63,7 +63,10 @@
# include <bits/ranges_algo.h>
#endif
-#if __cplusplus > 201402L && _GLIBCXX_HOSTED
+#define __glibcxx_want_parallel_algorithm
+#include <bits/version.h>
+
+#if __cpp_lib_parallel_algorithm // C++ >= 17 && HOSTED
// Parallel STL algorithms
# if _PSTL_EXECUTION_POLICIES_DEFINED
// If <execution> has already been included, pull in implementations
@@ -73,10 +76,7 @@
# include <pstl/glue_algorithm_defs.h>
# define _PSTL_ALGORITHM_FORWARD_DECLARED 1
# endif
-
-// Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201603L
-#endif // C++17 && HOSTED
+#endif
#ifdef _GLIBCXX_PARALLEL
# include <parallel/algorithm>
diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any
index a221445..288eb91 100644
--- a/libstdc++-v3/include/std/any
+++ b/libstdc++-v3/include/std/any
@@ -31,7 +31,10 @@
#pragma GCC system_header
-#if __cplusplus >= 201703L
+#define __glibcxx_want_any
+#include <bits/version.h>
+
+#ifdef __cpp_lib_any // C++ >= 17
#include <initializer_list>
#include <typeinfo>
@@ -67,8 +70,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
}
-#define __cpp_lib_any 201606L
-
/**
* @brief A type-safe container of any type.
*
@@ -652,5 +653,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++17
+#endif // __cpp_lib_any
#endif // _GLIBCXX_ANY
diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array
index ad36cda..0e32d7b 100644
--- a/libstdc++-v3/include/std/array
+++ b/libstdc++-v3/include/std/array
@@ -45,6 +45,9 @@
#include <bits/utility.h> // std::index_sequence, std::tuple_size
#include <debug/assertions.h>
+#define __glibcxx_want_to_array
+#include <bits/version.h>
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -297,7 +300,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
{ return std::equal(__one.begin(), __one.end(), __two.begin()); }
-#if __cpp_lib_three_way_comparison && __cpp_lib_concepts
+#if __cpp_lib_three_way_comparison // C++ >= 20 && lib_concepts
template<typename _Tp, size_t _Nm>
[[nodiscard]]
constexpr __detail::__synth3way_t<_Tp>
@@ -414,8 +417,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return std::move(std::get<_Int>(__arr));
}
-#if __cplusplus >= 202002L && __cpp_generic_lambdas >= 201707L
-#define __cpp_lib_to_array 201907L
+#ifdef __cpp_lib_to_array // C++ >= 20 && __cpp_generic_lambdas >= 201707L
template<typename _Tp, size_t _Nm>
[[nodiscard]]
constexpr array<remove_cv_t<_Tp>, _Nm>
@@ -473,7 +475,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
else
__builtin_unreachable(); // FIXME: see PR c++/91388
}
-#endif // C++20
+#endif // __cpp_lib_to_array
// Tuple interface to class template array.
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index 111df2a..da99169 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -38,6 +38,12 @@
# include <bits/c++0x_warning.h>
#else
+#define __glibcxx_want_atomic_is_always_lock_free
+#define __glibcxx_want_atomic_float
+#define __glibcxx_want_atomic_ref
+#define __glibcxx_want_atomic_lock_free_type_aliases
+#include <bits/version.h>
+
#include <bits/atomic_base.h>
namespace std _GLIBCXX_VISIBILITY(default)
@@ -49,10 +55,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @{
*/
-#if __cplusplus >= 201703L
-# define __cpp_lib_atomic_is_always_lock_free 201603L
-#endif
-
template<typename _Tp>
struct atomic;
@@ -95,7 +97,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool
is_lock_free() const volatile noexcept { return _M_base.is_lock_free(); }
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_BOOL_LOCK_FREE == 2;
#endif
@@ -268,7 +270,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
reinterpret_cast<void *>(-_S_alignment));
}
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free
= __atomic_always_lock_free(sizeof(_M_i), 0);
#endif
@@ -557,7 +559,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
is_lock_free() const volatile noexcept
{ return _M_b.is_lock_free(); }
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free
= ATOMIC_POINTER_LOCK_FREE == 2;
#endif
@@ -720,7 +722,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_CHAR_LOCK_FREE == 2;
#endif
};
@@ -743,7 +745,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_CHAR_LOCK_FREE == 2;
#endif
};
@@ -766,7 +768,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_CHAR_LOCK_FREE == 2;
#endif
};
@@ -789,7 +791,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_SHORT_LOCK_FREE == 2;
#endif
};
@@ -812,7 +814,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_SHORT_LOCK_FREE == 2;
#endif
};
@@ -835,7 +837,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_INT_LOCK_FREE == 2;
#endif
};
@@ -858,7 +860,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_INT_LOCK_FREE == 2;
#endif
};
@@ -881,7 +883,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_LONG_LOCK_FREE == 2;
#endif
};
@@ -904,7 +906,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_LONG_LOCK_FREE == 2;
#endif
};
@@ -927,7 +929,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_LLONG_LOCK_FREE == 2;
#endif
};
@@ -950,7 +952,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_LLONG_LOCK_FREE == 2;
#endif
};
@@ -973,7 +975,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free = ATOMIC_WCHAR_T_LOCK_FREE == 2;
#endif
};
@@ -997,7 +999,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus > 201402L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free
= ATOMIC_CHAR8_T_LOCK_FREE == 2;
#endif
@@ -1022,7 +1024,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free
= ATOMIC_CHAR16_T_LOCK_FREE == 2;
#endif
@@ -1046,7 +1048,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __base_type::operator __integral_type;
using __base_type::operator=;
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_atomic_is_always_lock_free // C++ >= 17
static constexpr bool is_always_lock_free
= ATOMIC_CHAR32_T_LOCK_FREE == 2;
#endif
@@ -1614,8 +1616,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__atomic_val_t<_ITp> __i) noexcept
{ return atomic_fetch_xor_explicit(__a, __i, memory_order_seq_cst); }
-#if __cplusplus > 201703L
-#define __cpp_lib_atomic_float 201711L
+#ifdef __cpp_lib_atomic_float
template<>
struct atomic<float> : __atomic_float<float>
{
@@ -1745,9 +1746,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __atomic_float<__gnu_cxx::__bfloat16_t>::operator=;
};
#endif
+#endif // __cpp_lib_atomic_float
-#define __cpp_lib_atomic_ref 201806L
-
+#ifdef __cpp_lib_atomic_ref
/// Class template to provide atomic operations on a non-atomic variable.
template<typename _Tp>
struct atomic_ref : __atomic_ref<_Tp>
@@ -1762,26 +1763,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __atomic_ref<_Tp>::operator=;
};
+#endif // __cpp_lib_atomic_ref
-#define __cpp_lib_atomic_lock_free_type_aliases 201907L
-#ifdef _GLIBCXX_HAVE_PLATFORM_WAIT
+#ifdef __cpp_lib_atomic_lock_free_type_aliases
+# ifdef _GLIBCXX_HAVE_PLATFORM_WAIT
using atomic_signed_lock_free
= atomic<make_signed_t<__detail::__platform_wait_t>>;
using atomic_unsigned_lock_free
= atomic<make_unsigned_t<__detail::__platform_wait_t>>;
-#elif ATOMIC_INT_LOCK_FREE || !(ATOMIC_LONG_LOCK_FREE || ATOMIC_CHAR_LOCK_FREE)
+# elif ATOMIC_INT_LOCK_FREE || !(ATOMIC_LONG_LOCK_FREE || ATOMIC_CHAR_LOCK_FREE)
using atomic_signed_lock_free = atomic<signed int>;
using atomic_unsigned_lock_free = atomic<unsigned int>;
-#elif ATOMIC_LONG_LOCK_FREE
+# elif ATOMIC_LONG_LOCK_FREE
using atomic_signed_lock_free = atomic<signed long>;
using atomic_unsigned_lock_free = atomic<unsigned long>;
-#elif ATOMIC_CHAR_LOCK_FREE
+# elif ATOMIC_CHAR_LOCK_FREE
using atomic_signed_lock_free = atomic<signed char>;
using atomic_unsigned_lock_free = atomic<unsigned char>;
+# else
+# error "libstdc++ bug: no lock-free atomics but they were emitted in <version>"
+# endif
#endif
-#endif // C++2a
-
/// @} group atomics
_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/barrier b/libstdc++-v3/include/std/barrier
index 6070ad5..8e03a58 100644
--- a/libstdc++-v3/include/std/barrier
+++ b/libstdc++-v3/include/std/barrier
@@ -42,16 +42,16 @@
#include <bits/requires_hosted.h> // threading primitive
-#if __cplusplus > 201703L
+#define __glibcxx_want_barrier
+#include <bits/version.h>
+
+#ifdef __cpp_lib_barrier // C++ >= 20 && __cpp_aligned_new && lib_atomic_wait
#include <bits/atomic_base.h>
-#if __cpp_lib_atomic_wait && __cpp_aligned_new
#include <bits/std_thread.h>
#include <bits/unique_ptr.h>
#include <array>
-#define __cpp_lib_barrier 201907L
-
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -261,6 +261,5 @@ It looks different from literature pseudocode for two main reasons:
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#endif // __cpp_lib_atomic_wait && __cpp_aligned_new
-#endif // __cplusplus > 201703L
+#endif // __cpp_lib_barrier
#endif // _GLIBCXX_BARRIER
diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit
index 5eb4021..987b6cd 100644
--- a/libstdc++-v3/include/std/bit
+++ b/libstdc++-v3/include/std/bit
@@ -52,6 +52,13 @@ namespace __gnu_cxx
/// @endcond
#endif
+#define __glibcxx_want_bit_cast
+#define __glibcxx_want_byteswap
+#define __glibcxx_want_bitops
+#define __glibcxx_want_int_pow2
+#define __glibcxx_want_endian
+#include <bits/version.h>
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -65,8 +72,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @{
*/
-#if __cplusplus > 201703l && __has_builtin(__builtin_bit_cast)
-#define __cpp_lib_bit_cast 201806L
+#ifdef __cpp_lib_bit_cast // C++ >= 20
/// Create a value of type `To` from the bits of `from`.
/**
@@ -86,10 +92,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
return __builtin_bit_cast(_To, __from);
}
-#endif
+#endif // __cpp_lib_bit_cast
-#if __cplusplus > 202002L
-#define __cpp_lib_byteswap 202110L
+#ifdef __cpp_lib_byteswap // C++ >= 23
/// Reverse order of bytes in the object representation of `value`.
/**
@@ -142,7 +147,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return __val;
}
-#endif
+#endif // __cpp_lib_byteswap
/// @cond undocumented
@@ -370,9 +375,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// @endcond
-#if __cplusplus > 201703L
-
-#define __cpp_lib_bitops 201907L
+#ifdef __cpp_lib_bitops // C++ >= 20
/// @cond undocumented
template<typename _Tp, typename _Up = _Tp>
@@ -425,11 +428,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr _If_is_unsigned_integer<_Tp, int>
popcount(_Tp __x) noexcept
{ return std::__popcount(__x); }
+#endif // __cpp_lib_bitops
+#ifdef __cpp_lib_int_pow2 // C++ >= 20
// [bit.pow.two], integral powers of 2
-#define __cpp_lib_int_pow2 202002L
-
/// True if `x` is a power of two, false otherwise.
template<typename _Tp>
constexpr _If_is_unsigned_integer<_Tp, bool>
@@ -455,8 +458,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr _If_is_unsigned_integer<_Tp, int>
bit_width(_Tp __x) noexcept
{ return std::__bit_width(__x); }
+#endif // defined (__cpp_lib_int_pow2)
-#define __cpp_lib_endian 201907L
+#ifdef __cpp_lib_endian // C++ >= 20
/// Byte order constants
/**
@@ -471,7 +475,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
big = __ORDER_BIG_ENDIAN__,
native = __BYTE_ORDER__
};
-#endif // C++2a
+#endif // __cpp_lib_endian
/// @}
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index acd5768..a0379ed 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -58,6 +58,9 @@
# include <bits/functional_hash.h>
#endif
+#define __glibcxx_want_constexpr_bitset
+#include <bits/version.h>
+
#define _GLIBCXX_BITSET_BITS_PER_WORD (__CHAR_BIT__ * __SIZEOF_LONG__)
#define _GLIBCXX_BITSET_WORDS(__n) \
((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \
@@ -69,10 +72,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
-#if __cplusplus > 202002L && _GLIBCXX_HOSTED
-# define __cpp_lib_constexpr_bitset 202202L
-#endif
-
/**
* Base class, general case. It is a class invariant that _Nw will be
* nonnegative.
diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index cf2b116..01711d3 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -45,14 +45,9 @@
#include <bits/error_constants.h> // for std::errc
#include <ext/numeric_traits.h>
-#if _GLIBCXX_FLOAT_IS_IEEE_BINARY32 && _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 \
- && __SIZE_WIDTH__ >= 32 && _GLIBCXX_HOSTED
-# define __cpp_lib_to_chars 201611L
-#endif
-
-#if __cplusplus > 202002L
-# define __cpp_lib_constexpr_charconv 202207L
-#endif
+#define __glibcxx_want_to_chars
+#define __glibcxx_want_constexpr_charconv
+#include <bits/version.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index 6fdc0c8..10e868e 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -50,11 +50,6 @@
# include <bits/unique_ptr.h>
#endif
-#if __cplusplus >= 202002L
-# undef __cpp_lib_chrono
-# define __cpp_lib_chrono 201907L
-#endif
-
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex
index a4abe9a..b70fd6e 100644
--- a/libstdc++-v3/include/std/complex
+++ b/libstdc++-v3/include/std/complex
@@ -52,9 +52,9 @@
#pragma clang diagnostic ignored "-Wc99-extensions"
#endif
-#if __cplusplus > 201703L
-# define __cpp_lib_constexpr_complex 201711L
-#endif
+#define __glibcxx_want_constexpr_complex
+#define __glibcxx_want_complex_udls
+#include <bits/version.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -2604,13 +2604,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return std::complex<__type>(__x, -__type());
}
-#if __cplusplus > 201103L
+#ifdef __cpp_lib_complex_udls // C++ >= 14
inline namespace literals {
inline namespace complex_literals {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wliteral-suffix"
-#define __cpp_lib_complex_udls 201309L
constexpr std::complex<float>
operator""if(long double __num)
@@ -2640,7 +2639,7 @@ inline namespace complex_literals {
} // inline namespace complex_literals
} // inline namespace literals
-#endif // C++14
+#endif // __cpp_lib_complex_udls
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/include/std/concepts b/libstdc++-v3/include/std/concepts
index d77f7e5..d8a05ff 100644
--- a/libstdc++-v3/include/std/concepts
+++ b/libstdc++-v3/include/std/concepts
@@ -30,10 +30,12 @@
#ifndef _GLIBCXX_CONCEPTS
#define _GLIBCXX_CONCEPTS 1
-#if __cplusplus > 201703L && __cpp_concepts >= 201907L
-
#pragma GCC system_header
+#define __glibcxx_want_concepts
+#include <bits/version.h>
+
+#ifdef __cpp_lib_concepts // C++ >= 20 && concepts
/**
* @defgroup concepts Concepts
* @ingroup utilities
@@ -47,8 +49,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_concepts 202002L
-
// [concepts.lang], language-related concepts
namespace __detail
@@ -376,6 +376,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#endif // C++2a
+#endif // __cpp_lib_concepts
#endif /* _GLIBCXX_CONCEPTS */
diff --git a/libstdc++-v3/include/std/coroutine b/libstdc++-v3/include/std/coroutine
index b0ca189..14d0ea2 100644
--- a/libstdc++-v3/include/std/coroutine
+++ b/libstdc++-v3/include/std/coroutine
@@ -31,8 +31,14 @@
#pragma GCC system_header
-// It is very likely that earlier versions would work, but they are untested.
-#if __cplusplus >= 201402L
+#define __glibcxx_want_coroutine
+#include <bits/version.h>
+
+#if !__cpp_impl_coroutine
+# error "the <coroutine> header requires -fcoroutines"
+#endif
+
+#ifdef __cpp_lib_coroutine // C++ >= 14 && impl_coroutine
#include <type_traits>
#if __cplusplus > 201703L
@@ -55,10 +61,6 @@ namespace std _GLIBCXX_VISIBILITY (default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#if __cpp_impl_coroutine
-
-#define __cpp_lib_coroutine 201902L
-
inline namespace __n4861 {
// C++20 17.12.2 coroutine traits
@@ -351,13 +353,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
};
-#else
-#error "the <coroutine> header requires -fcoroutines"
-#endif
-
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++14 (we are allowing use from at least this)
+#endif // __cpp_lib_coroutine
#endif // _GLIBCXX_COROUTINE
diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque
index e3d50d2..c0b05dd 100644
--- a/libstdc++-v3/include/std/deque
+++ b/libstdc++-v3/include/std/deque
@@ -68,6 +68,9 @@
#include <bits/range_access.h>
#include <bits/deque.tcc>
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
#ifdef _GLIBCXX_DEBUG
# include <debug/deque>
#endif
@@ -86,13 +89,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++17
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && erase_if
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_erase_if 202002L
-
template<typename _Tp, typename _Alloc, typename _Predicate>
inline typename deque<_Tp, _Alloc>::size_type
erase_if(deque<_Tp, _Alloc>& __cont, _Predicate __pred)
@@ -134,6 +135,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++20
+#endif // __cpp_lib_erase_if
#endif /* _GLIBCXX_DEQUE */
diff --git a/libstdc++-v3/include/std/execution b/libstdc++-v3/include/std/execution
index 14c8bbe..4349e2b 100644
--- a/libstdc++-v3/include/std/execution
+++ b/libstdc++-v3/include/std/execution
@@ -29,7 +29,12 @@
#include <bits/requires_hosted.h> // execution policies are hosted only
-#if __cplusplus >= 201703L
+#define __glibcxx_want_parallel_algorithm
+#define __glibcxx_want_execution
+#include <bits/version.h>
+
+// C++ >= 17 && HOSTED
+#if defined(__cpp_lib_parallel_algorithm) || defined(__cpp_lib_execution)
# include <bits/c++config.h>
# include <pstl/glue_execution_defs.h>
@@ -50,10 +55,6 @@
# include <pstl/glue_memory_impl.h>
# endif
-// Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201603L
-# define __cpp_lib_execution 201902L
-
#endif // C++17
#endif /* _GLIBCXX_EXECUTION */
diff --git a/libstdc++-v3/include/std/expected b/libstdc++-v3/include/std/expected
index a635574..a796f0b 100644
--- a/libstdc++-v3/include/std/expected
+++ b/libstdc++-v3/include/std/expected
@@ -31,8 +31,10 @@
#pragma GCC system_header
-#if __cplusplus > 202002L && __cpp_concepts >= 202002L
+#define __glibcxx_want_expected
+#include <bits/version.h>
+#ifdef __cpp_lib_expected // C++ >= 23 && __cpp_concepts >= 202002L
#include <initializer_list>
#include <bits/exception.h> // exception
#include <bits/invoke.h> // __invoke
@@ -50,8 +52,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @{
*/
-#define __cpp_lib_expected 202211L
-
/// Discriminated union that holds an expected value or an error value.
/**
* @since C++23
@@ -1815,5 +1815,5 @@ namespace __expected
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++23
+#endif // __cpp_lib_expected
#endif // _GLIBCXX_EXPECTED
diff --git a/libstdc++-v3/include/std/filesystem b/libstdc++-v3/include/std/filesystem
index d46e842..69b5a9c 100644
--- a/libstdc++-v3/include/std/filesystem
+++ b/libstdc++-v3/include/std/filesystem
@@ -34,7 +34,10 @@
#include <bits/requires_hosted.h>
-#if __cplusplus >= 201703L
+#define __glibcxx_want_filesystem
+#include <bits/version.h>
+
+#ifdef __cpp_lib_filesystem // C++ >= 17 && HOSTED
/**
* @defgroup filesystem File System
@@ -50,8 +53,6 @@
#include <bits/fs_dir.h>
#include <bits/fs_ops.h>
-#define __cpp_lib_filesystem 201703L
-
-#endif // C++17
+#endif // __cpp_lib_filesystem
#endif // _GLIBCXX_FILESYSTEM
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 7ea0377..a8db10d 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -33,7 +33,10 @@
#include <bits/requires_hosted.h> // for std::string
-#if __cplusplus >= 202002L
+#define __glibcxx_want_format
+#include <bits/version.h>
+
+#ifdef __cpp_lib_format // C++ >= 20 && HOSTED
#include <array>
#include <charconv>
@@ -60,18 +63,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-// 201907 Text Formatting, Integration of chrono, printf corner cases.
-// 202106 std::format improvements.
-// 202110 Fixing locale handling in chrono formatters, generator-like types.
-// 202207 Encodings in localized formatting of chrono, basic-format-string.
-#define __cpp_lib_format 202106L
-
-#if __cplusplus > 202002L
-// 202207 P2286R8 Formatting Ranges
-// 202207 P2585R1 Improving default container formatting
-// TODO: #define __cpp_lib_format_ranges 202207L
-#endif
-
// [format.context], class template basic_format_context
template<typename _Out, typename _CharT> class basic_format_context;
@@ -4048,5 +4039,5 @@ namespace __format
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++20
+#endif // __cpp_lib_format
#endif // _GLIBCXX_FORMAT
diff --git a/libstdc++-v3/include/std/forward_list b/libstdc++-v3/include/std/forward_list
index 1c110df..bd642a1 100644
--- a/libstdc++-v3/include/std/forward_list
+++ b/libstdc++-v3/include/std/forward_list
@@ -45,6 +45,9 @@
# include <debug/forward_list>
#endif
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
#if __cplusplus >= 201703L
#include <bits/memory_resource.h>
namespace std _GLIBCXX_VISIBILITY(default)
@@ -59,13 +62,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++17
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
-#define __cpp_lib_erase_if 202002L
-
template<typename _Tp, typename _Alloc, typename _Predicate>
inline typename forward_list<_Tp, _Alloc>::size_type
erase_if(forward_list<_Tp, _Alloc>& __cont, _Predicate __pred)
@@ -82,7 +82,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++20
+#endif // __cpp_lib_erase_if
#endif // C++11
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 4a4b8b2..60d4d1f 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -48,6 +48,14 @@
#include <bits/c++config.h>
#include <bits/stl_function.h> // std::equal_to, std::unary_function etc.
+#define __glibcxx_want_invoke
+#define __glibcxx_want_constexpr_functional
+#define __glibcxx_want_invoke_r
+#define __glibcxx_want_bind_front
+#define __glibcxx_want_not_fn
+#define __glibcxx_want_boyer_moore_searcher
+#include <bits/version.h>
+
#if __cplusplus >= 201103L
#include <tuple>
@@ -86,13 +94,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
template<int _Num> struct _Placeholder { };
-#if __cplusplus >= 201103L
-
-#if __cplusplus >= 201703L
-# define __cpp_lib_invoke 201411L
-# if __cplusplus > 201703L
-# define __cpp_lib_constexpr_functional 201907L
-# endif
+#ifdef __cpp_lib_invoke // C++ >= 17
/** Invoke a callable object.
*
@@ -113,9 +115,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return std::__invoke(std::forward<_Callable>(__fn),
std::forward<_Args>(__args)...);
}
+#endif
-#if __cplusplus > 202002L
-# define __cpp_lib_invoke_r 202106L
+#ifdef __cpp_lib_invoke_r // C++ >= 23
/** Invoke a callable object and convert the result to `_Res`.
*
@@ -133,11 +135,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return std::__invoke_r<_Res>(std::forward<_Callable>(__fn),
std::forward<_Args>(__args)...);
}
-#endif // C++23
-#endif // C++17
+#endif // __cpp_lib_invoke_r
/// @cond undocumented
+#if __cplusplus >= 201103L
template<typename _MemFunPtr,
bool __is_mem_fn = is_member_function_pointer<_MemFunPtr>::value>
class _Mem_fn_base
@@ -910,8 +912,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::forward<_BoundArgs>(__args)...);
}
-#if __cplusplus > 201703L
-#define __cpp_lib_bind_front 201907L
+#ifdef __cpp_lib_bind_front // C++ >= 20
template<typename _Fd, typename... _BoundArgs>
struct _Bind_front
@@ -1077,7 +1078,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return _Bind_front_t<_Fn, _Args...>(0, std::forward<_Fn>(__fn),
std::forward<_Args>(__args)...);
}
-#endif // C++20
+#endif // __cpp_lib_bind_front
#if __cplusplus >= 201402L
/// Generalized negator.
@@ -1147,9 +1148,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<>
struct __is_byte_like<byte, equal_to<void>>
: true_type { };
+#endif
// [func.not_fn] Function template not_fn
-#define __cpp_lib_not_fn 201603L
+#ifdef __cpp_lib_not_fn // C++ >= 17
/** Wrap a function object to create one that negates its result.
*
* The function template `std::not_fn` creates a "forwarding call wrapper",
@@ -1170,7 +1172,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
return _Not_fn<std::decay_t<_Fn>>{std::forward<_Fn>(__fn), 0};
}
+#endif
+#if __cplusplus >= 201703L
// Searchers
template<typename _ForwardIterator1, typename _BinaryPredicate = equal_to<>>
@@ -1203,8 +1207,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple<_ForwardIterator1, _ForwardIterator1, _BinaryPredicate> _M_m;
};
-#if _GLIBCXX_HOSTED
-#define __cpp_lib_boyer_moore_searcher 201603L
+#ifdef __cpp_lib_boyer_moore_searcher // C++ >= 17 && HOSTED
template<typename _Key, typename _Tp, typename _Hash, typename _Pred>
struct __boyer_moore_map_base
@@ -1448,7 +1451,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
return std::make_pair(__last, __last);
}
-#endif // HOSTED
+#endif // __cpp_lib_boyer_moore_searcher
#endif // C++17
#endif // C++14
diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip
index eb82fc5..5861c9c 100644
--- a/libstdc++-v3/include/std/iomanip
+++ b/libstdc++-v3/include/std/iomanip
@@ -41,6 +41,9 @@
#include <iosfwd>
#include <bits/ios_base.h>
+#define __glibcxx_want_quoted_string_io
+#include <bits/version.h>
+
#if __cplusplus >= 201103L
#include <locale>
#if __cplusplus > 201103L
@@ -450,9 +453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __is;
}
-#if __cplusplus >= 201402L
-
-#define __cpp_lib_quoted_string_io 201304L
+#ifdef __cpp_lib_quoted_string_io // C++ >= 14 && HOSTED
/**
* @brief Manipulator for quoted strings.
@@ -502,7 +503,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
basic_string_view<_CharT, _Traits>, _CharT>(__sv, __delim, __escape);
}
#endif // C++17
-#endif // C++14
+#endif // __cpp_lib_quoted_string_io
#endif // __cplusplus >= 201103L
diff --git a/libstdc++-v3/include/std/iterator b/libstdc++-v3/include/std/iterator
index 695e18e..8c8670f 100644
--- a/libstdc++-v3/include/std/iterator
+++ b/libstdc++-v3/include/std/iterator
@@ -67,9 +67,8 @@
#endif
#include <bits/range_access.h>
-#if __cplusplus >= 201402L && ! defined _GLIBCXX_DEBUG // PR libstdc++/70303
-# define __cpp_lib_null_iterators 201304L
-#endif
+#define __glibcxx_want_null_iterators
+#include <bits/version.h>
#if __cplusplus >= 202002L
#include <bits/ranges_base.h> // ranges::distance, ranges::next, ranges::prev
diff --git a/libstdc++-v3/include/std/latch b/libstdc++-v3/include/std/latch
index a5a92fa..27cd80d 100644
--- a/libstdc++-v3/include/std/latch
+++ b/libstdc++-v3/include/std/latch
@@ -33,18 +33,17 @@
#include <bits/requires_hosted.h> // concurrency
-#if __cplusplus > 201703L
+#define __glibcxx_want_latch
+#include <bits/version.h>
+#ifdef __cpp_lib_latch // C++ >= 20 && atomic_wait
#include <bits/atomic_base.h>
#include <ext/numeric_traits.h>
-#if __cpp_lib_atomic_wait
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_latch 201907L
-
class latch
{
public:
@@ -91,6 +90,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
-#endif // __cpp_lib_atomic_wait
-#endif // __cplusplus > 201703L
+#endif // __cpp_lib_latch
#endif // _GLIBCXX_LATCH
diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list
index 48861b9..9841591 100644
--- a/libstdc++-v3/include/std/list
+++ b/libstdc++-v3/include/std/list
@@ -69,6 +69,9 @@
# include <debug/list>
#endif
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
#if __cplusplus >= 201703L
#include <bits/memory_resource.h>
namespace std _GLIBCXX_VISIBILITY(default)
@@ -83,13 +86,10 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++17
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
-#define __cpp_lib_erase_if 202002L
-
template<typename _Tp, typename _Alloc, typename _Predicate>
inline typename list<_Tp, _Alloc>::size_type
erase_if(list<_Tp, _Alloc>& __cont, _Predicate __pred)
@@ -106,6 +106,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++20
+#endif // __cpp_lib_erase_if
#endif /* _GLIBCXX_LIST */
diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory
index 85c36d6..3cce72c 100644
--- a/libstdc++-v3/include/std/memory
+++ b/libstdc++-v3/include/std/memory
@@ -91,11 +91,9 @@
# include <bits/uses_allocator_args.h>
#endif
-/* As a hack, we declare __cpp_lib_atomic_value_initialization here even though
- we don't include the bit that actually declares it, for consistency. */
-#if !defined(__cpp_lib_atomic_value_initialization) && __cplusplus >= 202002L
-# define __cpp_lib_atomic_value_initialization 201911L
-#endif
+#define __glibcxx_want_atomic_value_initialization
+#define __glibcxx_want_parallel_algorithm
+#include <bits/version.h>
#if __cplusplus >= 201103L && __cplusplus <= 202002L && _GLIBCXX_HOSTED
namespace std _GLIBCXX_VISIBILITY(default)
@@ -144,7 +142,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // C++11 to C++20
-#if __cplusplus >= 201703L && _GLIBCXX_HOSTED
+#ifdef __cpp_lib_parallel_algorithm // C++ >= 17 && HOSTED
// Parallel STL algorithms
# if _PSTL_EXECUTION_POLICIES_DEFINED
// If <execution> has already been included, pull in implementations
@@ -153,9 +151,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
// Otherwise just pull in forward declarations
# include <pstl/glue_memory_defs.h>
# endif
-
-// Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201603L
-#endif // C++17
+#endif // __cpp_lib_parallel_algorithm
#endif /* _GLIBCXX_MEMORY */
diff --git a/libstdc++-v3/include/std/memory_resource b/libstdc++-v3/include/std/memory_resource
index fdfc23c..229c6a8 100644
--- a/libstdc++-v3/include/std/memory_resource
+++ b/libstdc++-v3/include/std/memory_resource
@@ -36,6 +36,10 @@
#include <bits/requires_hosted.h> // polymorphic allocation
+#define __glibcxx_want_polymorphic_allocator
+#define __glibcxx_want_memory_resource
+#include <bits/version.h>
+
#if __cplusplus >= 201703L
/**
@@ -68,16 +72,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
_GLIBCXX_BEGIN_NAMESPACE_VERSION
namespace pmr
{
-#ifdef _GLIBCXX_HAS_GTHREADS
- // Header and all contents are present.
-# define __cpp_lib_memory_resource 201603L
-#else
- // The pmr::synchronized_pool_resource type is missing.
-# define __cpp_lib_memory_resource 1
-#endif
-#if __cplusplus >= 202002L
-# define __cpp_lib_polymorphic_allocator 201902L
+#ifdef __cpp_lib_polymorphic_allocator // C++ >= 20 && HOSTED
template<typename _Tp = std::byte>
class polymorphic_allocator;
#endif
@@ -111,7 +107,7 @@ namespace pmr
// Pool resource classes
struct pool_options;
-#ifdef _GLIBCXX_HAS_GTHREADS
+#if __cpp_lib_memory_resource >= 201603L // C++ >= 17 && hosted && gthread
class synchronized_pool_resource;
#endif
class unsynchronized_pool_resource;
@@ -182,7 +178,7 @@ namespace pmr
const int _M_npools;
};
-#ifdef _GLIBCXX_HAS_GTHREADS
+#if __cpp_lib_memory_resource >= 201603L // C++ >= 17 && hosted && gthread
/// A thread-safe memory resource that manages pools of fixed-size blocks.
/**
* @ingroup pmr
@@ -252,7 +248,7 @@ namespace pmr
_TPools* _M_tpools = nullptr;
mutable shared_mutex _M_mx;
};
-#endif
+#endif // __cpp_lib_memory_resource >= 201603L
/// A non-thread-safe memory resource that manages pools of fixed-size blocks.
/**
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 2b0059f..bd3a1cb 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -56,6 +56,9 @@
# include <bits/std_function.h> // std::function
#endif
+#define __glibcxx_want_scoped_lock
+#include <bits/version.h>
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -728,8 +731,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
}
-#if __cplusplus >= 201703L
-#define __cpp_lib_scoped_lock 201703L
+#ifdef __cpp_lib_scoped_lock // C++ >= 17 && hosted && gthread
/** @brief A scoped lock type for multiple lockable objects.
*
* A scoped_lock controls mutex ownership within a scope, releasing
@@ -793,7 +795,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private:
mutex_type& _M_device;
};
-#endif // C++17
+#endif // __cpp_lib_scoped_lock
#ifdef _GLIBCXX_HAS_GTHREADS
/// Flag type used by std::call_once
diff --git a/libstdc++-v3/include/std/numbers b/libstdc++-v3/include/std/numbers
index d7d9e81..ee717cc 100644
--- a/libstdc++-v3/include/std/numbers
+++ b/libstdc++-v3/include/std/numbers
@@ -31,7 +31,10 @@
#pragma GCC system_header
-#if __cplusplus > 201703L
+#define __glibcxx_want_math_constants
+#include <bits/version.h>
+
+#ifdef __cpp_lib_math_constants // C++ >= 20
#include <type_traits>
@@ -47,7 +50,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// Namespace for mathematical constants
namespace numbers
{
-#define __cpp_lib_math_constants 201907L
/// @cond undocumented
template<typename _Tp>
@@ -230,5 +232,5 @@ __glibcxx_numbers (__float128, Q);
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++20
+#endif // __cpp_lib_math_constants
#endif // _GLIBCXX_NUMBERS
diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric
index 514db93..8c8d200 100644
--- a/libstdc++-v3/include/std/numeric
+++ b/libstdc++-v3/include/std/numeric
@@ -79,6 +79,14 @@
# include <limits>
#endif
+#define __glibcxx_want_constexpr_numeric
+#define __glibcxx_want_gcd
+#define __glibcxx_want_gcd_lcm
+#define __glibcxx_want_interpolate
+#define __glibcxx_want_lcm
+#define __glibcxx_want_parallel_algorithm
+#include <bits/version.h>
+
/**
* @defgroup numerics Numerics
*
@@ -150,14 +158,9 @@ namespace __detail
}
}
} // namespace __detail
+#endif // C++14
-#if __cplusplus >= 201703L
-
-#define __cpp_lib_gcd_lcm 201606L
-// These were used in drafts of SD-6:
-#define __cpp_lib_gcd 201606L
-#define __cpp_lib_lcm 201606L
-
+#ifdef __cpp_lib_gcd_lcm // C++ >= 17
/// Greatest common divisor
template<typename _Mn, typename _Nn>
constexpr common_type_t<_Mn, _Nn>
@@ -198,14 +201,10 @@ namespace __detail
return __r;
}
-#endif // C++17
-#endif // C++14
-
-#if __cplusplus > 201703L
+#endif // __cpp_lib_gcd_lcm
// midpoint
-# define __cpp_lib_interpolate 201902L
-
+#ifdef __cpp_lib_interpolate // C++ >= 20
template<typename _Tp>
constexpr
enable_if_t<__and_v<is_arithmetic<_Tp>, is_same<remove_cv_t<_Tp>, _Tp>,
@@ -251,14 +250,9 @@ namespace __detail
static_assert( sizeof(_Tp) != 0, "type must be complete" );
return __a + (__b - __a) / 2;
}
-#endif // C++20
+#endif // __cpp_lib_interpolate
#if __cplusplus >= 201703L
-
-#if __cplusplus > 201703L
-#define __cpp_lib_constexpr_numeric 201911L
-#endif
-
/// @addtogroup numeric_ops
/// @{
@@ -739,9 +733,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
# include <pstl/glue_numeric_defs.h>
# define _PSTL_NUMERIC_FORWARD_DECLARED 1
# endif
-
-// Feature test macro for parallel algorithms
-# define __cpp_lib_parallel_algorithm 201603L
#endif // C++17
#endif /* _GLIBCXX_NUMERIC */
diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional
index 85e814c..4f75eb9 100644
--- a/libstdc++-v3/include/std/optional
+++ b/libstdc++-v3/include/std/optional
@@ -32,7 +32,10 @@
#pragma GCC system_header
-#if __cplusplus >= 201703L
+#define __glibcxx_want_optional
+#include <bits/version.h>
+
+#ifdef __cpp_lib_optional // C++ >= 17
#include <type_traits>
#include <exception>
@@ -60,14 +63,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @{
*/
-#if __cplusplus > 202002L && __cpp_lib_concepts
-# define __cpp_lib_optional 202110L
-#elif __cplusplus >= 202002L
-# define __cpp_lib_optional 202106L
-#else
-# define __cpp_lib_optional 201606L
-#endif
-
template<typename _Tp>
class optional;
@@ -1507,6 +1502,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++17
+#endif // __cpp_lib_optional
#endif // _GLIBCXX_OPTIONAL
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index c4d4d85..fb4a6a8 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -51,6 +51,21 @@
#include <bits/ranges_util.h>
#include <bits/refwrap.h>
+#define __glibcxx_want_ranges_as_const
+#define __glibcxx_want_ranges_as_rvalue
+#define __glibcxx_want_ranges_cartesian_product
+#define __glibcxx_want_ranges_chunk
+#define __glibcxx_want_ranges_chunk_by
+#define __glibcxx_want_ranges_enumerate
+#define __glibcxx_want_ranges_iota
+#define __glibcxx_want_ranges_iota
+#define __glibcxx_want_ranges_join_with
+#define __glibcxx_want_ranges_repeat
+#define __glibcxx_want_ranges_slide
+#define __glibcxx_want_ranges_stride
+#define __glibcxx_want_ranges_zip
+#include <bits/version.h>
+
/**
* @defgroup ranges Ranges
*
@@ -4390,10 +4405,7 @@ namespace views::__adaptor
inline constexpr auto values = elements<1>;
} // namespace views
-#if __cplusplus > 202002L
-
-#define __cpp_lib_ranges_zip 202110L
-
+#ifdef __cpp_lib_ranges_zip // C++ >= 23
namespace __detail
{
template<typename... _Rs>
@@ -5831,9 +5843,9 @@ namespace views::__adaptor
inline constexpr auto pairwise_transform = adjacent_transform<2>;
}
+#endif // __cpp_lib_ranges_zip
-#define __cpp_lib_ranges_chunk 202202L
-
+#ifdef __cpp_lib_ranges_chunk // C++ >= 23
namespace __detail
{
template<typename _Tp>
@@ -6370,9 +6382,9 @@ namespace views::__adaptor
inline constexpr _Chunk chunk;
}
+#endif // __cpp_lib_ranges_chunk
-#define __cpp_lib_ranges_slide 202202L
-
+#ifdef __cpp_lib_ranges_slide // C++ >= 23
namespace __detail
{
template<typename _Vp>
@@ -6735,9 +6747,9 @@ namespace views::__adaptor
inline constexpr _Slide slide;
}
+#endif // __cpp_lib_ranges_slide
-#define __cpp_lib_ranges_chunk_by 202202L
-
+#ifdef __cpp_lib_ranges_chunk_by // C++ >= 23
template<forward_range _Vp,
indirect_binary_predicate<iterator_t<_Vp>, iterator_t<_Vp>> _Pred>
requires view<_Vp> && is_object_v<_Pred>
@@ -6930,9 +6942,9 @@ namespace views::__adaptor
inline constexpr _ChunkBy chunk_by;
}
+#endif // __cpp_lib_ranges_chunk_by
-#define __cpp_lib_ranges_join_with 202202L
-
+#ifdef __cpp_lib_ranges_join_with // C++ >= 23
namespace __detail
{
template<typename _Range, typename _Pattern>
@@ -7412,9 +7424,9 @@ namespace views::__adaptor
inline constexpr _JoinWith join_with;
} // namespace views
+#endif // __cpp_lib_ranges_join_with
-#define __cpp_lib_ranges_repeat 202207L
-
+#ifdef __cpp_lib_ranges_repeat // C++ >= 32
template<copy_constructible _Tp, semiregular _Bound = unreachable_sentinel_t>
requires is_object_v<_Tp> && same_as<_Tp, remove_cv_t<_Tp>>
&& (__detail::__is_integer_like<_Bound> || same_as<_Bound, unreachable_sentinel_t>)
@@ -7666,9 +7678,9 @@ namespace views::__adaptor
}
}
}
+#endif // __cpp_lib_ranges_repeat
-#define __cpp_lib_ranges_stride 202207L
-
+#ifdef __cpp_lib_ranges_stride // C++ >= 23
template<input_range _Vp>
requires view<_Vp>
class stride_view : public view_interface<stride_view<_Vp>>
@@ -8019,9 +8031,9 @@ namespace views::__adaptor
inline constexpr _Stride stride;
}
+#endif // __cpp_lib_ranges_stride
-#define __cpp_lib_ranges_cartesian_product 202207L
-
+#ifdef __cpp_lib_ranges_cartesian_product // C++ >= 23
namespace __detail
{
template<bool _Const, typename _First, typename... _Vs>
@@ -8542,9 +8554,9 @@ namespace views::__adaptor
inline constexpr _CartesianProduct cartesian_product;
}
+#endif // __cpp_lib_ranges_cartesian_product
-#define __cpp_lib_ranges_as_rvalue 202207L
-
+#ifdef __cpp_lib_ranges_as_rvalue // C++ >= 23
template<input_range _Vp>
requires view<_Vp>
class as_rvalue_view : public view_interface<as_rvalue_view<_Vp>>
@@ -8634,9 +8646,9 @@ namespace views::__adaptor
inline constexpr _AsRvalue as_rvalue;
}
+#endif // __cpp_lib_as_rvalue
-#define __cpp_lib_ranges_enumerate 202302L
-
+#ifdef __cpp_lib_ranges_enumerate // C++ >= 23
namespace __detail
{
template<typename _Range>
@@ -8937,9 +8949,9 @@ namespace views::__adaptor
inline constexpr _Enumerate enumerate;
}
+#endif // __cpp_lib_ranges_enumerate
-#define __cpp_lib_ranges_as_const 202207L
-
+#ifdef __cpp_lib_ranges_as_const // C++ >= 23
template<view _Vp>
requires input_range<_Vp>
class as_const_view : public view_interface<as_const_view<_Vp>>
@@ -9043,7 +9055,7 @@ namespace views::__adaptor
inline constexpr _AsConst as_const;
}
-#endif // C++23
+#endif // __cpp_lib_as_const
} // namespace ranges
namespace views = ranges::views;
diff --git a/libstdc++-v3/include/std/semaphore b/libstdc++-v3/include/std/semaphore
index dfc272f..5ca4da7 100644
--- a/libstdc++-v3/include/std/semaphore
+++ b/libstdc++-v3/include/std/semaphore
@@ -36,13 +36,14 @@
#if __cplusplus > 201703L
#include <bits/semaphore_base.h>
-#if __cpp_lib_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE
+#define __glibcxx_want_semaphore
+#include <bits/version.h>
+
+#ifdef __cpp_lib_semaphore // C++ >= 20 && hosted && (atomic_wait || posix_sem)
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_semaphore 201907L
-
template<ptrdiff_t __least_max_value = __semaphore_impl::_S_max>
class counting_semaphore
{
@@ -93,5 +94,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif // cpp_lib_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE
-#endif // C++20
+#endif // __cpp_lib_semaphore
#endif // _GLIBCXX_SEMAPHORE
diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index 124da61..4f236a1 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -41,6 +41,10 @@
#include <bits/move.h> // move, __exchange
#include <bits/std_mutex.h> // defer_lock_t
+#define __glibcxx_want_shared_mutex
+#define __glibcxx_want_shared_timed_mutex
+#include <bits/version.h>
+
#if ! (_GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK)
# include <condition_variable>
#endif
@@ -56,12 +60,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#ifdef _GLIBCXX_HAS_GTHREADS
-#if __cplusplus >= 201703L
-#define __cpp_lib_shared_mutex 201505L
+#ifdef __cpp_lib_shared_mutex // C++ >= 17 && hosted && gthread
class shared_mutex;
#endif
-#define __cpp_lib_shared_timed_mutex 201402L
class shared_timed_mutex;
/// @cond undocumented
@@ -407,7 +409,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
/// @endcond
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_shared_mutex
/// The standard shared mutex type.
class shared_mutex
{
@@ -441,7 +443,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__shared_mutex_cv _M_impl;
#endif
};
-#endif // C++17
+#endif // __cpp_lib_shared_mutex
/// @cond undocumented
#if _GLIBCXX_USE_PTHREAD_RWLOCK_T && _GTHREAD_USE_MUTEX_TIMEDLOCK
diff --git a/libstdc++-v3/include/std/source_location b/libstdc++-v3/include/std/source_location
index 9f49282..10e3c9f 100644
--- a/libstdc++-v3/include/std/source_location
+++ b/libstdc++-v3/include/std/source_location
@@ -29,15 +29,16 @@
#ifndef _GLIBCXX_SRCLOC
#define _GLIBCXX_SRCLOC 1
-#if __cplusplus > 201703L && __has_builtin(__builtin_source_location)
+#define __glibcxx_want_source_location
+#include <bits/version.h>
+
+#if __cpp_lib_source_location // C++ >= 20 && builtin_source_location
#include <bits/c++config.h>
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_source_location 201907L
-
/// A class that describes a location in source code.
struct source_location
{
@@ -88,5 +89,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++20 && __builtin_source_location
+#endif // __cpp_lib_source_location
#endif // _GLIBCXX_SRCLOC
diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span
index 6763389..d5644a19 100644
--- a/libstdc++-v3/include/std/span
+++ b/libstdc++-v3/include/std/span
@@ -36,20 +36,18 @@
#pragma GCC system_header
-#if __cplusplus > 201703L
+#define __glibcxx_want_span
+#include <bits/version.h>
+#ifdef __cpp_lib_span // C++ >= 20 && concepts
#include <array>
#include <cstddef>
#include <bits/stl_iterator.h>
#include <bits/ranges_base.h>
-
-#if __cpp_lib_concepts
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_span 202002L
-
inline constexpr size_t dynamic_extent = static_cast<size_t>(-1);
template<typename _Type, size_t _Extent>
@@ -476,6 +474,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // concepts
-#endif // C++20
+#endif // __cpp_lib_span
#endif // _GLIBCXX_SPAN
diff --git a/libstdc++-v3/include/std/spanstream b/libstdc++-v3/include/std/spanstream
index 483996b..1f2d78b 100644
--- a/libstdc++-v3/include/std/spanstream
+++ b/libstdc++-v3/include/std/spanstream
@@ -33,20 +33,20 @@
#include <bits/requires_hosted.h> // iostreams
-#if __cplusplus > 202002L
+#define __glibcxx_want_spanstream
+#include <bits/version.h>
+
+#ifdef __cpp_lib_spanstream // C++ >= 23 && hosted && lib_span
#include <span>
#include <streambuf>
#include <istream>
#include <ostream>
#include <bits/ranges_base.h>
-#if __cpp_lib_span
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_spanstream 202106L
-
template<typename _CharT, typename _Traits>
class basic_spanbuf
: public basic_streambuf<_CharT, _Traits>
@@ -451,6 +451,5 @@ using wspanstream = basic_spanstream<wchar_t>;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // __cpp_lib_span
-#endif // C++23
+#endif // __cpp_lib_spanstream
#endif // _GLIBCXX_SPANSTREAM
diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace
index 346c7b1..07949e7 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -30,7 +30,10 @@
#include <bits/c++config.h>
-#if __cplusplus > 202002L && _GLIBCXX_HAVE_STACKTRACE
+#define __glibcxx_want_stacktrace
+#include <bits/version.h>
+
+#ifdef __cpp_lib_stacktrace // C++ >= 23 && hosted && HAVE_STACKTRACE
#include <compare>
#include <new>
#include <string>
@@ -83,8 +86,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_stacktrace 202011L
-
// [stacktrace.entry], class stacktrace_entry
class stacktrace_entry
{
@@ -800,6 +801,5 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++23
-
+#endif // __cpp_lib_stacktrace
#endif /* _GLIBCXX_STACKTRACE */
diff --git a/libstdc++-v3/include/std/stop_token b/libstdc++-v3/include/std/stop_token
index c90fc78..3be0f5a 100644
--- a/libstdc++-v3/include/std/stop_token
+++ b/libstdc++-v3/include/std/stop_token
@@ -31,6 +31,9 @@
#include <bits/requires_hosted.h> // concurrency
+#define __glibcxx_want_jthread
+#include <bits/version.h>
+
#if __cplusplus > 201703L
#include <atomic>
@@ -38,8 +41,6 @@
#include <semaphore>
-#define __cpp_lib_jthread 201911L
-
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string
index dd4ece1..832e9d8 100644
--- a/libstdc++-v3/include/std/string
+++ b/libstdc++-v3/include/std/string
@@ -54,6 +54,9 @@
#include <bits/basic_string.h>
#include <bits/basic_string.tcc>
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
#if __cplusplus >= 201703L && _GLIBCXX_USE_CXX11_ABI
#include <bits/memory_resource.h>
namespace std _GLIBCXX_VISIBILITY(default)
@@ -75,13 +78,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++17
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_erase_if 202002L
-
template<typename _CharT, typename _Traits, typename _Alloc,
typename _Predicate>
_GLIBCXX20_CONSTEXPR
@@ -112,6 +113,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++20
+#endif // __cpp_lib_erase_if
#endif /* _GLIBCXX_STRING */
diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view
index be9036a..d103abd 100644
--- a/libstdc++-v3/include/std/string_view
+++ b/libstdc++-v3/include/std/string_view
@@ -35,6 +35,12 @@
#pragma GCC system_header
+#define __glibcxx_want_string_view
+#define __glibcxx_want_constexpr_string_view
+#define __glibcxx_want_starts_ends_with
+#define __glibcxx_want_string_contains
+#include <bits/version.h>
+
#if __cplusplus >= 201703L
#include <bits/char_traits.h>
@@ -57,14 +63,6 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#if _GLIBCXX_HOSTED
-# define __cpp_lib_string_view 201803L
-#endif
-
-#if __cplusplus > 201703L
-# define __cpp_lib_constexpr_string_view 201811L
-#endif
-
// Helper for basic_string and basic_string_view members.
constexpr size_t
__sv_check(size_t __size, size_t __pos, const char* __s)
@@ -380,8 +378,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
.compare(basic_string_view(__str, __n2));
}
-#if __cplusplus > 201703L
-#define __cpp_lib_starts_ends_with 201711L
+#ifdef __cpp_lib_starts_ends_with // C++ >= 20
[[nodiscard]]
constexpr bool
starts_with(basic_string_view __x) const noexcept
@@ -416,13 +413,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
constexpr bool
ends_with(const _CharT* __x) const noexcept
{ return this->ends_with(basic_string_view(__x)); }
-#endif // C++20
+#endif // __cpp_lib_starts_ends_with
#if __cplusplus > 202002L
-#if _GLIBCXX_HOSTED
+#if _GLIBCXX_HOSTED && !defined(__cpp_lib_string_contains)
// This FTM is not freestanding as it also implies matching <string>
// support, and <string> is omitted from the freestanding subset.
-# define __cpp_lib_string_contains 202011L
+# error "libstdc++ bug: string_contains not defined when it should be"
#endif // HOSTED
[[nodiscard]]
constexpr bool
diff --git a/libstdc++-v3/include/std/syncstream b/libstdc++-v3/include/std/syncstream
index 3788b71..7262a96 100644
--- a/libstdc++-v3/include/std/syncstream
+++ b/libstdc++-v3/include/std/syncstream
@@ -29,17 +29,16 @@
#ifndef _GLIBCXX_SYNCSTREAM
#define _GLIBCXX_SYNCSTREAM 1
-#if __cplusplus > 201703L
-
-#include <bits/c++config.h>
-#if _GLIBCXX_USE_CXX11_ABI
-
-#define __cpp_lib_syncbuf 201803L
-
#pragma GCC system_header
#include <bits/requires_hosted.h> // iostreams
+#include <bits/c++config.h>
+
+#define __glibcxx_want_syncbuf
+#include <bits/version.h>
+
+#ifdef __cpp_lib_syncbuf // C++ >= 20 && HOSTED && CXX11ABI
#include <sstream>
#include <bits/alloc_traits.h>
@@ -314,6 +313,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using wosyncstream = basic_osyncstream<wchar_t>;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // _GLIBCXX_USE_CXX11_ABI
-#endif // C++2a
+#endif // __cpp_lib_syncbuf
+
#endif /* _GLIBCXX_SYNCSTREAM */
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index ee2dc36..2c049ed 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -45,6 +45,9 @@
#include <bits/std_thread.h> // std::thread, get_id, yield
#include <bits/this_thread_sleep.h> // std::this_thread::sleep_for, sleep_until
+#define __glibcxx_want_jthread
+#include <bits/version.h>
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index c9ea2a8..797d8c0 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -42,9 +42,14 @@
#if __cplusplus > 201703L
# include <compare>
# include <bits/ranges_util.h> // for std::ranges::subrange
-# define __cpp_lib_constexpr_tuple 201811L
#endif
+#define __glibcxx_want_constexpr_tuple
+#define __glibcxx_want_tuples_by_type
+#define __glibcxx_want_apply
+#define __glibcxx_want_make_from_tuple
+#include <bits/version.h>
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1820,10 +1825,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
get(const tuple<_Elements...>&) = delete;
/// @endcond
-#if __cplusplus >= 201402L
-
-#define __cpp_lib_tuples_by_type 201304L
-
+#ifdef __cpp_lib_tuples_by_type // C++ >= 14
/// Return a reference to the unique element of type _Tp of a tuple.
template <typename _Tp, typename... _Types>
constexpr _Tp&
@@ -2254,8 +2256,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
{ }
-#if __cplusplus >= 201703L
-
+#if defined(__cpp_lib_apply) || defined(__cpp_lib_make_from_tuple) // C++ >= 17
// Unpack a std::tuple into a type trait and use its value.
// For cv std::tuple<_Up> the result is _Trait<_Tp, cv _Up...>::value.
// For cv std::tuple<_Up>& the result is _Trait<_Tp, cv _Up&...>::value.
@@ -2278,9 +2279,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<template<typename...> class _Trait, typename _Tp, typename... _Up>
inline constexpr bool __unpack_std_tuple<_Trait, _Tp, const tuple<_Up...>&>
= _Trait<_Tp, const _Up&...>::value;
+#endif
-# define __cpp_lib_apply 201603L
-
+#ifdef __cpp_lib_apply // C++ >= 17
template <typename _Fn, typename _Tuple, size_t... _Idx>
constexpr decltype(auto)
__apply_impl(_Fn&& __f, _Tuple&& __t, index_sequence<_Idx...>)
@@ -2300,9 +2301,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::forward<_Tuple>(__t),
_Indices{});
}
+#endif
-#define __cpp_lib_make_from_tuple 201606L
-
+#ifdef __cpp_lib_make_from_tuple // C++ >= 17
template <typename _Tp, typename _Tuple, size_t... _Idx>
constexpr _Tp
__make_from_tuple_impl(_Tuple&& __t, index_sequence<_Idx...>)
@@ -2324,7 +2325,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __make_from_tuple_impl<_Tp>(std::forward<_Tuple>(__t),
make_index_sequence<__n>{});
}
-#endif // C++17
+#endif
#if __cplusplus > 202002L
template<typename... _TTypes, typename... _UTypes,
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index 7dc5791..677cd93 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -37,6 +37,31 @@
#include <bits/c++config.h>
+#define __glibcxx_want_bool_constant
+#define __glibcxx_want_bounded_array_traits
+#define __glibcxx_want_has_unique_object_representations
+#define __glibcxx_want_integral_constant_callable
+#define __glibcxx_want_is_aggregate
+#define __glibcxx_want_is_constant_evaluated
+#define __glibcxx_want_is_final
+#define __glibcxx_want_is_invocable
+#define __glibcxx_want_is_layout_compatible
+#define __glibcxx_want_is_nothrow_convertible
+#define __glibcxx_want_is_null_pointer
+#define __glibcxx_want_is_pointer_interconvertible
+#define __glibcxx_want_is_scoped_enum
+#define __glibcxx_want_is_swappable
+#define __glibcxx_want_logical_traits
+#define __glibcxx_want_reference_from_temporary
+#define __glibcxx_want_remove_cvref
+#define __glibcxx_want_result_of_sfinae
+#define __glibcxx_want_transformation_trait_aliases
+#define __glibcxx_want_type_identity
+#define __glibcxx_want_type_trait_variable_templates
+#define __glibcxx_want_unwrap_ref
+#define __glibcxx_want_void_t
+#include <bits/version.h>
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -65,10 +90,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using value_type = _Tp;
using type = integral_constant<_Tp, __v>;
constexpr operator value_type() const noexcept { return value; }
-#if __cplusplus > 201103L
-
-#define __cpp_lib_integral_constant_callable 201304L
+#ifdef __cpp_lib_integral_constant_callable // C++ >= 14
constexpr value_type operator()() const noexcept { return value; }
#endif
};
@@ -90,8 +113,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// The type used as a compile-time boolean with false value.
using false_type = __bool_constant<false>;
-#if __cplusplus >= 201703L
-# define __cpp_lib_bool_constant 201505L
+#ifdef __cpp_lib_bool_constant // C++ >= 17
/// Alias template for compile-time boolean constant types.
/// @since C++17
template<bool __v>
@@ -183,7 +205,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
/// @endcond
-#if __cplusplus >= 201703L
+#ifdef __cpp_lib_logical_traits // C++ >= 17
/// @cond undocumented
template<typename... _Bn>
@@ -211,8 +233,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} // namespace __detail
/// @endcond
-#define __cpp_lib_logical_traits 201510L
-
template<typename... _Bn>
struct conjunction
: __detail::__conjunction_impl<void, _Bn...>::type
@@ -251,7 +271,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline constexpr bool negation_v = negation<_Pp>::value;
/// @}
-#endif // C++17
+#endif // __cpp_lib_logical_traits
// Forward declarations
template<typename>
@@ -606,8 +626,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct is_function<_Tp&&>
: public false_type { };
-#define __cpp_lib_is_null_pointer 201309L
-
+#ifdef __cpp_lib_is_null_pointer // C++ >= 11
/// is_null_pointer (LWG 2247).
template<typename _Tp>
struct is_null_pointer
@@ -635,6 +654,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __is_nullptr_t
: public is_null_pointer<_Tp>
{ } _GLIBCXX_DEPRECATED_SUGGEST("std::is_null_pointer");
+#endif // __cpp_lib_is_null_pointer
// Composite type categories.
@@ -849,8 +869,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public __bool_constant<__is_polymorphic(_Tp)>
{ };
-#if __cplusplus >= 201402L
-#define __cpp_lib_is_final 201402L
+#ifdef __cpp_lib_is_final // C++ >= 14
/// is_final
/// @since C++14
template<typename _Tp>
@@ -1459,8 +1478,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using __is_array_convertible
= is_convertible<_FromElementType(*)[], _ToElementType(*)[]>;
-#if __cplusplus >= 202002L
-#define __cpp_lib_is_nothrow_convertible 201806L
+#ifdef __cpp_lib_is_nothrow_convertible // C++ >= 20
#if __has_builtin(__is_nothrow_convertible)
/// is_nothrow_convertible_v
@@ -1514,7 +1532,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline constexpr bool is_nothrow_convertible_v
= is_nothrow_convertible<_From, _To>::value;
#endif
-#endif // C++2a
+#endif // __cpp_lib_is_nothrow_convertible
// Const-volatile modifications.
@@ -1574,10 +1592,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct add_cv
{ using type = _Tp const volatile; };
-#if __cplusplus > 201103L
-
-#define __cpp_lib_transformation_trait_aliases 201304L
-
+#ifdef __cpp_lib_transformation_trait_aliases // C++ >= 14
/// Alias template for remove_const
template<typename _Tp>
using remove_const_t = typename remove_const<_Tp>::type;
@@ -2396,8 +2411,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Sfinae-friendly result_of implementation:
-#define __cpp_lib_result_of_sfinae 201210L
-
/// @cond undocumented
struct __invoke_memfun_ref { };
struct __invoke_memfun_deref { };
@@ -2626,8 +2639,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
using result_of_t = typename result_of<_Tp>::type;
#endif // C++14
-#if __cplusplus >= 201703L || !defined(__STRICT_ANSI__) // c++17 or gnu++11
-#define __cpp_lib_void_t 201411L
+#ifdef __cpp_lib_void_t // C++ >= 17 || GNU++ >= 11
/// A metafunction that always yields void, used for detecting valid types.
template<typename...> using void_t = void;
#endif
@@ -2784,8 +2796,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ };
/// @endcond
-#if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11
-#define __cpp_lib_is_swappable 201603L
+#ifdef __cpp_lib_is_swappable // C++ >= 17 || GNU++ >= 11
/// Metafunctions used for detecting swappable types: p0185r1
/// is_swappable
@@ -2914,7 +2925,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
is_nothrow_swappable_with<_Tp, _Up>::value;
#endif // __cplusplus >= 201402L
-#endif// c++1z or gnu++11
+#endif // __cpp_lib_is_swappable
/// @cond undocumented
@@ -3053,9 +3064,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#pragma GCC diagnostic pop
/// @endcond
-#if __cplusplus >= 201703L
-# define __cpp_lib_is_invocable 201703L
-
+#ifdef __cpp_lib_is_invocable // C++ >= 17
/// std::invoke_result
template<typename _Functor, typename... _ArgTypes>
struct invoke_result
@@ -3134,10 +3143,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static_assert(std::__is_complete_or_unbounded(__type_identity<_Ret>{}),
"_Ret must be a complete class or an unbounded array");
};
-#endif // C++17
+#endif // __cpp_lib_is_invocable
-#if __cplusplus >= 201703L
-# define __cpp_lib_type_trait_variable_templates 201510L
+#if __cpp_lib_type_trait_variable_templates // C++ >= 17
/**
* @defgroup variable_templates Variable templates for type traits
* @ingroup metaprogramming
@@ -3373,9 +3381,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
inline constexpr bool is_nothrow_invocable_r_v
= is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
/// @}
+#endif // __cpp_lib_type_trait_variable_templates
-#ifdef _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP
-# define __cpp_lib_has_unique_object_representations 201606L
+#ifdef __cpp_lib_has_unique_object_representations // C++ >= 17 && HAS_UNIQ_OBJ_REP
/// has_unique_object_representations
/// @since C++17
template<typename _Tp>
@@ -3388,14 +3396,15 @@ template<typename _Ret, typename _Fn, typename... _Args>
"template argument must be a complete class or an unbounded array");
};
+# if __cpp_lib_type_trait_variable_templates // C++ >= 17
/// @ingroup variable_templates
template<typename _Tp>
inline constexpr bool has_unique_object_representations_v
= has_unique_object_representations<_Tp>::value;
+# endif
#endif
-#ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE
-# define __cpp_lib_is_aggregate 201703L
+#ifdef __cpp_lib_is_aggregate // C++ >= 17 && builtin_is_aggregate
/// is_aggregate - true if the type is an aggregate.
/// @since C++17
template<typename _Tp>
@@ -3403,28 +3412,26 @@ template<typename _Ret, typename _Fn, typename... _Args>
: bool_constant<__is_aggregate(remove_cv_t<_Tp>)>
{ };
+# if __cpp_lib_type_trait_variable_templates // C++ >= 17
/** is_aggregate_v - true if the type is an aggregate.
* @ingroup variable_templates
* @since C++17
*/
template<typename _Tp>
inline constexpr bool is_aggregate_v = __is_aggregate(remove_cv_t<_Tp>);
+# endif
#endif
-#endif // C++17
-
-#if __cplusplus >= 202002L
/** * Remove references and cv-qualifiers.
* @since C++20
* @{
*/
-#define __cpp_lib_remove_cvref 201711L
-
-#if __has_builtin(__remove_cvref)
+#ifdef __cpp_lib_remove_cvref // C++ >= 20
+# if __has_builtin(__remove_cvref)
template<typename _Tp>
struct remove_cvref
{ using type = __remove_cvref(_Tp); };
-#else
+# else
template<typename _Tp>
struct remove_cvref
{ using type = typename remove_cv<_Tp>::type; };
@@ -3436,26 +3443,27 @@ template<typename _Ret, typename _Fn, typename... _Args>
template<typename _Tp>
struct remove_cvref<_Tp&&>
{ using type = typename remove_cv<_Tp>::type; };
-#endif
+# endif
template<typename _Tp>
using remove_cvref_t = typename remove_cvref<_Tp>::type;
/// @}
+#endif // __cpp_lib_remove_cvref
+#ifdef __cpp_lib_type_identity // C++ >= 20
/** * Identity metafunction.
* @since C++20
* @{
*/
-#define __cpp_lib_type_identity 201806L
template<typename _Tp>
struct type_identity { using type = _Tp; };
template<typename _Tp>
using type_identity_t = typename type_identity<_Tp>::type;
/// @}
+#endif
-#define __cpp_lib_unwrap_ref 201811L
-
+#ifdef __cpp_lib_unwrap_ref // C++ >= 20
/** Unwrap a reference_wrapper
* @since C++20
* @{
@@ -3480,9 +3488,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
template<typename _Tp>
using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
/// @}
+#endif // __cpp_lib_unwrap_ref
-#define __cpp_lib_bounded_array_traits 201902L
-
+#ifdef __cpp_lib_bounded_array_traits // C++ >= 20
/// True for a type that is an array of known bound.
/// @ingroup variable_templates
/// @since C++20
@@ -3514,8 +3522,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
struct is_unbounded_array
: public bool_constant<is_unbounded_array_v<_Tp>>
{ };
+#endif // __cpp_lib_bounded_array_traits
-#if __has_builtin(__is_layout_compatible)
+#if __has_builtin(__is_layout_compatible) && __cplusplus >= 202002L
/// @since C++20
template<typename _Tp, typename _Up>
@@ -3530,7 +3539,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
= __is_layout_compatible(_Tp, _Up);
#if __has_builtin(__builtin_is_corresponding_member)
-#define __cpp_lib_is_layout_compatible 201907L
+# ifndef __cpp_lib_is_layout_compatible
+# error "libstdc++ bug: is_corresponding_member and is_layout_compatible are provided but their FTM is not set"
+# endif
/// @since C++20
template<typename _S1, typename _S2, typename _M1, typename _M2>
@@ -3540,7 +3551,8 @@ template<typename _Ret, typename _Fn, typename... _Args>
#endif
#endif
-#if __has_builtin(__is_pointer_interconvertible_base_of)
+#if __has_builtin(__is_pointer_interconvertible_base_of) \
+ && __cplusplus >= 202002L
/// True if `_Derived` is standard-layout and has a base class of type `_Base`
/// @since C++20
template<typename _Base, typename _Derived>
@@ -3555,7 +3567,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
= __is_pointer_interconvertible_base_of(_Base, _Derived);
#if __has_builtin(__builtin_is_pointer_interconvertible_with_class)
-#define __cpp_lib_is_pointer_interconvertible 201907L
+# ifndef __cpp_lib_is_pointer_interconvertible
+# error "libstdc++ bug: is_pointer_interconvertible available but FTM is not set"
+# endif
/// True if `__mp` points to the first member of a standard-layout type
/// @returns true if `s.*__mp` is pointer-interconvertible with `s`
@@ -3567,9 +3581,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
#endif
#endif
-#if __cplusplus > 202002L
-#define __cpp_lib_is_scoped_enum 202011L
-
+#ifdef __cpp_lib_is_scoped_enum // C++ >= 23
/// True if the type is a scoped enumeration type.
/// @since C++23
@@ -3589,12 +3601,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
/// @since C++23
template<typename _Tp>
inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
+#endif
-#if __has_builtin(__reference_constructs_from_temporary) \
- && __has_builtin(__reference_converts_from_temporary)
-
-#define __cpp_lib_reference_from_temporary 202202L
-
+#ifdef __cpp_lib_reference_from_temporary // C++ >= 23 && ref_{converts,constructs}_from_temp
/// True if _Tp is a reference type, a _Up value can be bound to _Tp in
/// direct-initialization, and a temporary object would be bound to
/// the reference, false otherwise.
@@ -3632,12 +3641,9 @@ template<typename _Ret, typename _Fn, typename... _Args>
template<typename _Tp, typename _Up>
inline constexpr bool reference_converts_from_temporary_v
= reference_converts_from_temporary<_Tp, _Up>::value;
-#endif // __has_builtin for reference_from_temporary
-#endif // C++23
-
-#if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
-#define __cpp_lib_is_constant_evaluated 201811L
+#endif // __cpp_lib_reference_from_temporary
+#ifdef __cpp_lib_is_constant_evaluated // C++ >= 20 && HAVE_IS_CONST_EVAL
/// Returns true only when called during constant evaluation.
/// @since C++20
constexpr inline bool
@@ -3651,6 +3657,7 @@ template<typename _Ret, typename _Fn, typename... _Args>
}
#endif
+#if __cplusplus >= 202002L
/// @cond undocumented
template<typename _From, typename _To>
using __copy_cv = typename __match_cv_qualifiers<_From, _To>::__type;
diff --git a/libstdc++-v3/include/std/utility b/libstdc++-v3/include/std/utility
index 006b19c..f30e802 100644
--- a/libstdc++-v3/include/std/utility
+++ b/libstdc++-v3/include/std/utility
@@ -68,6 +68,14 @@
#include <bits/stl_relops.h>
#include <bits/stl_pair.h>
+#define __glibcxx_want_exchange_function
+#define __glibcxx_want_constexpr_algorithms
+#define __glibcxx_want_as_const
+#define __glibcxx_want_integer_comparison_functions
+#define __glibcxx_want_to_underlying
+#define __glibcxx_want_unreachable
+#include <bits/version.h>
+
#if __cplusplus >= 201103L
#include <initializer_list>
@@ -83,13 +91,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#if __cplusplus >= 201402L
-#define __cpp_lib_exchange_function 201304L
-
-#if __cplusplus > 201703L
-# define __cpp_lib_constexpr_algorithms 201806L
-#endif
-
+#ifdef __cpp_lib_exchange_function // C++ >= 14
/// Assign @p __new_val to @p __obj and return its previous value.
template <typename _Tp, typename _Up = _Tp>
_GLIBCXX20_CONSTEXPR
@@ -98,10 +100,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
noexcept(__and_<is_nothrow_move_constructible<_Tp>,
is_nothrow_assignable<_Tp&, _Up>>::value)
{ return std::__exchange(__obj, std::forward<_Up>(__new_val)); }
+#endif
-#if __cplusplus >= 201703L
-
-#define __cpp_lib_as_const 201510L
+#ifdef __cpp_lib_as_const // C++ >= 17
template<typename _Tp>
[[nodiscard]]
constexpr add_const_t<_Tp>&
@@ -110,10 +111,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp>
void as_const(const _Tp&&) = delete;
+#endif
-#if __cplusplus > 201703L
-#define __cpp_lib_integer_comparison_functions 202002L
-
+#ifdef __cpp_lib_integer_comparison_functions // C++ >= 20
template<typename _Tp, typename _Up>
constexpr bool
cmp_equal(_Tp __t, _Up __u) noexcept
@@ -181,17 +181,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
else
return __t <= make_unsigned_t<_Up>(__int_traits<_Up>::__max);
}
+#endif // __cpp_lib_integer_comparison_functions
-#if __cplusplus > 202002L
-#define __cpp_lib_to_underlying 202102L
+#ifdef __cpp_lib_to_underlying // C++ >= 23
/// Convert an object of enumeration type to its underlying type.
template<typename _Tp>
[[nodiscard]]
constexpr underlying_type_t<_Tp>
to_underlying(_Tp __value) noexcept
{ return static_cast<underlying_type_t<_Tp>>(__value); }
+#endif
-#define __cpp_lib_unreachable 202202L
+#ifdef __cpp_lib_unreachable // C++ >= 23
/// Informs the compiler that program control flow never reaches this point.
/**
* Evaluating a call to this function results in undefined behaviour.
@@ -216,10 +217,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__builtin_unreachable();
#endif
}
-#endif // C++23
-#endif // C++20
-#endif // C++17
-#endif // C++14
+#endif
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant
index 5155124..7cb7c3b 100644
--- a/libstdc++-v3/include/std/variant
+++ b/libstdc++-v3/include/std/variant
@@ -31,8 +31,10 @@
#pragma GCC system_header
-#if __cplusplus >= 201703L
+#define __glibcxx_want_variant
+#include <bits/version.h>
+#ifdef __cpp_lib_variant // C++ >= 17
#include <initializer_list>
#include <type_traits>
#include <bits/enable_special_members.h>
@@ -47,14 +49,12 @@
# include <compare>
#endif
-#if __cpp_concepts >= 202002L && __cpp_constexpr >= 201811L
-// P2231R1 constexpr needs constexpr unions and constrained destructors.
-# define __cpp_lib_variant 202106L
-#else
+// C++ < 20 || __cpp_concepts < 202002L || __cpp_constexpr < 201811L
+#if __cpp_lib_variant < 202106L
# include <ext/aligned_buffer.h> // Use __aligned_membuf instead of union.
-# define __cpp_lib_variant 202102L
#endif
+
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -1941,6 +1941,5 @@ namespace __variant
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++17
-
+#endif // __cpp_lib_variant
#endif // _GLIBCXX_VARIANT
diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector
index 712087f..ecd9f71 100644
--- a/libstdc++-v3/include/std/vector
+++ b/libstdc++-v3/include/std/vector
@@ -76,6 +76,9 @@
# include <debug/vector>
#endif
+#define __glibcxx_want_erase_if
+#include <bits/version.h>
+
#if __cplusplus >= 201703L
#include <bits/memory_resource.h>
namespace std _GLIBCXX_VISIBILITY(default)
@@ -96,13 +99,11 @@ _GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
#endif // C++17
-#if __cplusplus > 201703L
+#ifdef __cpp_lib_erase_if // C++ >= 20 && HOSTED
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#define __cpp_lib_erase_if 202002L
-
template<typename _Tp, typename _Alloc, typename _Predicate>
_GLIBCXX20_CONSTEXPR
inline typename vector<_Tp, _Alloc>::size_type
@@ -146,6 +147,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif // C++20
+#endif // __cpp_lib_erase_if
#endif /* _GLIBCXX_VECTOR */