From: Louis Dionne Date: Mon, 24 Feb 2020 16:39:48 +0000 (-0500) Subject: [libc++] Fix CI and Linux failures after landing D68480 X-Git-Tag: llvmorg-12-init~13822 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b21405d1cd088d7d7088479861fabd55f998bf6b;p=platform%2Fupstream%2Fllvm.git [libc++] Fix CI and Linux failures after landing D68480 - Avoid using C++11-and-later features in : Historically, we've supported in C++03, so we can't use C++11 features in that header. This is something we really need to change, since our implementation of is starting to accumulate technical debt because of that. - Mark a test as unsupported on single threaded systems - Add missing symbols to the Linux ABI list --- diff --git a/libcxx/include/__threading_support b/libcxx/include/__threading_support index fef172c..9480225 100644 --- a/libcxx/include/__threading_support +++ b/libcxx/include/__threading_support @@ -507,7 +507,7 @@ bool __libcpp_timed_backoff_policy::operator()(chrono::nanoseconds __elapsed) co return false; } -static constexpr int __libcpp_polling_count = 64; +static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64; template bool __libcpp_thread_poll_with_backoff(_Fn && __f, _BFn && __bf, chrono::nanoseconds __max_elapsed) diff --git a/libcxx/include/atomic b/libcxx/include/atomic index 0cbd7c0..56d8026 100644 --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -1482,9 +1482,11 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t); template -_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn) -{ - auto const __libcpp_atomic_wait_backoff = [=](chrono::nanoseconds __elapsed) -> bool { +struct __libcpp_atomic_wait_backoff_impl { + _Atp* __a; + _Fn __test_fn; + _LIBCPP_INLINE_VISIBILITY bool operator()(chrono::nanoseconds __elapsed) const + { if(__elapsed > chrono::microseconds(64)) { auto const __monitor = __libcpp_atomic_monitor(__a); @@ -1497,8 +1499,14 @@ _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn) else ; // poll return false; - }; - return __libcpp_thread_poll_with_backoff(__test_fn, __libcpp_atomic_wait_backoff); + } +}; + +template +_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn) +{ + __libcpp_atomic_wait_backoff_impl<_Atp, typename decay<_Fn>::type> __backoff_fn = {__a, __test_fn}; + return __libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn); } #else // _LIBCPP_HAS_NO_PLATFORM_WAIT @@ -1516,11 +1524,20 @@ _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp*, _Fn && __test_fn) #endif // _LIBCPP_HAS_NO_PLATFORM_WAIT template +struct __cxx_atomic_wait_test_fn_impl { + _Atp* __a; + _Tp __val; + memory_order __order; + _LIBCPP_INLINE_VISIBILITY bool operator()() const + { + return !__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val); + } +}; + +template _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order) { - auto const __test_fn = [=]() -> bool { - return !__cxx_nonatomic_compare_equal(__cxx_atomic_load(__a, __order), __val); - }; + __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order}; return __cxx_atomic_wait(__a, __test_fn); } diff --git a/libcxx/lib/abi/x86_64-unknown-linux-gnu.v1.abilist b/libcxx/lib/abi/x86_64-unknown-linux-gnu.v1.abilist index 8301cbf..e646b86 100644 --- a/libcxx/lib/abi/x86_64-unknown-linux-gnu.v1.abilist +++ b/libcxx/lib/abi/x86_64-unknown-linux-gnu.v1.abilist @@ -1917,3 +1917,14 @@ {'is_defined': False, 'name': '__cxa_rethrow_primary_exception', 'type': 'FUNC'} {'is_defined': False, 'name': '__cxa_throw', 'type': 'FUNC'} {'is_defined': False, 'name': '__cxa_uncaught_exceptions', 'type': 'FUNC'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__132__destroy_barrier_algorithm_baseEPNS_24__barrier_algorithm_baseE'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__libcpp_atomic_monitorEPVKv'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__libcpp_atomic_monitorEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEE'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__cxx_atomic_notify_allEPVKv'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__cxx_atomic_notify_oneEPVKv'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__134__construct_barrier_algorithm_baseERl'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__120__libcpp_atomic_waitEPVKvi'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__cxx_atomic_notify_allEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEE'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__120__libcpp_atomic_waitEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEEi'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__131__arrive_barrier_algorithm_baseEPNS_24__barrier_algorithm_baseEh'} +{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__123__cxx_atomic_notify_oneEPVKNS_17__cxx_atomic_implIiNS_22__cxx_atomic_base_implIiEEEE'} diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp index 4c225a5..ba6d694 100644 --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: libcpp-has-no-threads + // // Test nested types