summaryrefslogtreecommitdiffstats
path: root/lib/libcxx/src/experimental/memory_resource.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-02-04 16:55:44 +0000
committerpatrick <patrick@openbsd.org>2019-02-04 16:55:44 +0000
commit76c648e7a477ffb2a882ad5ffe523269bd9a3f6a (patch)
tree29d319d598650bab04e4f58e5e8769567e33091e /lib/libcxx/src/experimental/memory_resource.cpp
parentImport libc++abi 7.0.1. (diff)
downloadwireguard-openbsd-76c648e7a477ffb2a882ad5ffe523269bd9a3f6a.tar.xz
wireguard-openbsd-76c648e7a477ffb2a882ad5ffe523269bd9a3f6a.zip
Import libc++ 7.0.1.
Diffstat (limited to 'lib/libcxx/src/experimental/memory_resource.cpp')
-rw-r--r--lib/libcxx/src/experimental/memory_resource.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/libcxx/src/experimental/memory_resource.cpp b/lib/libcxx/src/experimental/memory_resource.cpp
index c4dc1ca894a..a3b64cc8b49 100644
--- a/lib/libcxx/src/experimental/memory_resource.cpp
+++ b/lib/libcxx/src/experimental/memory_resource.cpp
@@ -31,10 +31,10 @@ public:
protected:
virtual void* do_allocate(size_t __size, size_t __align)
- { return __allocate(__size); }
+ { return _VSTD::__libcpp_allocate(__size, __align); /* FIXME */}
- virtual void do_deallocate(void * __p, size_t, size_t)
- { _VSTD::__libcpp_deallocate(__p); }
+ virtual void do_deallocate(void * __p, size_t, size_t __align)
+ { _VSTD::__libcpp_deallocate(__p, __align); /* FIXME */ }
virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT
{ return &__other == this; }
@@ -68,12 +68,23 @@ union ResourceInitHelper {
_LIBCPP_CONSTEXPR_AFTER_CXX11 ResourceInitHelper() : resources() {}
~ResourceInitHelper() {}
};
+
+// Detect if the init_priority attribute is supported.
+#if (defined(_LIBCPP_COMPILER_GCC) && defined(__APPLE__)) \
+ || defined(_LIBCPP_COMPILER_MSVC)
+// GCC on Apple doesn't support the init priority attribute,
+// and MSVC doesn't support any GCC attributes.
+# define _LIBCPP_INIT_PRIORITY_MAX
+#else
+# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101)))
+#endif
+
// When compiled in C++14 this initialization should be a constant expression.
// Only in C++11 is "init_priority" needed to ensure initialization order.
#if _LIBCPP_STD_VER > 11
_LIBCPP_SAFE_STATIC
#endif
-ResourceInitHelper res_init __attribute__((init_priority (101)));
+ResourceInitHelper res_init _LIBCPP_INIT_PRIORITY_MAX;
} // end namespace