[cfe-commits] [libcxx] r154508 - /libcxx/trunk/include/atomic

Howard Hinnant hhinnant at apple.com
Wed Apr 11 10:32:18 PDT 2012


On Apr 11, 2012, at 1:26 PM, David Chisnall wrote:

> Author: theraven
> Date: Wed Apr 11 12:26:23 2012
> New Revision: 154508
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=154508&view=rev
> Log:
> Now that clang supports doing the right thing with regard to atomic
> initialisation, do the right thing with regard to atomic initialisation.
> 
> Note: clang r154507 or later required for <atomic> to work now.
> 
> 
> Modified:
>    libcxx/trunk/include/atomic
> 
> Modified: libcxx/trunk/include/atomic
> URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/atomic?rev=154508&r1=154507&r2=154508&view=diff
> ==============================================================================
> --- libcxx/trunk/include/atomic (original)
> +++ libcxx/trunk/include/atomic Wed Apr 11 12:26:23 2012
> @@ -621,7 +621,7 @@
>     _LIBCPP_INLINE_VISIBILITY
>     __atomic_base() {} // = default;
>     _LIBCPP_INLINE_VISIBILITY
> -    /*constexpr*/ __atomic_base(_Tp __d) { __atomic_store(&__a_, __d, memory_order_seq_cst); }
> +    /*constexpr*/ __atomic_base(_Tp __d) : __a_(__d) {}

What is the reason that __atomic_init is not needed here?  Is this now not an atomic store?

> #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
>     __atomic_base(const __atomic_base&) = delete;
>     __atomic_base& operator=(const __atomic_base&) = delete;
> @@ -820,7 +820,7 @@
> void
> atomic_init(volatile atomic<_Tp>* __o, _Tp __d)
> {
> -    __atomic_store(&__o->__a_, __d, memory_order_seq_cst);
> +    __atomic_init(&__o->__a_, __d);
> }
> 
> template <class _Tp>
> @@ -828,7 +828,7 @@
> void
> atomic_init(atomic<_Tp>* __o, _Tp __d)
> {
> -    __atomic_store(&__o->__a_, __d, memory_order_seq_cst);
> +    __atomic_init(&__o->__a_, __d);
> }
> 
> // atomic_store
> @@ -1366,7 +1366,7 @@
>     _LIBCPP_INLINE_VISIBILITY
>     atomic_flag() {} // = default;
>     _LIBCPP_INLINE_VISIBILITY
> -    atomic_flag(bool __b) { __atomic_store(&__a_, __b, memory_order_seq_cst); }
> +    atomic_flag(bool __b) : __a_(__b) {}

and here?

Howard

> 
> #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
>     atomic_flag(const atomic_flag&) = delete;
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list