mirror of
https://github.com/boostorg/optional.git
synced 2025-07-30 20:47:18 +02:00
Use BOOST_MAY_ALIAS from Boost.Config.
This commit is contained in:
committed by
Andrzej Krzemienski
parent
61bf382ffa
commit
7e1beb473c
@ -25,12 +25,8 @@ template <class T>
|
|||||||
class aligned_storage
|
class aligned_storage
|
||||||
{
|
{
|
||||||
// Borland ICEs if unnamed unions are used for this!
|
// Borland ICEs if unnamed unions are used for this!
|
||||||
union
|
// BOOST_MAY_ALIAS works around GCC warnings about breaking strict aliasing rules when casting storage address to T*
|
||||||
// This works around GCC warnings about breaking strict aliasing rules when casting storage address to T*
|
union BOOST_MAY_ALIAS dummy_u
|
||||||
#if defined(BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS)
|
|
||||||
__attribute__((__may_alias__))
|
|
||||||
#endif
|
|
||||||
dummy_u
|
|
||||||
{
|
{
|
||||||
char data[ sizeof(T) ];
|
char data[ sizeof(T) ];
|
||||||
BOOST_DEDUCED_TYPENAME type_with_alignment<
|
BOOST_DEDUCED_TYPENAME type_with_alignment<
|
||||||
|
@ -44,11 +44,11 @@
|
|||||||
# define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
|
# define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
#if !defined(BOOST_NO_MAY_ALIAS)
|
||||||
// GCC since 3.3 has may_alias attribute that helps to alleviate optimizer issues with
|
// GCC since 3.3 and some other compilers have may_alias attribute that helps to alleviate
|
||||||
// regard to violation of the strict aliasing rules. The optional< T > storage type is marked
|
// optimizer issues with regard to violation of the strict aliasing rules. The optional< T >
|
||||||
// with this attribute in order to let the compiler know that it will alias objects of type T
|
// storage type is marked with this attribute in order to let the compiler know that it will
|
||||||
// and silence compilation warnings.
|
// alias objects of type T and silence compilation warnings.
|
||||||
# define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS
|
# define BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user