[libcxx] r300622 - Cleanup _LIBCPP_HAS_NO_<c++11-feature> macros in thread.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 18 16:05:08 PDT 2017


Author: ericwf
Date: Tue Apr 18 18:05:08 2017
New Revision: 300622

URL: http://llvm.org/viewvc/llvm-project?rev=300622&view=rev
Log:
Cleanup _LIBCPP_HAS_NO_<c++11-feature> macros in thread.

Modified:
    libcxx/trunk/include/__mutex_base
    libcxx/trunk/include/mutex
    libcxx/trunk/include/thread
    libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
    libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
    libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
    libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp

Modified: libcxx/trunk/include/__mutex_base
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__mutex_base?rev=300622&r1=300621&r2=300622&view=diff
==============================================================================
--- libcxx/trunk/include/__mutex_base (original)
+++ libcxx/trunk/include/__mutex_base Tue Apr 18 18:05:08 2017
@@ -34,7 +34,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
 {
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#ifndef _LIBCPP_CXX03_LANG
     __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
 #else
     __libcpp_mutex_t __m_;
@@ -42,7 +42,7 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SA
 
 public:
     _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#ifndef _LIBCPP_CXX03_LANG
     constexpr mutex() _NOEXCEPT = default;
 #else
     mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}
@@ -66,7 +66,7 @@ struct _LIBCPP_TYPE_VIS defer_lock_t {};
 struct _LIBCPP_TYPE_VIS try_to_lock_t {};
 struct _LIBCPP_TYPE_VIS adopt_lock_t {};
 
-#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
+#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MUTEX)
 
 extern const defer_lock_t  defer_lock;
 extern const try_to_lock_t try_to_lock;
@@ -150,7 +150,7 @@ private:
     unique_lock& operator=(unique_lock const&); // = delete;
 
 public:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
     unique_lock(unique_lock&& __u) _NOEXCEPT
         : __m_(__u.__m_), __owns_(__u.__owns_)
@@ -167,7 +167,7 @@ public:
             return *this;
         }
 
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_CXX03_LANG
 
     void lock();
     bool try_lock();
@@ -279,7 +279,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_st
 
 class _LIBCPP_TYPE_VIS condition_variable
 {
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#ifndef _LIBCPP_CXX03_LANG
     __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
 #else
     __libcpp_condvar_t __cv_;
@@ -287,7 +287,7 @@ class _LIBCPP_TYPE_VIS condition_variabl
 
 public:
     _LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#ifndef _LIBCPP_CXX03_LANG
     constexpr condition_variable() _NOEXCEPT = default;
 #else
     condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}

Modified: libcxx/trunk/include/mutex
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/mutex?rev=300622&r1=300621&r2=300622&view=diff
==============================================================================
--- libcxx/trunk/include/mutex (original)
+++ libcxx/trunk/include/mutex Tue Apr 18 18:05:08 2017
@@ -191,7 +191,7 @@ template<class Callable, class ...Args>
 #include <__mutex_base>
 #include <functional>
 #include <memory>
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 #include <tuple>
 #endif
 #include <__threading_support>
@@ -343,7 +343,7 @@ try_lock(_L0& __l0, _L1& __l1)
     return 0;
 }
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 
 template <class _L0, class _L1, class _L2, class... _L3>
 int
@@ -362,7 +362,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2
     return __r;
 }
 
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_CXX03_LANG
 
 template <class _L0, class _L1>
 void
@@ -391,7 +391,7 @@ lock(_L0& __l0, _L1& __l1)
     }
 }
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 
 template <class _L0, class _L1, class _L2, class ..._L3>
 void
@@ -466,7 +466,7 @@ void __unlock(_L0& __l0, _L1& __l1, _L2&
     _VSTD::__unlock(__l2, __l3...);
 }
 
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_CXX03_LANG
 
 #if _LIBCPP_STD_VER > 14
 template <class ..._Mutexes>
@@ -550,13 +550,13 @@ private:
 
 struct _LIBCPP_TEMPLATE_VIS once_flag;
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 
 template<class _Callable, class... _Args>
 _LIBCPP_INLINE_VISIBILITY
 void call_once(once_flag&, _Callable&&, _Args&&...);
 
-#else  // _LIBCPP_HAS_NO_VARIADICS
+#else  // _LIBCPP_CXX03_LANG
 
 template<class _Callable>
 _LIBCPP_INLINE_VISIBILITY
@@ -566,7 +566,7 @@ template<class _Callable>
 _LIBCPP_INLINE_VISIBILITY
 void call_once(once_flag&, const _Callable&);
 
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_CXX03_LANG
 
 struct _LIBCPP_TEMPLATE_VIS once_flag
 {
@@ -580,11 +580,11 @@ private:
 
     unsigned long __state_;
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
     template<class _Callable, class... _Args>
     friend
     void call_once(once_flag&, _Callable&&, _Args&&...);
-#else  // _LIBCPP_HAS_NO_VARIADICS
+#else  // _LIBCPP_CXX03_LANG
     template<class _Callable>
     friend
     void call_once(once_flag&, _Callable&);
@@ -592,10 +592,10 @@ private:
     template<class _Callable>
     friend
     void call_once(once_flag&, const _Callable&);
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_CXX03_LANG
 };
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 
 template <class _Fp>
 class __call_once_param
@@ -650,7 +650,7 @@ __call_once_proxy(void* __vp)
 
 _LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*));
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 
 template<class _Callable, class... _Args>
 inline _LIBCPP_INLINE_VISIBILITY
@@ -666,7 +666,7 @@ call_once(once_flag& __flag, _Callable&&
     }
 }
 
-#else  // _LIBCPP_HAS_NO_VARIADICS
+#else  // _LIBCPP_CXX03_LANG
 
 template<class _Callable>
 inline _LIBCPP_INLINE_VISIBILITY
@@ -692,7 +692,7 @@ call_once(once_flag& __flag, const _Call
     }
 }
 
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // _LIBCPP_CXX03_LANG
 
 _LIBCPP_END_NAMESPACE_STD
 

Modified: libcxx/trunk/include/thread
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/thread?rev=300622&r1=300621&r2=300622&view=diff
==============================================================================
--- libcxx/trunk/include/thread (original)
+++ libcxx/trunk/include/thread Tue Apr 18 18:05:08 2017
@@ -95,7 +95,7 @@ void sleep_for(const chrono::duration<Re
 #include <system_error>
 #include <chrono>
 #include <__mutex_base>
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 #include <tuple>
 #endif
 #include <__threading_support>
@@ -291,7 +291,7 @@ public:
 
     _LIBCPP_INLINE_VISIBILITY
     thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
     template <class _Fp, class ..._Args,
               class = typename enable_if
               <
@@ -300,19 +300,19 @@ public:
              >
         _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
         explicit thread(_Fp&& __f, _Args&&... __args);
-#else  // _LIBCPP_HAS_NO_VARIADICS
+#else  // _LIBCPP_CXX03_LANG
     template <class _Fp>
     _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
     explicit thread(_Fp __f);
 #endif
     ~thread();
 
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
     thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = _LIBCPP_NULL_THREAD;}
     _LIBCPP_INLINE_VISIBILITY
     thread& operator=(thread&& __t) _NOEXCEPT;
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_CXX03_LANG
 
     _LIBCPP_INLINE_VISIBILITY
     void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);}
@@ -329,7 +329,7 @@ public:
     static unsigned hardware_concurrency() _NOEXCEPT;
 };
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
 
 template <class _TSp, class _Fp, class ..._Args, size_t ..._Indices>
 inline _LIBCPP_INLINE_VISIBILITY
@@ -369,7 +369,18 @@ thread::thread(_Fp&& __f, _Args&&... __a
         __throw_system_error(__ec, "thread constructor failed");
 }
 
-#else  // _LIBCPP_HAS_NO_VARIADICS
+inline
+thread&
+thread::operator=(thread&& __t) _NOEXCEPT
+{
+    if (!__libcpp_thread_isnull(&__t_))
+        terminate();
+    __t_ = __t.__t_;
+    __t.__t_ = _LIBCPP_NULL_THREAD;
+    return *this;
+}
+
+#else  // _LIBCPP_CXX03_LANG
 
 template <class _Fp>
 struct __thread_invoke_pair {
@@ -404,22 +415,7 @@ thread::thread(_Fp __f)
         __throw_system_error(__ec, "thread constructor failed");
 }
 
-#endif  // _LIBCPP_HAS_NO_VARIADICS
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-inline
-thread&
-thread::operator=(thread&& __t) _NOEXCEPT
-{
-    if (!__libcpp_thread_isnull(&__t_))
-        terminate();
-    __t_ = __t.__t_;
-    __t.__t_ = _LIBCPP_NULL_THREAD;
-    return *this;
-}
-
-#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif  // _LIBCPP_CXX03_LANG
 
 inline _LIBCPP_INLINE_VISIBILITY
 void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}

Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp?rev=300622&r1=300621&r2=300622&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp Tue Apr 18 18:05:08 2017
@@ -188,7 +188,7 @@ int main()
         }
     }
 #endif
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if TEST_STD_VER >= 11
     {
         L0 l0;
         L0 l1;
@@ -518,5 +518,5 @@ int main()
         }
     }
 #endif  // TEST_HAS_NO_EXCEPTIONS
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif // TEST_STD_VER >= 11
 }

Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp?rev=300622&r1=300621&r2=300622&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp Tue Apr 18 18:05:08 2017
@@ -126,7 +126,7 @@ int main()
         }
     }
 #endif
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if TEST_STD_VER >= 11
     {
         L0 l0;
         L0 l1;
@@ -522,5 +522,5 @@ int main()
         assert(!l2.locked());
         assert(!l3.locked());
     }
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // TEST_STD_VER >= 11
 }

Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp?rev=300622&r1=300621&r2=300622&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.callonce/call_once.pass.cpp Tue Apr 18 18:05:08 2017
@@ -66,7 +66,7 @@ void f3()
 #endif
 }
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if TEST_STD_VER >= 11
 
 struct init1
 {
@@ -101,7 +101,7 @@ void f2()
     std::call_once(flg2, init2(), 4, 5);
 }
 
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // TEST_STD_VER >= 11
 
 std::once_flag flg41;
 std::once_flag flg42;
@@ -135,7 +135,7 @@ void f42()
     std::call_once(flg41, init41);
 }
 
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if TEST_STD_VER >= 11
 
 class MoveOnly
 {
@@ -174,7 +174,6 @@ public:
     void operator()(int&) {}
 };
 
-#if TEST_STD_VER >= 11
 // reference qualifiers on functions are a C++11 extension
 struct RefQual
 {
@@ -185,8 +184,8 @@ struct RefQual
     void operator()() & { ++lv_called; }
     void operator()() && { ++rv_called; }
 };
-#endif
-#endif
+
+#endif // TEST_STD_VER >= 11
 
 int main()
 {
@@ -218,7 +217,7 @@ int main()
         assert(init41_called == 1);
         assert(init42_called == 1);
     }
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if TEST_STD_VER >= 11
     // check functors with 1 arg
     {
         std::thread t0(f1);
@@ -245,7 +244,6 @@ int main()
         int i = 0;
         std::call_once(f, NonCopyable(), i);
     }
-#if TEST_STD_VER >= 11
 // reference qualifiers on functions are a C++11 extension
     {
         std::once_flag f1, f2;
@@ -255,6 +253,5 @@ int main()
         std::call_once(f2, std::move(rq));
         assert(rq.rv_called == 1);
     }
-#endif
-#endif  // _LIBCPP_HAS_NO_VARIADICS
+#endif  // TEST_STD_VER >= 11
 }

Modified: libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp?rev=300622&r1=300621&r2=300622&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.mutex/thread.once/thread.once.onceflag/default.pass.cpp Tue Apr 18 18:05:08 2017
@@ -14,13 +14,14 @@
 // constexpr once_flag() noexcept;
 
 #include <mutex>
+#include "test_macros.h"
 
 int main()
 {
     {
     std::once_flag f;
     }
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#if TEST_STD_VER >= 11
     {
     constexpr std::once_flag f;
     }




More information about the cfe-commits mailing list