https://gcc.gnu.org/g:f9ff3cd95c951e4625f1c0250206322f5f7e3fa3
commit r14-11493-gf9ff3cd95c951e4625f1c0250206322f5f7e3fa3 Author: Jonathan Wakely <jwak...@redhat.com> Date: Fri Nov 1 10:50:02 2024 +0000 libstdc++: Check feature test macro for associative container node extraction Replace some `__cplusplus > 201402L` preprocessor checks with more expressive checks for the appropriate feature test macro. libstdc++-v3/ChangeLog: * include/bits/stl_map.h: Check __glibcxx_node_extract instead of __cplusplus. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_tree.h: Likewise. (cherry picked from commit 408f5b847b5b4e552274dc7b02ccaf106395936d) Diff: --- libstdc++-v3/include/bits/stl_map.h | 4 ++-- libstdc++-v3/include/bits/stl_multimap.h | 4 ++-- libstdc++-v3/include/bits/stl_multiset.h | 4 ++-- libstdc++-v3/include/bits/stl_set.h | 4 ++-- libstdc++-v3/include/bits/stl_tree.h | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index ad58a631af50..1e3bd545f434 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -180,7 +180,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Rep_type::reverse_iterator reverse_iterator; typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 using node_type = typename _Rep_type::node_type; using insert_return_type = typename _Rep_type::insert_return_type; #endif @@ -642,7 +642,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 /// Extract a node. node_type extract(const_iterator __pos) diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index bb8d2acc9aee..4850fa0ea343 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -171,7 +171,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Rep_type::reverse_iterator reverse_iterator; typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 using node_type = typename _Rep_type::node_type; #endif @@ -632,7 +632,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { this->insert(__l.begin(), __l.end()); } #endif -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 /// Extract a node. node_type extract(const_iterator __pos) diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index c532b17edf67..a2695534b686 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -151,7 +151,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Rep_type::size_type size_type; typedef typename _Rep_type::difference_type difference_type; -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 using node_type = typename _Rep_type::node_type; #endif @@ -566,7 +566,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { this->insert(__l.begin(), __l.end()); } #endif -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 /// Extract a node. node_type extract(const_iterator __pos) diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index c0eb4dbf65fb..d1b55a1f2f5c 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -154,7 +154,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Rep_type::difference_type difference_type; ///@} -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 using node_type = typename _Rep_type::node_type; using insert_return_type = typename _Rep_type::insert_return_type; #endif @@ -581,7 +581,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { this->insert(__l.begin(), __l.end()); } #endif -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 /// Extract a node. node_type extract(const_iterator __pos) diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 99575f6fe149..b5a908fdc1f6 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -68,7 +68,7 @@ #if __cplusplus >= 201103L # include <ext/aligned_buffer.h> #endif -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 # include <bits/node_handle.h> #endif @@ -413,7 +413,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z, _Rb_tree_node_base& __header) throw (); -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 template<typename _Tree1, typename _Cmp2> struct _Rb_tree_merge_helper { }; #endif @@ -816,7 +816,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 using node_type = _Node_handle<_Key, _Val, _Node_allocator>; using insert_return_type = _Node_insert_return< __conditional_t<is_same_v<_Key, _Val>, const_iterator, iterator>, @@ -2599,7 +2599,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return true; } -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 // Allow access to internals of compatible _Rb_tree specializations. template<typename _Key, typename _Val, typename _Sel, typename _Cmp1, typename _Alloc, typename _Cmp2>