[libcxx-commits] [libcxx] 982287a - [libc++][experimental] Disables PMR in C++03.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 31 10:16:10 PDT 2022


Author: Mark de Wever
Date: 2022-08-31T19:15:36+02:00
New Revision: 982287a29b8539bc0351bfb9ca82c9239d20e3a6

URL: https://github.com/llvm/llvm-project/commit/982287a29b8539bc0351bfb9ca82c9239d20e3a6
DIFF: https://github.com/llvm/llvm-project/commit/982287a29b8539bc0351bfb9ca82c9239d20e3a6.diff

LOG: [libc++][experimental] Disables PMR in C++03.

While working on D132534 it appeared the experimental PMR code doesn't
have version guards and fails to compile on C++03. This adds the guards
for that version. It seems the tests already were only disabled for
C++03.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D132582

Added: 
    

Modified: 
    libcxx/include/experimental/deque
    libcxx/include/experimental/forward_list
    libcxx/include/experimental/list
    libcxx/include/experimental/map
    libcxx/include/experimental/memory_resource
    libcxx/include/experimental/regex
    libcxx/include/experimental/set
    libcxx/include/experimental/string
    libcxx/include/experimental/unordered_map
    libcxx/include/experimental/unordered_set
    libcxx/include/experimental/vector

Removed: 
    


################################################################################
diff  --git a/libcxx/include/experimental/deque b/libcxx/include/experimental/deque
index 3e3f9098a8fdf..46962afbb795e 100644
--- a/libcxx/include/experimental/deque
+++ b/libcxx/include/experimental/deque
@@ -40,9 +40,13 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _ValueT>
 using deque = _VSTD::deque<_ValueT, polymorphic_allocator<_ValueT>>;
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_DEQUE */

diff  --git a/libcxx/include/experimental/forward_list b/libcxx/include/experimental/forward_list
index 4b102c5547042..5d2686deb2768 100644
--- a/libcxx/include/experimental/forward_list
+++ b/libcxx/include/experimental/forward_list
@@ -40,9 +40,13 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _ValueT>
 using forward_list = _VSTD::forward_list<_ValueT, polymorphic_allocator<_ValueT>>;
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_FORWARD_LIST */

diff  --git a/libcxx/include/experimental/list b/libcxx/include/experimental/list
index c8480575977ec..06abe8702241e 100644
--- a/libcxx/include/experimental/list
+++ b/libcxx/include/experimental/list
@@ -40,9 +40,13 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _ValueT>
 using list = _VSTD::list<_ValueT, polymorphic_allocator<_ValueT>>;
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_LIST */

diff  --git a/libcxx/include/experimental/map b/libcxx/include/experimental/map
index 3dee7f703aeb5..8ec94e4a5bc86 100644
--- a/libcxx/include/experimental/map
+++ b/libcxx/include/experimental/map
@@ -45,6 +45,8 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _Key, class _Value, class  _Compare = less<_Key>>
 using map = _VSTD::map<_Key, _Value, _Compare,
                         polymorphic_allocator<pair<const _Key, _Value>>>;
@@ -53,6 +55,8 @@ template <class _Key, class _Value, class  _Compare = less<_Key>>
 using multimap = _VSTD::multimap<_Key, _Value, _Compare,
                         polymorphic_allocator<pair<const _Key, _Value>>>;
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_MAP */

diff  --git a/libcxx/include/experimental/memory_resource b/libcxx/include/experimental/memory_resource
index 42ed63501d9db..510e282f1f236 100644
--- a/libcxx/include/experimental/memory_resource
+++ b/libcxx/include/experimental/memory_resource
@@ -86,6 +86,8 @@ _LIBCPP_PUSH_MACROS
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 // Round __s up to next multiple of __a.
 inline _LIBCPP_INLINE_VISIBILITY
 size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT
@@ -412,6 +414,8 @@ using resource_adaptor = __resource_adaptor_imp<
     typename allocator_traits<_Alloc>::template rebind_alloc<char>
   >;
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 _LIBCPP_POP_MACROS

diff  --git a/libcxx/include/experimental/regex b/libcxx/include/experimental/regex
index 4dc2bbae45103..8aa880cd80b0c 100644
--- a/libcxx/include/experimental/regex
+++ b/libcxx/include/experimental/regex
@@ -48,6 +48,8 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _BiDirIter>
 using match_results =
     _VSTD::match_results<_BiDirIter,
@@ -60,6 +62,8 @@ typedef match_results<const wchar_t*> wcmatch;
 typedef match_results<_VSTD_LFTS_PMR::wstring::const_iterator> wsmatch;
 #endif
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_REGEX */

diff  --git a/libcxx/include/experimental/set b/libcxx/include/experimental/set
index e2e75e35448ba..cd61e6449597b 100644
--- a/libcxx/include/experimental/set
+++ b/libcxx/include/experimental/set
@@ -45,6 +45,8 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _Value, class  _Compare = less<_Value>>
 using set = _VSTD::set<_Value, _Compare,
                         polymorphic_allocator<_Value>>;
@@ -53,6 +55,8 @@ template <class _Value, class  _Compare = less<_Value>>
 using multiset = _VSTD::multiset<_Value, _Compare,
                         polymorphic_allocator<_Value>>;
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_SET */

diff  --git a/libcxx/include/experimental/string b/libcxx/include/experimental/string
index c795d685d7351..c6a3e98d135d2 100644
--- a/libcxx/include/experimental/string
+++ b/libcxx/include/experimental/string
@@ -49,6 +49,8 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _CharT, class _Traits = char_traits<_CharT>>
 using basic_string =
     _VSTD::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>;
@@ -60,6 +62,8 @@ typedef basic_string<char32_t> u32string;
 typedef basic_string<wchar_t> wstring;
 #endif
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_STRING */

diff  --git a/libcxx/include/experimental/unordered_map b/libcxx/include/experimental/unordered_map
index 636d31bdc5570..a5627e76b2e11 100644
--- a/libcxx/include/experimental/unordered_map
+++ b/libcxx/include/experimental/unordered_map
@@ -59,6 +59,8 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _Key, class _Value,
           class _Hash = hash<_Key>, class _Pred = equal_to<_Key>>
 using unordered_map = _VSTD::unordered_map<_Key, _Value, _Hash, _Pred,
@@ -69,6 +71,8 @@ template <class _Key, class _Value,
 using unordered_multimap = _VSTD::unordered_multimap<_Key, _Value, _Hash, _Pred,
                         polymorphic_allocator<pair<const _Key, _Value>>>;
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_MAP */

diff  --git a/libcxx/include/experimental/unordered_set b/libcxx/include/experimental/unordered_set
index 509f3ec1044ea..493e3a09ed109 100644
--- a/libcxx/include/experimental/unordered_set
+++ b/libcxx/include/experimental/unordered_set
@@ -45,6 +45,8 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _Value,
           class _Hash = hash<_Value>, class _Pred = equal_to<_Value>>
 using unordered_set = _VSTD::unordered_set<_Value, _Hash, _Pred,
@@ -55,6 +57,8 @@ template <class _Value,
 using unordered_multiset = _VSTD::unordered_multiset<_Value, _Hash, _Pred,
                         polymorphic_allocator<_Value>>;
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_SET */

diff  --git a/libcxx/include/experimental/vector b/libcxx/include/experimental/vector
index 97c51c830c4a2..2e9d77e41af28 100644
--- a/libcxx/include/experimental/vector
+++ b/libcxx/include/experimental/vector
@@ -40,9 +40,13 @@ namespace pmr {
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
 
+#ifndef _LIBCPP_CXX03_LANG
+
 template <class _ValueT>
 using vector = _VSTD::vector<_ValueT, polymorphic_allocator<_ValueT>>;
 
+#endif // _LIBCPP_CXX03_LANG
+
 _LIBCPP_END_NAMESPACE_LFTS_PMR
 
 #endif /* _LIBCPP_EXPERIMENTAL_VECTOR */


        


More information about the libcxx-commits mailing list