]> 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>
Thu, 16 Jan 2025 09:41:00 +0000 (09:41 +0000)
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.

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 c1c0f7577bbd04e66a580ad3e0b783199ef898cb..d2d0b524cceb4320a27d75978e3eb7a8c0201bf7 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 426db214c045746f44616340abdc519226528a27..661d870fd01f90495401863646c5b835aab641d2 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 6c70e12884a83b5e99eb62db83e8dbeac028f19f..57caf6e8cc41d9e9133f7009a0285c3a045cf4b3 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 975ac521d9a14c5a2ca2af3f8710339250debac1..f32323db36876ea5e5d6bae6d2811e8805968797 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 ae9b4469d88c6063a9b28fc57ed1cac97c1c389a..7285676f427f9742fe11d454b5d404a40a0d2766 100644 (file)
@@ -71,7 +71,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
 
@@ -1010,7 +1010,7 @@ namespace __rb_tree
 #endif
 } // namespace __rb_tree
 
-#if __cplusplus > 201402L
+#ifdef __glibcxx_node_extract // >= C++17
   template<typename _Tree1, typename _Cmp2>
     struct _Rb_tree_merge_helper { };
 #endif
@@ -1451,7 +1451,7 @@ namespace __rb_tree
       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>,
@@ -3219,7 +3219,7 @@ namespace __rb_tree
       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>