[libcxx-commits] [libcxx] 7f82352 - [libc++][test] Test nonconforming atomic_fetch_XXX overloads only on libc++
Casey Carter via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Oct 19 17:20:36 PDT 2020
Author: Casey Carter
Date: 2020-10-19T17:19:52-07:00
New Revision: 7f82352a2c766114bf1f2aa70f458da4e7304043
URL: https://github.com/llvm/llvm-project/commit/7f82352a2c766114bf1f2aa70f458da4e7304043
DIFF: https://github.com/llvm/llvm-project/commit/7f82352a2c766114bf1f2aa70f458da4e7304043.diff
LOG: [libc++][test] Test nonconforming atomic_fetch_XXX overloads only on libc++
The Standard doesn't include the
```c++
template<class T>
T* atomic_fetch_meow(atomic<T*>, ...);
```
templates these tests are testing.
(See https://bugs.llvm.org/show_bug.cgi?id=47908)
Added:
Modified:
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
index 38ce06e2817b..b840930c1258 100644
--- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.pass.cpp
@@ -63,7 +63,11 @@ void testp()
A t;
std::atomic_init(&t, T(1*sizeof(X)));
assert(std::atomic_fetch_add(&t, 2) == T(1*sizeof(X)));
+#ifdef _LIBCPP_VERSION // libc++ is nonconforming
std::atomic_fetch_add<X>(&t, 0);
+#else
+ std::atomic_fetch_add<T>(&t, 0);
+#endif // _LIBCPP_VERSION
assert(t == T(3*sizeof(X)));
}
{
@@ -72,7 +76,11 @@ void testp()
volatile A t;
std::atomic_init(&t, T(1*sizeof(X)));
assert(std::atomic_fetch_add(&t, 2) == T(1*sizeof(X)));
+#ifdef _LIBCPP_VERSION // libc++ is nonconforming
std::atomic_fetch_add<X>(&t, 0);
+#else
+ std::atomic_fetch_add<T>(&t, 0);
+#endif // _LIBCPP_VERSION
assert(t == T(3*sizeof(X)));
}
}
diff --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
index f39adb14effa..2effd4c128a1 100644
--- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.pass.cpp
@@ -67,7 +67,11 @@ testp()
std::atomic_init(&t, T(1*sizeof(X)));
assert(std::atomic_fetch_add_explicit(&t, 2,
std::memory_order_seq_cst) == T(1*sizeof(X)));
+#ifdef _LIBCPP_VERSION // libc++ is not conforming
std::atomic_fetch_add_explicit<X>(&t, 0, std::memory_order_relaxed);
+#else
+ std::atomic_fetch_add_explicit<T>(&t, 0, std::memory_order_relaxed);
+#endif // _LIBCPP_VERSION
assert(t == T(3*sizeof(X)));
}
{
@@ -77,7 +81,11 @@ testp()
std::atomic_init(&t, T(1*sizeof(X)));
assert(std::atomic_fetch_add_explicit(&t, 2,
std::memory_order_seq_cst) == T(1*sizeof(X)));
+#ifdef _LIBCPP_VERSION // libc++ is not conforming
std::atomic_fetch_add_explicit<X>(&t, 0, std::memory_order_relaxed);
+#else
+ std::atomic_fetch_add_explicit<T>(&t, 0, std::memory_order_relaxed);
+#endif // _LIBCPP_VERSION
assert(t == T(3*sizeof(X)));
}
}
diff --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
index 3568d2fa60ff..dd867b8bb766 100644
--- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.pass.cpp
@@ -63,7 +63,11 @@ void testp()
A t;
std::atomic_init(&t, T(3*sizeof(X)));
assert(std::atomic_fetch_sub(&t, 2) == T(3*sizeof(X)));
+#ifdef _LIBCPP_VERSION // libc++ is nonconforming
std::atomic_fetch_sub<X>(&t, 0);
+#else
+ std::atomic_fetch_sub<T>(&t, 0);
+#endif // _LIBCPP_VERSION
assert(t == T(1*sizeof(X)));
}
{
@@ -72,7 +76,11 @@ void testp()
volatile A t;
std::atomic_init(&t, T(3*sizeof(X)));
assert(std::atomic_fetch_sub(&t, 2) == T(3*sizeof(X)));
+#ifdef _LIBCPP_VERSION // libc++ is nonconforming
std::atomic_fetch_sub<X>(&t, 0);
+#else
+ std::atomic_fetch_sub<T>(&t, 0);
+#endif // _LIBCPP_VERSION
assert(t == T(1*sizeof(X)));
}
}
diff --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
index 261917f8087e..1499de1606be 100644
--- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.pass.cpp
@@ -67,7 +67,11 @@ void testp()
std::atomic_init(&t, T(3*sizeof(X)));
assert(std::atomic_fetch_sub_explicit(&t, 2,
std::memory_order_seq_cst) == T(3*sizeof(X)));
+#ifdef _LIBCPP_VERSION // libc++ is nonconforming
std::atomic_fetch_sub_explicit<X>(&t, 0, std::memory_order_relaxed);
+#else
+ std::atomic_fetch_sub_explicit<T>(&t, 0, std::memory_order_relaxed);
+#endif // _LIBCPP_VERSION
assert(t == T(1*sizeof(X)));
}
{
@@ -77,7 +81,11 @@ void testp()
std::atomic_init(&t, T(3*sizeof(X)));
assert(std::atomic_fetch_sub_explicit(&t, 2,
std::memory_order_seq_cst) == T(3*sizeof(X)));
- std::atomic_fetch_sub_explicit<X>(&t, 0, std::memory_order_relaxed);
+#ifdef _LIBCPP_VERSION // libc++ is nonconforming
+ std::atomic_fetch_sub_explicit<X>(&t, 0, std::memory_order_relaxed);
+#else
+ std::atomic_fetch_sub_explicit<T>(&t, 0, std::memory_order_relaxed);
+#endif // _LIBCPP_VERSION
assert(t == T(1*sizeof(X)));
}
}
More information about the libcxx-commits
mailing list