[libc++] Fix CI and Linux failures after landing D68480

- Avoid using C++11-and-later features in <atomic>:
  Historically, we've supported <atomic> 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 <atomic> 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
This commit is contained in:
Louis Dionne 2020-02-24 11:39:48 -05:00
parent 406a54b65f
commit b21405d1cd
4 changed files with 39 additions and 9 deletions

View File

@ -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<class _Fn, class _BFn>
bool __libcpp_thread_poll_with_backoff(_Fn && __f, _BFn && __bf, chrono::nanoseconds __max_elapsed)

View File

@ -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 <class _Atp, class _Fn>
_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 <class _Atp, class _Fn>
_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
@ -1515,12 +1523,21 @@ _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp*, _Fn && __test_fn)
#endif // _LIBCPP_HAS_NO_PLATFORM_WAIT
template <class _Atp, class _Tp>
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 <class _Atp, class _Tp>
_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);
}

View File

@ -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'}

View File

@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: libcpp-has-no-threads
// <atomic>
// Test nested types