]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Check feature test macro for associative container node extraction
authorJonathan Wakely <jwakely@redhat.com>
Fri, 1 Nov 2024 10:50:02 +0000 (10:50 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 1 Apr 2025 08:58:23 +0000 (09:58 +0100)
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)

libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_multimap.h
libstdc++-v3/include/bits/stl_multiset.h
libstdc++-v3/include/bits/stl_set.h
libstdc++-v3/include/bits/stl_tree.h

index ad58a631af505622acea663b103c2148d7e7dd37..1e3bd545f4349af2c772a2a6281ce296578f41e3 100644 (file)
@@ -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)
index bb8d2acc9aee7cede331cbff648e840df96dc915..4850fa0ea343f8c83d85328bc08c334810ffb7c1 100644 (file)
@@ -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)
index c532b17edf672234e39f8de1fc0d3010c6d32e7b..a2695534b686b66f3b94e4887359cad888d1a213 100644 (file)
@@ -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)
index c0eb4dbf65fb46f8b89afe1900b37597428d7df5..d1b55a1f2f5c393b6dab2d54bb1d5230a39a48bc 100644 (file)
@@ -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)
index 99575f6fe149208c6c769003a66a3232f326d2ce..b5a908fdc1f69c023454fd13c38f181ae91e59b4 100644 (file)
@@ -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>