[cfe-commits] [libcxx] r121267 - in /libcxx/trunk: include/ test/atomics/atomics.fences/ test/atomics/atomics.lockfree/ test/atomics/atomics.types.generic/ test/atomics/atomics.types.operations/ test/atomics/atomics.types.operations/atomics.types.operations.arith/ test/atomics/atomics.types.operations/atomics.types.operations.general/ test/atomics/atomics.types.operations/atomics.types.operations.pointer/ test/atomics/atomics.types.operations/atomics.types.operations.req/ test/atomics/atomics.types.operations/atomics....
Howard Hinnant
hhinnant at apple.com
Wed Dec 8 09:20:28 PST 2010
Author: hhinnant
Date: Wed Dec 8 11:20:28 2010
New Revision: 121267
URL: http://llvm.org/viewvc/llvm-project?rev=121267&view=rev
Log:
After a long break to wait for the atomic spec to settle, this completes the library part of <atomic>. It currently won't even parse as it depends on the existence of the intrinsics specified at http://libcxx.llvm.org/atomic_design_a.html. Everything has been tested using fake intrinsics which have now been removed. As the intrinsics come online, the ATOMIC_* macros will need to be adjusted to reflect which operations are lock-free. These macros will probably need to be #ifdef'd for each supported platform.
Added:
libcxx/trunk/test/atomics/atomics.fences/atomic_signal_fence.pass.cpp
libcxx/trunk/test/atomics/atomics.fences/atomic_thread_fence.pass.cpp
libcxx/trunk/test/atomics/atomics.lockfree/lockfree.pass.cpp
libcxx/trunk/test/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
libcxx/trunk/test/atomics/atomics.types.generic/integral_typedefs.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.arith/nothing_to_do.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.general/nothing_to_do.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.pointer/nothing_to_do.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.templ/nothing_to_do.pass.cpp
libcxx/trunk/test/atomics/atomics.types.operations/nothing_to_do.pass.cpp
Modified:
libcxx/trunk/include/atomic
Modified: libcxx/trunk/include/atomic
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?rev=121267&r1=121266&r2=121267&view=diff
==============================================================================
--- libcxx/trunk/include/atomic (original)
+++ libcxx/trunk/include/atomic Wed Dec 8 11:20:28 2010
@@ -528,142 +528,6 @@
#pragma GCC system_header
-//// Begin Temporary Intrinsics ////
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-__atomic_is_lock_free(_Tp)
-{
- return false;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-__atomic_load(const volatile _Tp* __t, int)
-{
- return *__t;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-__atomic_store(volatile _Tp* __t, _Tp __d, int)
-{
- *__t = __d;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-__atomic_exchange(volatile _Tp* __t, _Tp __d, int)
-{
- _Tp __tmp = *__t;
- *__t = __d;
- return __tmp;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-__atomic_compare_exchange_strong(volatile _Tp* __o, _Tp* __e, _Tp __d, int, int)
-{
- if (const_cast<_Tp&>(*__o) == *__e)
- {
- *__o = __d;
- return true;
- }
- *__e = __d;
- return false;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-bool
-__atomic_compare_exchange_weak(volatile _Tp* __o, _Tp* __e, _Tp __d, int, int)
-{
- if (const_cast<_Tp&>(*__o) == *__e)
- {
- *__o = __d;
- return true;
- }
- *__e = __d;
- return false;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-__atomic_fetch_add(volatile _Tp* __o, _Tp __op, int)
-{
- _Tp __tmp = *__o;
- *__o += __op;
- return __tmp;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp*
-__atomic_fetch_add(_Tp* volatile* __o, ptrdiff_t __op, int)
-{
- _Tp* __tmp = *__o;
- *__o += __op;
- return __tmp;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-__atomic_fetch_sub(volatile _Tp* __o, _Tp __op, int)
-{
- _Tp __tmp = *__o;
- *__o -= __op;
- return __tmp;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp*
-__atomic_fetch_sub(_Tp* volatile* __o, ptrdiff_t __op, int)
-{
- _Tp* __tmp = *__o;
- *__o -= __op;
- return __tmp;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-__atomic_fetch_and(volatile _Tp* __o, _Tp __op, int)
-{
- _Tp __tmp = *__o;
- *__o &= __op;
- return __tmp;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-__atomic_fetch_or(volatile _Tp* __o, _Tp __op, int)
-{
- _Tp __tmp = *__o;
- *__o |= __op;
- return __tmp;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp
-__atomic_fetch_xor(volatile _Tp* __o, _Tp __op, int)
-{
- _Tp __tmp = *__o;
- *__o ^= __op;
- return __tmp;
-}
-
-//// End Temporary Intrinsics ////
-
_LIBCPP_BEGIN_NAMESPACE_STD
typedef enum memory_order
@@ -752,9 +616,16 @@
__atomic_base() {} // = default;
_LIBCPP_INLINE_VISIBILITY
/*constexpr*/ __atomic_base(_Tp __d) : __a_(__d) {}
+#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
__atomic_base(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) volatile = delete;
+#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+private:
+ __atomic_base(const __atomic_base&);
+ __atomic_base& operator=(const __atomic_base&);
+ __atomic_base& operator=(const __atomic_base&) volatile;
+#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
};
// atomic<Integral>
@@ -1467,180 +1338,170 @@
return __o->fetch_xor(__op, __m);
}
-// Atomics for standard typedef types
-
-typedef atomic<char> atomic_char;
-typedef atomic<signed char> atomic_schar;
-typedef atomic<unsigned char> atomic_uchar;
-typedef atomic<short> atomic_short;
-typedef atomic<unsigned short> atomic_ushort;
-typedef atomic<int> atomic_int;
-typedef atomic<unsigned int> atomic_uint;
-typedef atomic<long> atomic_long;
-typedef atomic<unsigned long> atomic_ulong;
-typedef atomic<long long> atomic_llong;
-typedef atomic<unsigned long long> atomic_ullong;
-typedef atomic<char16_t> atomic_char16_t;
-typedef atomic<char32_t> atomic_char32_t;
-typedef atomic<wchar_t> atomic_wchar_t;
-
-typedef atomic<int_least8_t> atomic_int_least8_t;
-typedef atomic<uint_least8_t> atomic_uint_least8_t;
-typedef atomic<int_least16_t> atomic_int_least16_t;
-typedef atomic<uint_least16_t> atomic_uint_least16_t;
-typedef atomic<int_least32_t> atomic_int_least32_t;
-typedef atomic<uint_least32_t> atomic_uint_least32_t;
-typedef atomic<int_least64_t> atomic_int_least64_t;
-typedef atomic<uint_least64_t> atomic_uint_least64_t;
-
-typedef atomic<int_fast8_t> atomic_int_fast8_t;
-typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
-typedef atomic<int_fast16_t> atomic_int_fast16_t;
-typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
-typedef atomic<int_fast32_t> atomic_int_fast32_t;
-typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
-typedef atomic<int_fast64_t> atomic_int_fast64_t;
-typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
-
-typedef atomic<intptr_t> atomic_intptr_t;
-typedef atomic<uintptr_t> atomic_uintptr_t;
-typedef atomic<size_t> atomic_size_t;
-typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
-typedef atomic<intmax_t> atomic_intmax_t;
-typedef atomic<uintmax_t> atomic_uintmax_t;
-
-/*
// flag type and operations
-typedef bool __atomic_flag__;
-
-struct atomic_flag;
-
-bool atomic_flag_test_and_set(volatile atomic_flag*);
-bool atomic_flag_test_and_set(atomic_flag*);
-bool atomic_flag_test_and_set_explicit(volatile atomic_flag*, memory_order);
-bool atomic_flag_test_and_set_explicit(atomic_flag*, memory_order);
-void atomic_flag_clear(volatile atomic_flag*);
-void atomic_flag_clear(atomic_flag*);
-void atomic_flag_clear_explicit(volatile atomic_flag*, memory_order);
-void atomic_flag_clear_explicit(atomic_flag*, memory_order);
-
-typedef struct _LIBCPP_VISIBLE atomic_flag
+typedef struct atomic_flag
{
- __atomic_flag__ __flg_;
+ bool __a_;
_LIBCPP_INLINE_VISIBILITY
- bool test_and_set(memory_order __o = memory_order_seq_cst) volatile
- {return atomic_flag_test_and_set_explicit(this, __o);}
+ bool test_and_set(memory_order __m = memory_order_seq_cst) volatile
+ {return __atomic_exchange(&__a_, true, __m);}
_LIBCPP_INLINE_VISIBILITY
- bool test_and_set(memory_order __o = memory_order_seq_cst)
- {return atomic_flag_test_and_set_explicit(this, __o);}
-
+ bool test_and_set(memory_order __m = memory_order_seq_cst)
+ {return __atomic_exchange(&__a_, true, __m);}
_LIBCPP_INLINE_VISIBILITY
- void clear(memory_order __o = memory_order_seq_cst) volatile
- {atomic_flag_clear_explicit(this, __o);}
+ void clear(memory_order __m = memory_order_seq_cst) volatile
+ {__atomic_store(&__a_, false, __m);}
_LIBCPP_INLINE_VISIBILITY
- void clear(memory_order __o = memory_order_seq_cst)
- {atomic_flag_clear_explicit(this, __o);}
+ void clear(memory_order __m = memory_order_seq_cst)
+ {__atomic_store(&__a_, false, __m);}
-#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
- atomic_flag() = default;
-#else
_LIBCPP_INLINE_VISIBILITY
- atomic_flag() {};
-#endif
+ atomic_flag() {} // = default;
+ _LIBCPP_INLINE_VISIBILITY
+ atomic_flag(bool __b) : __a_(__b) {}
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
atomic_flag(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) = delete;
atomic_flag& operator=(const atomic_flag&) volatile = delete;
-#else
+#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
private:
atomic_flag(const atomic_flag&);
atomic_flag& operator=(const atomic_flag&);
atomic_flag& operator=(const atomic_flag&) volatile;
-public:
-#endif
+#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
} atomic_flag;
inline _LIBCPP_INLINE_VISIBILITY
bool
-atomic_flag_test_and_set(volatile atomic_flag* __f)
+atomic_flag_test_and_set(volatile atomic_flag* __o)
{
- return __atomic_exchange(&__f->__flg_, __atomic_flag__(true),
- memory_order_seq_cst)
- == __atomic_flag__(true);
+ return __o->test_and_set();
}
inline _LIBCPP_INLINE_VISIBILITY
bool
-atomic_flag_test_and_set(atomic_flag* __f)
+atomic_flag_test_and_set(atomic_flag* __o)
{
- return atomic_flag_test_and_set(const_cast<volatile atomic_flag*>(__f));
+ return __o->test_and_set();
}
inline _LIBCPP_INLINE_VISIBILITY
bool
-atomic_flag_test_and_set_explicit(volatile atomic_flag* __f, memory_order __o)
+atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m)
{
- return __atomic_exchange(&__f->__flg_, __atomic_flag__(true), __o)
- == __atomic_flag__(true);
+ return __o->test_and_set(__m);
}
inline _LIBCPP_INLINE_VISIBILITY
bool
-atomic_flag_test_and_set_explicit(atomic_flag* __f, memory_order __o)
+atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m)
{
- return atomic_flag_test_and_set_explicit(const_cast<volatile atomic_flag*>
- (__f), __o);
+ return __o->test_and_set(__m);
}
inline _LIBCPP_INLINE_VISIBILITY
void
-atomic_flag_clear(volatile atomic_flag* __f)
+atomic_flag_clear(volatile atomic_flag* __o)
{
- __atomic_store(&__f->__flg_, __atomic_flag__(false), memory_order_seq_cst);
+ __o->clear();
}
inline _LIBCPP_INLINE_VISIBILITY
void
-atomic_flag_clear(atomic_flag* __f)
+atomic_flag_clear(atomic_flag* __o)
{
- atomic_flag_clear(const_cast<volatile atomic_flag*>(__f));
+ __o->clear();
}
inline _LIBCPP_INLINE_VISIBILITY
void
-atomic_flag_clear_explicit(volatile atomic_flag* __f, memory_order __o)
+atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m)
{
- __atomic_store(&__f->__flg_, __atomic_flag__(false), __o);
+ __o->clear(__m);
}
inline _LIBCPP_INLINE_VISIBILITY
void
-atomic_flag_clear_explicit(atomic_flag* __f, memory_order __o)
+atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m)
{
- atomic_flag_clear_explicit(const_cast<volatile atomic_flag*>(__f), __o);
+ __o->clear(__m);
}
-#define ATOMIC_FLAG_INIT {false}
-#define ATOMIC_VAR_INIT(__v) {__v}
+// fences
inline _LIBCPP_INLINE_VISIBILITY
-memory_order
-__translate_memory_order(memory_order __o)
+void
+atomic_thread_fence(memory_order __m)
{
- switch (__o)
- {
- case memory_order_acq_rel:
- return memory_order_acquire;
- case memory_order_release:
- return memory_order_relaxed;
- }
- return __o;
+ __atomic_thread_fence(__m);
}
-*/
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_signal_fence(memory_order __m)
+{
+ __atomic_signal_fence(__m);
+}
+
+// Atomics for standard typedef types
+
+typedef atomic<char> atomic_char;
+typedef atomic<signed char> atomic_schar;
+typedef atomic<unsigned char> atomic_uchar;
+typedef atomic<short> atomic_short;
+typedef atomic<unsigned short> atomic_ushort;
+typedef atomic<int> atomic_int;
+typedef atomic<unsigned int> atomic_uint;
+typedef atomic<long> atomic_long;
+typedef atomic<unsigned long> atomic_ulong;
+typedef atomic<long long> atomic_llong;
+typedef atomic<unsigned long long> atomic_ullong;
+typedef atomic<char16_t> atomic_char16_t;
+typedef atomic<char32_t> atomic_char32_t;
+typedef atomic<wchar_t> atomic_wchar_t;
+
+typedef atomic<int_least8_t> atomic_int_least8_t;
+typedef atomic<uint_least8_t> atomic_uint_least8_t;
+typedef atomic<int_least16_t> atomic_int_least16_t;
+typedef atomic<uint_least16_t> atomic_uint_least16_t;
+typedef atomic<int_least32_t> atomic_int_least32_t;
+typedef atomic<uint_least32_t> atomic_uint_least32_t;
+typedef atomic<int_least64_t> atomic_int_least64_t;
+typedef atomic<uint_least64_t> atomic_uint_least64_t;
+
+typedef atomic<int_fast8_t> atomic_int_fast8_t;
+typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
+typedef atomic<int_fast16_t> atomic_int_fast16_t;
+typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
+typedef atomic<int_fast32_t> atomic_int_fast32_t;
+typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
+typedef atomic<int_fast64_t> atomic_int_fast64_t;
+typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
+
+typedef atomic<intptr_t> atomic_intptr_t;
+typedef atomic<uintptr_t> atomic_uintptr_t;
+typedef atomic<size_t> atomic_size_t;
+typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
+typedef atomic<intmax_t> atomic_intmax_t;
+typedef atomic<uintmax_t> atomic_uintmax_t;
+
+#define ATOMIC_FLAG_INIT {false}
+#define ATOMIC_VAR_INIT(__v) {__v}
+
+// lock-free property
+
+#define ATOMIC_CHAR_LOCK_FREE 0
+#define ATOMIC_CHAR16_T_LOCK_FREE 0
+#define ATOMIC_CHAR32_T_LOCK_FREE 0
+#define ATOMIC_WCHAR_T_LOCK_FREE 0
+#define ATOMIC_SHORT_LOCK_FREE 0
+#define ATOMIC_INT_LOCK_FREE 0
+#define ATOMIC_LONG_LOCK_FREE 0
+#define ATOMIC_LLONG_LOCK_FREE 0
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ATOMIC
Added: libcxx/trunk/test/atomics/atomics.fences/atomic_signal_fence.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.fences/atomic_signal_fence.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.fences/atomic_signal_fence.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.fences/atomic_signal_fence.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// void atomic_signal_fence(memory_order m);
+
+#include <atomic>
+
+int main()
+{
+ std::atomic_signal_fence(std::memory_order_seq_cst);
+}
Added: libcxx/trunk/test/atomics/atomics.fences/atomic_thread_fence.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.fences/atomic_thread_fence.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.fences/atomic_thread_fence.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.fences/atomic_thread_fence.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,19 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// void atomic_thread_fence(memory_order m);
+
+#include <atomic>
+
+int main()
+{
+ std::atomic_thread_fence(std::memory_order_seq_cst);
+}
Added: libcxx/trunk/test/atomics/atomics.lockfree/lockfree.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.lockfree/lockfree.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.lockfree/lockfree.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.lockfree/lockfree.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,50 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// #define ATOMIC_CHAR_LOCK_FREE unspecified
+// #define ATOMIC_CHAR16_T_LOCK_FREE unspecified
+// #define ATOMIC_CHAR32_T_LOCK_FREE unspecified
+// #define ATOMIC_WCHAR_T_LOCK_FREE unspecified
+// #define ATOMIC_SHORT_LOCK_FREE unspecified
+// #define ATOMIC_INT_LOCK_FREE unspecified
+// #define ATOMIC_LONG_LOCK_FREE unspecified
+// #define ATOMIC_LLONG_LOCK_FREE unspecified
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+ assert(ATOMIC_CHAR_LOCK_FREE == 0 ||
+ ATOMIC_CHAR_LOCK_FREE == 1 ||
+ ATOMIC_CHAR_LOCK_FREE == 2);
+ assert(ATOMIC_CHAR16_T_LOCK_FREE == 0 ||
+ ATOMIC_CHAR16_T_LOCK_FREE == 1 ||
+ ATOMIC_CHAR16_T_LOCK_FREE == 2);
+ assert(ATOMIC_CHAR32_T_LOCK_FREE == 0 ||
+ ATOMIC_CHAR32_T_LOCK_FREE == 1 ||
+ ATOMIC_CHAR32_T_LOCK_FREE == 2);
+ assert(ATOMIC_WCHAR_T_LOCK_FREE == 0 ||
+ ATOMIC_WCHAR_T_LOCK_FREE == 1 ||
+ ATOMIC_WCHAR_T_LOCK_FREE == 2);
+ assert(ATOMIC_SHORT_LOCK_FREE == 0 ||
+ ATOMIC_SHORT_LOCK_FREE == 1 ||
+ ATOMIC_SHORT_LOCK_FREE == 2);
+ assert(ATOMIC_INT_LOCK_FREE == 0 ||
+ ATOMIC_INT_LOCK_FREE == 1 ||
+ ATOMIC_INT_LOCK_FREE == 2);
+ assert(ATOMIC_LONG_LOCK_FREE == 0 ||
+ ATOMIC_LONG_LOCK_FREE == 1 ||
+ ATOMIC_LONG_LOCK_FREE == 2);
+ assert(ATOMIC_LLONG_LOCK_FREE == 0 ||
+ ATOMIC_LLONG_LOCK_FREE == 1 ||
+ ATOMIC_LLONG_LOCK_FREE == 2);
+}
Added: libcxx/trunk/test/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.types.generic/cstdint_typedefs.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,66 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// typedef atomic<int_least8_t> atomic_int_least8_t;
+// typedef atomic<uint_least8_t> atomic_uint_least8_t;
+// typedef atomic<int_least16_t> atomic_int_least16_t;
+// typedef atomic<uint_least16_t> atomic_uint_least16_t;
+// typedef atomic<int_least32_t> atomic_int_least32_t;
+// typedef atomic<uint_least32_t> atomic_uint_least32_t;
+// typedef atomic<int_least64_t> atomic_int_least64_t;
+// typedef atomic<uint_least64_t> atomic_uint_least64_t;
+//
+// typedef atomic<int_fast8_t> atomic_int_fast8_t;
+// typedef atomic<uint_fast8_t> atomic_uint_fast8_t;
+// typedef atomic<int_fast16_t> atomic_int_fast16_t;
+// typedef atomic<uint_fast16_t> atomic_uint_fast16_t;
+// typedef atomic<int_fast32_t> atomic_int_fast32_t;
+// typedef atomic<uint_fast32_t> atomic_uint_fast32_t;
+// typedef atomic<int_fast64_t> atomic_int_fast64_t;
+// typedef atomic<uint_fast64_t> atomic_uint_fast64_t;
+//
+// typedef atomic<intptr_t> atomic_intptr_t;
+// typedef atomic<uintptr_t> atomic_uintptr_t;
+// typedef atomic<size_t> atomic_size_t;
+// typedef atomic<ptrdiff_t> atomic_ptrdiff_t;
+// typedef atomic<intmax_t> atomic_intmax_t;
+// typedef atomic<uintmax_t> atomic_uintmax_t;
+
+#include <atomic>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::atomic< std::int_least8_t>, std::atomic_int_least8_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::uint_least8_t>, std::atomic_uint_least8_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::int_least16_t>, std::atomic_int_least16_t>::value), "");
+ static_assert((std::is_same<std::atomic<std::uint_least16_t>, std::atomic_uint_least16_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::int_least32_t>, std::atomic_int_least32_t>::value), "");
+ static_assert((std::is_same<std::atomic<std::uint_least32_t>, std::atomic_uint_least32_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::int_least64_t>, std::atomic_int_least64_t>::value), "");
+ static_assert((std::is_same<std::atomic<std::uint_least64_t>, std::atomic_uint_least64_t>::value), "");
+
+ static_assert((std::is_same<std::atomic< std::int_fast8_t>, std::atomic_int_fast8_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::uint_fast8_t>, std::atomic_uint_fast8_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::int_fast16_t>, std::atomic_int_fast16_t>::value), "");
+ static_assert((std::is_same<std::atomic<std::uint_fast16_t>, std::atomic_uint_fast16_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::int_fast32_t>, std::atomic_int_fast32_t>::value), "");
+ static_assert((std::is_same<std::atomic<std::uint_fast32_t>, std::atomic_uint_fast32_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::int_fast64_t>, std::atomic_int_fast64_t>::value), "");
+ static_assert((std::is_same<std::atomic<std::uint_fast64_t>, std::atomic_uint_fast64_t>::value), "");
+
+ static_assert((std::is_same<std::atomic< std::intptr_t>, std::atomic_intptr_t>::value), "");
+ static_assert((std::is_same<std::atomic<std::uintptr_t>, std::atomic_uintptr_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::size_t>, std::atomic_size_t>::value), "");
+ static_assert((std::is_same<std::atomic<std::ptrdiff_t>, std::atomic_ptrdiff_t>::value), "");
+ static_assert((std::is_same<std::atomic< std::intmax_t>, std::atomic_intmax_t>::value), "");
+ static_assert((std::is_same<std::atomic<std::uintmax_t>, std::atomic_uintmax_t>::value), "");
+}
Added: libcxx/trunk/test/atomics/atomics.types.generic/integral_typedefs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.generic/integral_typedefs.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.generic/integral_typedefs.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.types.generic/integral_typedefs.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// typedef atomic<char> atomic_char;
+// typedef atomic<signed char> atomic_schar;
+// typedef atomic<unsigned char> atomic_uchar;
+// typedef atomic<short> atomic_short;
+// typedef atomic<unsigned short> atomic_ushort;
+// typedef atomic<int> atomic_int;
+// typedef atomic<unsigned int> atomic_uint;
+// typedef atomic<long> atomic_long;
+// typedef atomic<unsigned long> atomic_ulong;
+// typedef atomic<long long> atomic_llong;
+// typedef atomic<unsigned long long> atomic_ullong;
+// typedef atomic<char16_t> atomic_char16_t;
+// typedef atomic<char32_t> atomic_char32_t;
+// typedef atomic<wchar_t> atomic_wchar_t;
+
+#include <atomic>
+#include <type_traits>
+
+int main()
+{
+ static_assert((std::is_same<std::atomic<char>, std::atomic_char>::value), "");
+ static_assert((std::is_same<std::atomic<signed char>, std::atomic_schar>::value), "");
+ static_assert((std::is_same<std::atomic<unsigned char>, std::atomic_uchar>::value), "");
+ static_assert((std::is_same<std::atomic<short>, std::atomic_short>::value), "");
+ static_assert((std::is_same<std::atomic<unsigned short>, std::atomic_ushort>::value), "");
+ static_assert((std::is_same<std::atomic<int>, std::atomic_int>::value), "");
+ static_assert((std::is_same<std::atomic<unsigned int>, std::atomic_uint>::value), "");
+ static_assert((std::is_same<std::atomic<long>, std::atomic_long>::value), "");
+ static_assert((std::is_same<std::atomic<unsigned long>, std::atomic_ulong>::value), "");
+ static_assert((std::is_same<std::atomic<long long>, std::atomic_llong>::value), "");
+ static_assert((std::is_same<std::atomic<unsigned long long>, std::atomic_ullong>::value), "");
+ static_assert((std::is_same<std::atomic<wchar_t>, std::atomic_wchar_t>::value), "");
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+ static_assert((std::is_same<std::atomic<char16_t>, std::atomic_char16_t>::value), "");
+ static_assert((std::is_same<std::atomic<char32_t>, std::atomic_char32_t>::value), "");
+#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+}
Added: libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.arith/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.arith/nothing_to_do.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.arith/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.arith/nothing_to_do.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.general/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.general/nothing_to_do.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.general/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.general/nothing_to_do.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.pointer/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.pointer/nothing_to_do.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.pointer/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.pointer/nothing_to_do.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.req/atomic_var_init.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <atomic>
+
+// #define ATOMIC_VAR_INIT(value)
+
+#include <atomic>
+#include <cassert>
+
+int main()
+{
+ std::atomic<int> v = ATOMIC_VAR_INIT(5);
+ assert(v == 5);
+}
Added: libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.templ/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.templ/nothing_to_do.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.templ/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.types.operations/atomics.types.operations.templ/nothing_to_do.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
Added: libcxx/trunk/test/atomics/atomics.types.operations/nothing_to_do.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/atomics/atomics.types.operations/nothing_to_do.pass.cpp?rev=121267&view=auto
==============================================================================
--- libcxx/trunk/test/atomics/atomics.types.operations/nothing_to_do.pass.cpp (added)
+++ libcxx/trunk/test/atomics/atomics.types.operations/nothing_to_do.pass.cpp Wed Dec 8 11:20:28 2010
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+int main()
+{
+}
More information about the cfe-commits
mailing list