Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions stl/inc/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -1443,11 +1443,7 @@ public:

using _Base::_Base;

#ifdef __clang__ // TRANSITION, VSO-406237
constexpr atomic() noexcept(is_nothrow_default_constructible_v<_Ty>) : _Base() {}
#else // ^^^ no workaround / workaround vvv
atomic() = default;
#endif // TRANSITION, VSO-406237

atomic(const atomic&) = delete;
atomic& operator=(const atomic&) = delete;
Expand Down Expand Up @@ -1609,7 +1605,8 @@ _NODISCARD bool atomic_is_lock_free(const atomic<_Ty>* _Mem) noexcept {
}

template <class _Ty>
void atomic_init(atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Value) noexcept {
_CXX20_DEPRECATE_ATOMIC_INIT void atomic_init(
atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Value) noexcept {
#if 1 // TRANSITION, ABI
_CSTD memcpy(_STD addressof(_Mem->_Storage), _STD addressof(_Value), sizeof(_Ty));
#else // ^^^ don't break ABI / break ABI vvv
Expand All @@ -1619,7 +1616,8 @@ void atomic_init(atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type
}

template <class _Ty>
void atomic_init(volatile atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Value) noexcept {
_CXX20_DEPRECATE_ATOMIC_INIT void atomic_init(
volatile atomic<_Ty>* const _Mem, const typename atomic<_Ty>::value_type _Value) noexcept {
// NB: respecting volatility here appears unimplementable
_STD atomic_init(const_cast<atomic<_Ty>*>(_Mem), _Value);
}
Expand Down Expand Up @@ -1947,11 +1945,7 @@ struct atomic_flag { // flag with test-and-set semantics
_Storage.store(false, _Order);
}

#ifdef __clang__ // TRANSITION, VSO-406237
constexpr atomic_flag() noexcept = default;
#else // ^^^ no workaround / workaround vvv
atomic_flag() noexcept = default;
#endif // TRANSITION, VSO-406237

#if 1 // TRANSITION, ABI
atomic<long> _Storage;
Expand Down
17 changes: 16 additions & 1 deletion stl/inc/yvals_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
// P0771R1 noexcept For std::function's Move Constructor
// P0777R1 Avoiding Unnecessary decay
// P0809R0 Comparing Unordered Containers
// P0883R2 Fixing Atomic Initialization
// P0941R2 Feature-Test Macros
// P0972R0 noexcept For <chrono> zero(), min(), max()
// P1164R1 Making create_directory() Intuitive
Expand Down Expand Up @@ -886,7 +887,19 @@
#define _CXX20_DEPRECATE_REL_OPS
#endif // ^^^ warning disabled ^^^

// next warning number: STL4028
#if _HAS_CXX20 && !defined(_SILENCE_CXX20_ATOMIC_INIT_DEPRECATION_WARNING) \
&& !defined(_SILENCE_ALL_CXX20_DEPRECATION_WARNINGS)
#define _CXX20_DEPRECATE_ATOMIC_INIT \
[[deprecated("warning STL4028: " \
"std::atomic_init() overloads are deprecated in C++20. " \
"The constructors of std::atomic provide equivalent functionality. " \
"You can define _SILENCE_CXX20_ATOMIC_INIT_DEPRECATION_WARNING " \
"or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to acknowledge that you have received this warning.")]]
#else // ^^^ warning enabled / warning disabled vvv
#define _CXX20_DEPRECATE_ATOMIC_INIT
#endif // ^^^ warning disabled ^^^

// next warning number: STL4029


// LIBRARY FEATURE-TEST MACROS
Expand Down Expand Up @@ -977,6 +990,8 @@
#endif // _HAS_CXX17

// C++20
#define __cpp_lib_atomic_value_initialization 201911L

#if _HAS_CXX20
#define __cpp_lib_atomic_float 201711L
#define __cpp_lib_bind_front 201907L
Expand Down