mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
Reduce compiler warnings when boost uses std-atomics
This works around for compilers with non-static-data-member
initialization.
spinlock_t is-a struct { lockType _; } and BOOST_DETAIL_SPINLOCK_INIT
initializes the first member of the struct.
All defines of BOOST_DETAIL_SPINLOCK_INIT include c-style curly braces
to initialize the struct's data member.
However, modern C++ compiler interpret the braces differently resulting
in copy constriction of the initializer.
This commit is contained in:
parent
684b364a8a
commit
6d4b94df13
1 changed files with 9 additions and 2 deletions
|
|
@ -28,10 +28,17 @@
|
||||||
using namespace PBD;
|
using namespace PBD;
|
||||||
|
|
||||||
spinlock_t::spinlock_t ()
|
spinlock_t::spinlock_t ()
|
||||||
|
#ifdef BOOST_SMART_PTR_DETAIL_SPINLOCK_STD_ATOMIC_HPP_INCLUDED
|
||||||
|
/* C++11 non-static data member initialization,
|
||||||
|
* with non-copyable std::atomic ATOMIC_FLAG_INIT
|
||||||
|
*/
|
||||||
|
: l {BOOST_DETAIL_SPINLOCK_INIT} {}
|
||||||
|
#else
|
||||||
|
/* default C++ assign struct's first member */
|
||||||
{
|
{
|
||||||
boost::detail::spinlock init = BOOST_DETAIL_SPINLOCK_INIT;
|
l = BOOST_DETAIL_SPINLOCK_INIT;
|
||||||
std::memcpy (&l, &init, sizeof (init));
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SpinLock::SpinLock (spinlock_t& lock)
|
SpinLock::SpinLock (spinlock_t& lock)
|
||||||
: _lock (lock)
|
: _lock (lock)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue