From: Jonathan Wakely Date: Fri, 1 Nov 2024 10:50:02 +0000 (+0000) Subject: libstdc++: Check feature test macro for associative container node extraction X-Git-Tag: releases/gcc-14.3.0~306 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9ff3cd95c951e4625f1c0250206322f5f7e3fa3;p=thirdparty%2Fgcc.git 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 --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index ad58a631af5..1e3bd545f43 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 bb8d2acc9ae..4850fa0ea34 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 c532b17edf6..a2695534b68 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 c0eb4dbf65f..d1b55a1f2f5 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 99575f6fe14..b5a908fdc1f 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 #endif -#if __cplusplus > 201402L +#ifdef __glibcxx_node_extract // >= C++17 # include #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 struct _Rb_tree_merge_helper { }; #endif @@ -816,7 +816,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef std::reverse_iterator reverse_iterator; typedef std::reverse_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, 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