summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/utilities/memory
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-06-14 21:31:42 +0000
committerEric Fiselier <eric@efcs.ca>2016-06-14 21:31:42 +0000
commitf2f2a6395fad5bd49a573fdf2b20072735d496f7 (patch)
tree9e17e483fe805be6d7940b2b653063df88815347 /libcxx/test/std/utilities/memory
parent23b6d6adc9dd38fe6c2cb433e163dc74b2cdc8e6 (diff)
downloadbcm5719-llvm-f2f2a6395fad5bd49a573fdf2b20072735d496f7.tar.gz
bcm5719-llvm-f2f2a6395fad5bd49a573fdf2b20072735d496f7.zip
Replace __cplusplus comparisons and dialect __has_feature checks with TEST_STD_VER.
This is a huge cleanup that helps make the libc++ test suite more portable. Patch from STL@microsoft.com. Thanks STL! llvm-svn: 272716
Diffstat (limited to 'libcxx/test/std/utilities/memory')
-rw-r--r--libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp2
-rw-r--r--libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp6
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp2
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp2
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp4
-rw-r--r--libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_cxx03.pass.cpp2
19 files changed, 61 insertions, 29 deletions
diff --git a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
index 352c7c8d0ca..bbc6b470174 100644
--- a/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
+++ b/libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/max_size.pass.cpp
@@ -21,6 +21,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
template <class T>
struct A
{
@@ -61,7 +63,7 @@ int main()
const B<int> b = {};
assert(std::allocator_traits<B<int> >::max_size(b) == 100);
}
-#if __cplusplus >= 201103
+#if TEST_STD_VER >= 11
{
std::allocator<int> a;
static_assert(noexcept(std::allocator_traits<std::allocator<int>>::max_size(a)) == true, "");
diff --git a/libcxx/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp b/libcxx/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
index c1207b204aa..e1612ae0542 100644
--- a/libcxx/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
+++ b/libcxx/test/std/utilities/memory/default.allocator/allocator_pointers.pass.cpp
@@ -10,7 +10,9 @@
#include <memory>
#include <cassert>
-#if __cplusplus >= 201103L
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 11
// #include <memory>
//
// template <class Alloc>
diff --git a/libcxx/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp b/libcxx/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
index afa9f7f06dd..48399d5355d 100644
--- a/libcxx/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
+++ b/libcxx/test/std/utilities/memory/pointer.traits/pointer.traits.types/element_type.pass.cpp
@@ -19,6 +19,8 @@
#include <memory>
#include <type_traits>
+#include "test_macros.h"
+
struct A
{
typedef char element_type;
diff --git a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
index 27b620569b8..62a3be80d8b 100644
--- a/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
+++ b/libcxx/test/std/utilities/memory/storage.iterator/raw_storage_iterator.base.pass.cpp
@@ -13,6 +13,8 @@
#include <type_traits>
#include <cassert>
+#include "test_macros.h"
+
int A_constructed = 0;
struct A
@@ -29,7 +31,7 @@ public:
int main()
{
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
typedef std::aligned_storage<3*sizeof(A), std::alignment_of<A>::value>::type
Storage;
Storage buffer;
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
index 2d586e9c7fd..3bad537e343 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong.pass.cpp
@@ -23,12 +23,15 @@
// atomic_compare_exchange_strong(shared_ptr<T>* p, shared_ptr<T>* v,
// shared_ptr<T> w);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> v(new int(3));
@@ -49,5 +52,4 @@ int main()
assert(*v == 4);
assert(*w == 2);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
index 34da04cc181..5cc1234ad34 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_strong_explicit.pass.cpp
@@ -24,12 +24,15 @@
// shared_ptr<T> w, memory_order success,
// memory_order failure);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> v(new int(3));
@@ -54,5 +57,4 @@ int main()
assert(*v == 4);
assert(*w == 2);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
index 50b96e551fd..a89c0dbd220 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak.pass.cpp
@@ -23,12 +23,15 @@
// atomic_compare_exchange_weak(shared_ptr<T>* p, shared_ptr<T>* v,
// shared_ptr<T> w);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> v(new int(3));
@@ -49,5 +52,4 @@ int main()
assert(*v == 4);
assert(*w == 2);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
index d304319d251..821cea6868e 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_compare_exchange_weak_explicit.pass.cpp
@@ -24,12 +24,15 @@
// shared_ptr<T> w, memory_order success,
// memory_order failure);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> v(new int(3));
@@ -54,5 +57,4 @@ int main()
assert(*v == 4);
assert(*w == 2);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
index 3b44c8ba9b3..66be756d54f 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange.pass.cpp
@@ -22,12 +22,15 @@
// shared_ptr<T>
// atomic_exchange(shared_ptr<T>* p, shared_ptr<T> r)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> r(new int(3));
@@ -35,5 +38,4 @@ int main()
assert(*p == 3);
assert(*r == 4);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
index 598a1b8da17..493ba7fcc94 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_exchange_explicit.pass.cpp
@@ -22,12 +22,15 @@
// shared_ptr<T>
// atomic_exchange_explicit(shared_ptr<T>* p, shared_ptr<T> r)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(4));
std::shared_ptr<int> r(new int(3));
@@ -35,5 +38,4 @@ int main()
assert(*p == 3);
assert(*r == 4);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
index e3ac84a4fa5..f72a0bb2428 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_is_lock_free.pass.cpp
@@ -17,15 +17,17 @@
// bool
// atomic_is_lock_free(const shared_ptr<T>* p);
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
const std::shared_ptr<int> p(new int(3));
assert(std::atomic_is_lock_free(&p) == false);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
index d4a39c878ac..4820d05420a 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load.pass.cpp
@@ -22,16 +22,18 @@
// shared_ptr<T>
// atomic_load(const shared_ptr<T>* p)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p(new int(3));
std::shared_ptr<int> q = std::atomic_load(&p);
assert(*q == *p);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
index af11dc8bc2c..ef8dc822102 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_load_explicit.pass.cpp
@@ -22,16 +22,18 @@
// shared_ptr<T>
// atomic_load_explicit(const shared_ptr<T>* p, memory_order mo)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
const std::shared_ptr<int> p(new int(3));
std::shared_ptr<int> q = std::atomic_load_explicit(&p, std::memory_order_relaxed);
assert(*q == *p);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
index 7a85a9934ef..a13a7d57ab9 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store.pass.cpp
@@ -22,17 +22,19 @@
// void
// atomic_store(shared_ptr<T>* p, shared_ptr<T> r)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p;
std::shared_ptr<int> r(new int(3));
std::atomic_store(&p, r);
assert(*p == *r);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
index c81266c55fa..6dfe3166c8c 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared.atomic/atomic_store_explicit.pass.cpp
@@ -22,17 +22,19 @@
// void
// atomic_store_explicit(shared_ptr<T>* p, shared_ptr<T> r, memory_order mo)
+// UNSUPPORTED: c++98, c++03
+
#include <memory>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
-#if __has_feature(cxx_atomic)
{
std::shared_ptr<int> p;
std::shared_ptr<int> r(new int(3));
std::atomic_store_explicit(&p, r, std::memory_order_seq_cst);
assert(*p == *r);
}
-#endif
}
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
index b67f31ee45a..8a6cd0f352f 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp
@@ -65,7 +65,7 @@ int main()
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
test_deleter<A>::dealloc_count = 0;
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
// Test an allocator that returns class-type pointers
{
std::shared_ptr<A> p(nullptr, test_deleter<A>(1), min_allocator<void>());
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
index 1a9c09cdb78..b0facfc1a6e 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp
@@ -68,7 +68,7 @@ int main()
assert(test_deleter<A>::count == 0);
assert(test_deleter<A>::dealloc_count == 1);
test_deleter<A>::dealloc_count = 0;
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
// Test an allocator that returns class-type pointers
{
A* ptr = new A;
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
index 023c5c1eca6..1b06a99e636 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp
@@ -19,6 +19,8 @@
#include <cstdlib>
#include <cassert>
+#include "test_macros.h"
+
bool throw_next = false;
void* operator new(std::size_t s) throw(std::bad_alloc)
@@ -105,7 +107,7 @@ int main()
fn(std::unique_ptr<int>(new int));
}
-#if __cplusplus >= 201402L
+#if TEST_STD_VER >= 14
// LWG 2415
{
std::unique_ptr<int, void (*)(int*)> p(nullptr, assert_deleter<int>);
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_cxx03.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_cxx03.pass.cpp
index f6350c72bcc..527bbce1473 100644
--- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_cxx03.pass.cpp
+++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared_cxx03.pass.cpp
@@ -112,7 +112,7 @@ int main()
assert(test_allocator<Two>::alloc_count == 0);
test<bare_allocator<void> >();
-#if __cplusplus >= 201103L
+#if TEST_STD_VER >= 11
test<min_allocator<void> >();
#endif
}
OpenPOWER on IntegriCloud