diff options
author | Hans Wennborg <hans@hanshq.net> | 2018-08-14 09:13:39 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2018-08-14 09:13:39 +0000 |
commit | 7b0c6a2c028e33ee0629dff5f27358949e53eb53 (patch) | |
tree | 8aa247228f70fe7156f29a2a8ff04bc901906259 /libcxx/test | |
parent | 8a6427840e5e0d07517069e87aee853f5bc8f51a (diff) | |
download | bcm5719-llvm-7b0c6a2c028e33ee0629dff5f27358949e53eb53.tar.gz bcm5719-llvm-7b0c6a2c028e33ee0629dff5f27358949e53eb53.zip |
Merging r339431:
------------------------------------------------------------------------
r339431 | ldionne | 2018-08-10 15:24:56 +0200 (Fri, 10 Aug 2018) | 16 lines
[libc++] Enable aligned allocation based on feature test macro, irrespective of standard
Summary:
The current code enables aligned allocation functions when compiling in C++17
and later. This is a problem because aligned allocation functions might not
be supported on the target platform, which leads to an error at link time.
Since r338934, Clang knows not to define __cpp_aligned_new when it's not
available on the target platform -- this commit takes advantage of that to
only use aligned allocation functions when they are available.
Reviewers: vsapsai, EricWF
Subscribers: christof, dexonsmith, cfe-commits, EricWF, mclow.lists
Differential Revision: https://reviews.llvm.org/D50344
------------------------------------------------------------------------
llvm-svn: 339661
Diffstat (limited to 'libcxx/test')
-rw-r--r-- | libcxx/test/libcxx/memory/aligned_allocation_macro.pass.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libcxx/test/libcxx/memory/aligned_allocation_macro.pass.cpp b/libcxx/test/libcxx/memory/aligned_allocation_macro.pass.cpp new file mode 100644 index 00000000000..3d701b9385e --- /dev/null +++ b/libcxx/test/libcxx/memory/aligned_allocation_macro.pass.cpp @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: with_system_cxx_lib=macosx10.12 +// XFAIL: with_system_cxx_lib=macosx10.11 +// XFAIL: with_system_cxx_lib=macosx10.10 +// XFAIL: with_system_cxx_lib=macosx10.9 +// XFAIL: with_system_cxx_lib=macosx10.8 +// XFAIL: with_system_cxx_lib=macosx10.7 + +#include <new> + + +#ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# error "libc++ should have aligned allocation in C++17 and up when targeting a platform that supports it" +#endif + +int main() { } |