mirror of
https://github.com/boostorg/container.git
synced 2025-08-02 05:54:28 +02:00
Disable -Wstrict-aliasing as GCC-7 incorrectly flags it in release mode (aligned storage holds the type we want).
This commit is contained in:
@@ -449,19 +449,21 @@ BOOST_CONTAINER_FORCEINLINE typename small_vector_allocator<T, VoidAlloc, Option
|
|||||||
typedef small_vector_storage_strawman<T, allocator_type, Options> strawman_t;
|
typedef small_vector_storage_strawman<T, allocator_type, Options> strawman_t;
|
||||||
typedef typename strawman_t::sm_storage_t sm_storage_t;
|
typedef typename strawman_t::sm_storage_t sm_storage_t;
|
||||||
|
|
||||||
|
//These warnings are false positives, as we know the alignment is correct
|
||||||
|
//and aligned storage is allowed to hold any type
|
||||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||||
|
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||||
#endif
|
#endif
|
||||||
const vector_type& v = reinterpret_cast<const vector_type&>(*this);
|
const vector_type& v = reinterpret_cast<const vector_type&>(*this);
|
||||||
BOOST_ASSERT((std::size_t(this) % dtl::alignment_of<strawman_t>::value) == 0);
|
BOOST_ASSERT((std::size_t(this) % dtl::alignment_of<strawman_t>::value) == 0);
|
||||||
|
const strawman_t &straw = static_cast<const strawman_t&>(v);
|
||||||
|
const sm_storage_t& stor = static_cast<const sm_storage_t&>(straw);
|
||||||
|
return boost::intrusive::pointer_traits<const_pointer>::pointer_to(*((const T*)stor.m_storage.data));
|
||||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const strawman_t &straw = static_cast<const strawman_t&>(v);
|
|
||||||
const sm_storage_t& stor = static_cast<const sm_storage_t&>(straw);
|
|
||||||
return boost::intrusive::pointer_traits<pointer>::pointer_to(*((T*)&stor.m_storage));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T, class VoidAlloc, class Options>
|
template <class T, class VoidAlloc, class Options>
|
||||||
@@ -474,16 +476,16 @@ BOOST_CONTAINER_FORCEINLINE typename small_vector_allocator<T, VoidAlloc, Option
|
|||||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||||
|
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||||
#endif
|
#endif
|
||||||
vector_type& v = reinterpret_cast<vector_type&>(*this);
|
vector_type& v = reinterpret_cast<vector_type&>(*this);
|
||||||
BOOST_ASSERT((std::size_t(this) % dtl::alignment_of<strawman_t>::value) == 0);
|
BOOST_ASSERT((std::size_t(this) % dtl::alignment_of<strawman_t>::value) == 0);
|
||||||
|
strawman_t &straw = static_cast<strawman_t&>(v);
|
||||||
|
sm_storage_t& stor = static_cast<sm_storage_t&>(straw);
|
||||||
|
return boost::intrusive::pointer_traits<pointer>::pointer_to(*((T*)stor.m_storage.data));
|
||||||
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
strawman_t &straw = static_cast<strawman_t&>(v);
|
|
||||||
sm_storage_t& stor = static_cast<sm_storage_t&>(straw);
|
|
||||||
return boost::intrusive::pointer_traits<pointer>::pointer_to(*((T*)&stor.m_storage));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user