Fixing Boost build with Clang 3.4

This applies the following Boost patches that have already been applied
upstream:

6bb71fdd8f.patch
e4bde20f2e.patch

These patches will be in Boost 1.56 but until then we need to make the local
changes.

Fixes #864
This commit is contained in:
Strahinja Val Markovic 2014-03-04 10:15:19 -08:00
parent fa1d628943
commit 18829290a3
2 changed files with 19 additions and 8 deletions

View File

@ -196,15 +196,17 @@ protected:
public:
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
{
memset(&v_, 0, sizeof(v_));
memcpy(&v_, &v, sizeof(value_type));
}
void
store(value_type const& value, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
storage_type value_s = 0;
storage_type value_s;
memset(&value_s, 0, sizeof(value_s));
memcpy(&value_s, &value, sizeof(value_type));
platform_fence_before_store(order);
platform_store128(value_s, &v_);
@ -247,7 +249,9 @@ public:
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
storage_type expected_s = 0, desired_s = 0;
storage_type expected_s, desired_s;
memset(&expected_s, 0, sizeof(expected_s));
memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));

View File

@ -958,14 +958,16 @@ protected:
public:
BOOST_DEFAULTED_FUNCTION(base_atomic(void), {})
explicit base_atomic(value_type const& v) BOOST_NOEXCEPT : v_(0)
explicit base_atomic(value_type const& v) BOOST_NOEXCEPT
{
memset(&v_, 0, sizeof(v_));
memcpy(&v_, &v, sizeof(value_type));
}
void store(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
storage_type tmp = 0;
storage_type tmp;
memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp, &v, sizeof(value_type));
__atomic_store_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
}
@ -980,7 +982,8 @@ public:
value_type exchange(value_type const& v, memory_order order = memory_order_seq_cst) volatile BOOST_NOEXCEPT
{
storage_type tmp = 0;
storage_type tmp;
memset(&tmp, 0, sizeof(tmp));
memcpy(&tmp, &v, sizeof(value_type));
tmp = __atomic_exchange_n(&v_, tmp, atomics::detail::convert_memory_order_to_gcc(order));
value_type res;
@ -994,7 +997,9 @@ public:
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
storage_type expected_s = 0, desired_s = 0;
storage_type expected_s, desired_s;
memset(&expected_s, 0, sizeof(expected_s));
memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, false,
@ -1010,7 +1015,9 @@ public:
memory_order success_order,
memory_order failure_order) volatile BOOST_NOEXCEPT
{
storage_type expected_s = 0, desired_s = 0;
storage_type expected_s, desired_s;
memset(&expected_s, 0, sizeof(expected_s));
memset(&desired_s, 0, sizeof(desired_s));
memcpy(&expected_s, &expected, sizeof(value_type));
memcpy(&desired_s, &desired, sizeof(value_type));
const bool success = __atomic_compare_exchange_n(&v_, &expected_s, desired_s, true,