summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/atomics
diff options
context:
space:
mode:
authorLouis Dionne <ldionne@apple.com>2019-03-05 14:50:25 +0000
committerLouis Dionne <ldionne@apple.com>2019-03-05 14:50:25 +0000
commitb55803283b65bffc77a9f6aeb6337b7d50fd66ce (patch)
tree8c1c2b6157663d1b78ba111a4c78f40bafeccd98 /libcxx/test/std/atomics
parentbc6b225d42928c1bf7cf8a6801304b1af8747d48 (diff)
downloadbcm5719-llvm-b55803283b65bffc77a9f6aeb6337b7d50fd66ce.tar.gz
bcm5719-llvm-b55803283b65bffc77a9f6aeb6337b7d50fd66ce.zip
[libc++] Change memory_order to an enum class
This implements P0439R0. Thanks to Zoe Carver for the patch. Differential Revision: https://reviews.llvm.org/D58201 llvm-svn: 355403
Diffstat (limited to 'libcxx/test/std/atomics')
-rw-r--r--libcxx/test/std/atomics/atomics.order/memory_order.pass.cpp17
-rw-r--r--libcxx/test/std/atomics/atomics.order/memory_order_new.pass.cpp23
2 files changed, 32 insertions, 8 deletions
diff --git a/libcxx/test/std/atomics/atomics.order/memory_order.pass.cpp b/libcxx/test/std/atomics/atomics.order/memory_order.pass.cpp
index 973f58583ca..c756d0b187b 100644
--- a/libcxx/test/std/atomics/atomics.order/memory_order.pass.cpp
+++ b/libcxx/test/std/atomics/atomics.order/memory_order.pass.cpp
@@ -21,14 +21,15 @@
int main(int, char**)
{
- assert(std::memory_order_relaxed == 0);
- assert(std::memory_order_consume == 1);
- assert(std::memory_order_acquire == 2);
- assert(std::memory_order_release == 3);
- assert(std::memory_order_acq_rel == 4);
- assert(std::memory_order_seq_cst == 5);
+ assert(static_cast<int>(std::memory_order_relaxed) == 0);
+ assert(static_cast<int>(std::memory_order_consume) == 1);
+ assert(static_cast<int>(std::memory_order_acquire) == 2);
+ assert(static_cast<int>(std::memory_order_release) == 3);
+ assert(static_cast<int>(std::memory_order_acq_rel) == 4);
+ assert(static_cast<int>(std::memory_order_seq_cst) == 5);
+
std::memory_order o = std::memory_order_seq_cst;
- assert(o == 5);
+ assert(static_cast<int>(o) == 5);
- return 0;
+ return 0;
}
diff --git a/libcxx/test/std/atomics/atomics.order/memory_order_new.pass.cpp b/libcxx/test/std/atomics/atomics.order/memory_order_new.pass.cpp
new file mode 100644
index 00000000000..e9a571dfa8b
--- /dev/null
+++ b/libcxx/test/std/atomics/atomics.order/memory_order_new.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03, c++11, c++14, c++17
+
+#include <atomic>
+
+int main(int, char**)
+{
+ static_assert(std::memory_order_relaxed == std::memory_order::relaxed);
+ static_assert(std::memory_order_consume == std::memory_order::consume);
+ static_assert(std::memory_order_acquire == std::memory_order::acquire);
+ static_assert(std::memory_order_release == std::memory_order::release);
+ static_assert(std::memory_order_acq_rel == std::memory_order::acq_rel);
+ static_assert(std::memory_order_seq_cst == std::memory_order::seq_cst);
+
+ return 0;
+}
OpenPOWER on IntegriCloud