Skip to content

Make memory_resource implementation binary compatible with libstdc++ and Microsoft STL #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8270bff
Remove version namespace for memory_resource
kboyarinov Dec 8, 2022
ffe5805
Add Microsoft STL compat layer
tbbdev Dec 18, 2022
a1f1393
Remove unnecessary things
tbbdev Dec 18, 2022
8a76ddf
+newline
tbbdev Dec 18, 2022
bf5b962
Whitespace fix
tbbdev Dec 18, 2022
1f44aad
Rename compat layer files
tbbdev Dec 18, 2022
8bb59cf
Broken: remove unnecessary macros from config
kboyarinov Dec 22, 2022
378272c
Broken: minor fixes in __fwd
kboyarinov Dec 22, 2022
8363318
Merge remote-tracking branch 'origin/main' into version_namespace_pmr
kboyarinov Dec 22, 2022
4ddf19c
Working: minor cosmetic changes
kboyarinov Dec 22, 2022
031c39d
More cosmetic changes
kboyarinov Dec 22, 2022
fe69e96
Fix string and fallback compilation
kboyarinov Dec 26, 2022
5a4b192
Remove unnecessary whitespace changes in vector
kboyarinov Jan 9, 2023
39f5c05
Add newline for vector
kboyarinov Jan 9, 2023
0260313
Remove version namespace for memory_resource
kboyarinov Dec 8, 2022
454f1a1
Add Microsoft STL compat layer
tbbdev Dec 18, 2022
8bea4fc
Remove unnecessary things
tbbdev Dec 18, 2022
4b3bfbb
+newline
tbbdev Dec 18, 2022
b6578dd
Whitespace fix
tbbdev Dec 18, 2022
f921db1
Rename compat layer files
tbbdev Dec 18, 2022
93196d7
Broken: remove unnecessary macros from config
kboyarinov Dec 22, 2022
8be4659
Broken: minor fixes in __fwd
kboyarinov Dec 22, 2022
85b3f5a
Working: minor cosmetic changes
kboyarinov Dec 22, 2022
f5cbd1e
More cosmetic changes
kboyarinov Dec 22, 2022
8a9e082
Fix string and fallback compilation
kboyarinov Dec 26, 2022
5064635
Remove unnecessary whitespace changes in vector
kboyarinov Jan 9, 2023
3208eb7
Add newline for vector
kboyarinov Jan 9, 2023
5003d11
Merge branch 'version_namespace_pmr' of https://github.com/kboyarinov…
kboyarinov Jan 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libcxx/include/__fwd/memory_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
# pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD
namespace std { // purposefully not using versioning namespace

namespace pmr {
template <class _ValueType>
class _LIBCPP_TEMPLATE_VIS polymorphic_allocator;
} // namespace pmr

_LIBCPP_END_NAMESPACE_STD
} // namespace std

#endif // _LIBCPP___FWD_MEMORY_RESOURCE_H
7 changes: 7 additions & 0 deletions libcxx/include/__fwd/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ using u32string = basic_string<char32_t>;

#if _LIBCPP_STD_VER >= 17

_LIBCPP_END_NAMESPACE_STD

namespace std {
namespace pmr {

template <class _CharT, class _Traits = char_traits<_CharT>>
using basic_string = std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>;

Expand All @@ -77,6 +81,9 @@ using u16string = basic_string<char16_t>;
using u32string = basic_string<char32_t>;

} // namespace pmr
} // namespace std

_LIBCPP_BEGIN_NAMESPACE_STD

#endif // _LIBCPP_STD_VER >= 17

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__memory_resource/memory_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#if _LIBCPP_STD_VER > 14

_LIBCPP_BEGIN_NAMESPACE_STD
namespace std { // purposefully not using versioning namespace

namespace pmr {

Expand Down Expand Up @@ -68,7 +68,7 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const memory_resource& __lhs, const

} // namespace pmr

_LIBCPP_END_NAMESPACE_STD
} // namespace std

#endif // _LIBCPP_STD_VER > 14

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__memory_resource/monotonic_buffer_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#if _LIBCPP_STD_VER > 14

_LIBCPP_BEGIN_NAMESPACE_STD
namespace std { // purposefully not using versioning namespace

namespace pmr {

Expand Down Expand Up @@ -112,7 +112,7 @@ class _LIBCPP_TYPE_VIS monotonic_buffer_resource : public memory_resource {

} // namespace pmr

_LIBCPP_END_NAMESPACE_STD
} // namespace std

#endif // _LIBCPP_STD_VER > 14

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__memory_resource/polymorphic_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ _LIBCPP_PUSH_MACROS

#if _LIBCPP_STD_VER > 14

_LIBCPP_BEGIN_NAMESPACE_STD
namespace std { // purposefully not using versioning namespace

namespace pmr {

Expand Down Expand Up @@ -215,7 +215,7 @@ operator!=(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<

} // namespace pmr

_LIBCPP_END_NAMESPACE_STD
} // namespace std

#endif // _LIBCPP_STD_VER > 14

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__memory_resource/pool_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#if _LIBCPP_STD_VER > 14

_LIBCPP_BEGIN_NAMESPACE_STD
namespace std { // purposefully not using versioning namespace

namespace pmr {

Expand All @@ -31,7 +31,7 @@ struct _LIBCPP_TYPE_VIS pool_options {

} // namespace pmr

_LIBCPP_END_NAMESPACE_STD
} // namespace std

#endif // _LIBCPP_STD_VER > 14

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__memory_resource/synchronized_pool_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#if _LIBCPP_STD_VER > 14

_LIBCPP_BEGIN_NAMESPACE_STD
namespace std { // purposefully not using versioning namespace

namespace pmr {

Expand Down Expand Up @@ -87,7 +87,7 @@ class _LIBCPP_TYPE_VIS synchronized_pool_resource : public memory_resource {

} // namespace pmr

_LIBCPP_END_NAMESPACE_STD
} // namespace std

#endif // _LIBCPP_STD_VER > 14

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#if _LIBCPP_STD_VER > 14

_LIBCPP_BEGIN_NAMESPACE_STD
namespace std { // purposefully not using versioning namespace

namespace pmr {

Expand Down Expand Up @@ -99,7 +99,7 @@ class _LIBCPP_TYPE_VIS unsynchronized_pool_resource : public memory_resource {

} // namespace pmr

_LIBCPP_END_NAMESPACE_STD
} // namespace std

#endif // _LIBCPP_STD_VER > 14

Expand Down
7 changes: 5 additions & 2 deletions libcxx/include/deque
Original file line number Diff line number Diff line change
Expand Up @@ -2932,12 +2932,15 @@ inline constexpr bool __format::__enable_insertable<std::deque<wchar_t>> = true;
_LIBCPP_END_NAMESPACE_STD

#if _LIBCPP_STD_VER > 14
_LIBCPP_BEGIN_NAMESPACE_STD
namespace std {

namespace pmr {
template <class _ValueT>
using deque = std::deque<_ValueT, polymorphic_allocator<_ValueT>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD

} // namespace std

#endif

_LIBCPP_POP_MACROS
Expand Down
8 changes: 6 additions & 2 deletions libcxx/include/forward_list
Original file line number Diff line number Diff line change
Expand Up @@ -1780,12 +1780,16 @@ inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_END_NAMESPACE_STD

#if _LIBCPP_STD_VER > 14
_LIBCPP_BEGIN_NAMESPACE_STD

namespace std {

namespace pmr {
template <class _ValueT>
using forward_list = std::forward_list<_ValueT, polymorphic_allocator<_ValueT>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD

} // namespace std

#endif

_LIBCPP_POP_MACROS
Expand Down
8 changes: 6 additions & 2 deletions libcxx/include/list
Original file line number Diff line number Diff line change
Expand Up @@ -2363,12 +2363,16 @@ inline constexpr bool __format::__enable_insertable<std::list<wchar_t>> = true;
_LIBCPP_END_NAMESPACE_STD

#if _LIBCPP_STD_VER > 14
_LIBCPP_BEGIN_NAMESPACE_STD

namespace std {

namespace pmr {
template <class _ValueT>
using list = std::list<_ValueT, polymorphic_allocator<_ValueT>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD

} // namespace std

#endif

_LIBCPP_POP_MACROS
Expand Down
8 changes: 6 additions & 2 deletions libcxx/include/map
Original file line number Diff line number Diff line change
Expand Up @@ -2340,15 +2340,19 @@ inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_END_NAMESPACE_STD

#if _LIBCPP_STD_VER > 14
_LIBCPP_BEGIN_NAMESPACE_STD

namespace std {

namespace pmr {
template <class _KeyT, class _ValueT, class _CompareT = std::less<_KeyT>>
using map = std::map<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;

template <class _KeyT, class _ValueT, class _CompareT = std::less<_KeyT>>
using multimap = std::multimap<_KeyT, _ValueT, _CompareT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD

} // namespace std

#endif

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Expand Down
8 changes: 6 additions & 2 deletions libcxx/include/regex
Original file line number Diff line number Diff line change
Expand Up @@ -6845,7 +6845,9 @@ regex_replace(const _CharT* __s,
_LIBCPP_END_NAMESPACE_STD

#if _LIBCPP_STD_VER > 14
_LIBCPP_BEGIN_NAMESPACE_STD

namespace std {

namespace pmr {
template <class _BidirT>
using match_results = std::match_results<_BidirT, polymorphic_allocator<std::sub_match<_BidirT>>>;
Expand All @@ -6858,7 +6860,9 @@ using wcmatch = match_results<const wchar_t*>;
using wsmatch = match_results<std::pmr::wstring::const_iterator>;
#endif
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD

} // namespace std

#endif

_LIBCPP_POP_MACROS
Expand Down
8 changes: 6 additions & 2 deletions libcxx/include/set
Original file line number Diff line number Diff line change
Expand Up @@ -1585,15 +1585,19 @@ inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_END_NAMESPACE_STD

#if _LIBCPP_STD_VER > 14
_LIBCPP_BEGIN_NAMESPACE_STD

namespace std {

namespace pmr {
template <class _KeyT, class _CompareT = std::less<_KeyT>>
using set = std::set<_KeyT, _CompareT, polymorphic_allocator<_KeyT>>;

template <class _KeyT, class _CompareT = std::less<_KeyT>>
using multiset = std::multiset<_KeyT, _CompareT, polymorphic_allocator<_KeyT>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD

} // namespace std

#endif

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Expand Down
8 changes: 6 additions & 2 deletions libcxx/include/unordered_map
Original file line number Diff line number Diff line change
Expand Up @@ -2630,7 +2630,9 @@ operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
_LIBCPP_END_NAMESPACE_STD

#if _LIBCPP_STD_VER > 14
_LIBCPP_BEGIN_NAMESPACE_STD

namespace std {

namespace pmr {
template <class _KeyT, class _ValueT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>>
using unordered_map =
Expand All @@ -2640,7 +2642,9 @@ template <class _KeyT, class _ValueT, class _HashT = std::hash<_KeyT>, class _Pr
using unordered_multimap =
std::unordered_multimap<_KeyT, _ValueT, _HashT, _PredT, polymorphic_allocator<std::pair<const _KeyT, _ValueT>>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD

} // namespace std

#endif

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Expand Down
8 changes: 6 additions & 2 deletions libcxx/include/unordered_set
Original file line number Diff line number Diff line change
Expand Up @@ -1804,15 +1804,19 @@ operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
_LIBCPP_END_NAMESPACE_STD

#if _LIBCPP_STD_VER > 14
_LIBCPP_BEGIN_NAMESPACE_STD

namespace std {

namespace pmr {
template <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>>
using unordered_set = std::unordered_set<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>;

template <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>>
using unordered_multiset = std::unordered_multiset<_KeyT, _HashT, _PredT, polymorphic_allocator<_KeyT>>;
} // namespace pmr
_LIBCPP_END_NAMESPACE_STD

} // namespace std

#endif

#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
Expand Down
6 changes: 5 additions & 1 deletion libcxx/include/vector
Original file line number Diff line number Diff line change
Expand Up @@ -3315,11 +3315,15 @@ inline constexpr bool __format::__enable_insertable<std::vector<wchar_t>> = true
_LIBCPP_END_NAMESPACE_STD

#if _LIBCPP_STD_VER > 14
_LIBCPP_BEGIN_NAMESPACE_STD
namespace std {

namespace pmr {
template <class _ValueT>
using vector = std::vector<_ValueT, polymorphic_allocator<_ValueT>>;
} // namespace pmr

} // namespace std

_LIBCPP_END_NAMESPACE_STD
#endif

Expand Down
Loading