-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate Volatile #634
Deprecate Volatile #634
Conversation
Me: Lets delete some code 👍 Also me: Adds 274 lines of |
Curtis is very very close to landing #520 so that will soon be you :) |
@CaseyCarter Since this is a C++20 only feature can we use a requires clause to turn these off or are there IFNDR concerns since in 20 mode it will always be disabled? |
Regarding concepts usage, please see #602. |
@BillyONeal I actually only went for #if _HAS_CXX20
template <class _Type = _Ty, enable_if_t<_Is_always_lock_free<_Type>, int> = 0>
#endif // _HAS_CXX20
_Ty fetch_sub(const _Ty _Operand) volatile noexcept {
return fetch_add(_Negate(_Operand));
} vs _Ty fetch_sub(const _Ty _Operand) volatile noexcept
#if _HAS_CXX20
requires _Is_always_lock_free<_Type>
#endif // _HAS_CXX20
{
return fetch_add(_Negate(_Operand));
} That said, I do not believe it is that bad after all |
That's fair. I'm not arguing for doing that explicitly, only making sure that we aren't avoiding the feature just because we think it is unavailable. |
Could somebody start a run of the test suite? |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
We'll probably need to add deprecation suppressions to |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@CaseyCarter I would put those two failing tests in the skip list or are there some other things you would want to try here? |
Rebased on master and deactivated the two failing libcxx tests. That said, I am unsure why test for |
Fixes microsoft#558 Co-Authored-By: Casey Carter <cartec69@gmail.com>
stl/inc/atomic
Outdated
_STD atomic_init(const_cast<atomic<_Ty>*>(_Mem), _Value); | ||
} | ||
|
||
template <class _Ty> | ||
void atomic_store(volatile atomic<_Ty>* const _Mem, const _Identity_t<_Ty> _Value) noexcept { | ||
static_assert(_Deprecate_non_lock_free_volatile<_Is_always_lock_free<sizeof(_Ty)>>, "Never fails"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to other reviewers: Despite that WG21-P1831 doesn't mention these other non-member functions explicitly, they are specified as equivalent to calling the (now conditionally deprecated) member functions in [atomics.nonmembers]/1, so they should be deprecated.
Co-Authored-By: Casey Carter <cartec69@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After pushing the partial specialization change, I noticed that the deprecation machinery in integral/floating/pointer is unnecessary - they are always lock-free even in our current ABI (as their size is <= 8 and they're powers of 2). @CaseyCarter agreed, so I removed those occurrences and added comments. However, I left all of the occurrences in the non-member functions like atomic_fetch_add
.
Thanks for yet another C++20 feature, @miscco! 😺😸 |
Description
This fixes #558 by removing the appropriate parts from the STL.
I verified those tests that do not require libc++ machinery. For the sake of my sanity someone with acces to a test runner could tell me what I have to change for the tests, as I am not sure whether deprecation is an actual problem and / or whether we would actually want to suppress the warning for the tests.
Checklist
Be sure you've read README.md and understand the scope of this repo.
If you're unsure about a box, leave it unchecked. A maintainer will help you.
_Ugly
as perhttps://eel.is/c++draft/lex.name#3.1 or there are no product code changes.
verified by an STL maintainer before automated testing is enabled on GitHub,
leave this unchecked for initial submission).
members, adding virtual functions, changing whether a type is an aggregate
or trivially copyable, etc.).
the C++ Working Draft (including any cited standards), other WG21 papers
(excluding reference implementations outside of proposed standard wording),
and LWG issues as reference material. If they were derived from a project
that's already listed in NOTICE.txt, that's fine, but please mention it.
If they were derived from any other project (including Boost and libc++,
which are not yet listed in NOTICE.txt), you must mention it here,
so we can determine whether the license is compatible and what else needs
to be done.