diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-12-23 20:17:23 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-12-23 20:17:23 +0000 |
commit | 3e8353724b8ef7e04c1ff1e0bad40a9d4233865b (patch) | |
tree | fbc5a992e04988c45d4a6576feefcf47f1d27caf | |
parent | 3f9b557ddd5332fd6405edb3ee5a3fff0a1f47b3 (diff) | |
download | bcm5719-llvm-3e8353724b8ef7e04c1ff1e0bad40a9d4233865b.tar.gz bcm5719-llvm-3e8353724b8ef7e04c1ff1e0bad40a9d4233865b.zip |
Don't use posix_memalign on Windows platforms
llvm-svn: 290448
-rw-r--r-- | libcxx/src/new.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libcxx/src/new.cpp b/libcxx/src/new.cpp index 1465bcd5f91..3d8b2a9d8a6 100644 --- a/libcxx/src/new.cpp +++ b/libcxx/src/new.cpp @@ -70,7 +70,11 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC if (static_cast<size_t>(alignment) < sizeof(void*)) alignment = std::align_val_t(sizeof(void*)); void* p; +#if defined(_WIN32) + while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr) +#else while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0) +#endif { // If posix_memalign fails and there is a new_handler, // call it to try free up memory. |