[gcc r15-6950] libstdc++: Check feature test macro for associative container node extraction
Jonathan Wakely
redi@gcc.gnu.org
Thu Jan 16 09:43:45 GMT 2025
https://gcc.gnu.org/g:408f5b847b5b4e552274dc7b02ccaf106395936d
commit r15-6950-g408f5b847b5b4e552274dc7b02ccaf106395936d
Author: Jonathan Wakely <jwakely@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.
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 c1c0f7577bbd..d2d0b524cceb 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 426db214c045..661d870fd01f 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 6c70e12884a8..57caf6e8cc41 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 975ac521d9a1..f32323db3687 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 ae9b4469d88c..7285676f427f 100644
--- a/libstdc++-v3/include/bits/stl_tree.h
+++ b/libstdc++-v3/include/bits/stl_tree.h
@@ -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>
More information about the Libstdc++-cvs
mailing list