diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-10-18 16:09:04 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-10-18 16:10:35 +0100 |
commit | 947c04111a1371955f6fee367d3dd6828a887b60 (patch) | |
tree | acd6750091bba9e895c1a8f9980411b19b0a3917 /boost | |
parent | aab450ec4f45bf703cd84972b724852f08f06a84 (diff) |
#i113177# remove strict-aliasing warning from boost headers
Diffstat (limited to 'boost')
-rw-r--r-- | boost/aliasing.patch | 57 | ||||
-rw-r--r-- | boost/makefile.mk | 2 |
2 files changed, 59 insertions, 0 deletions
diff --git a/boost/aliasing.patch b/boost/aliasing.patch new file mode 100644 index 000000000000..ce6baaf0dbe4 --- /dev/null +++ b/boost/aliasing.patch @@ -0,0 +1,57 @@ +--- misc/boost_1_43_0/boost/function/function_base.hpp ++++ misc/build/boost_1_43_0/boost/function/function_base.hpp +@@ -2,6 +2,7 @@ + + // Copyright Douglas Gregor 2001-2006 + // Copyright Emil Dotchevski 2007 ++// Copyright Dean Michael Berris 2009 + // Use, modification and distribution is subject to the Boost Software License, Version 1.0. + // (See accompanying file LICENSE_1_0.txt or copy at + // http://www.boost.org/LICENSE_1_0.txt) +@@ -44,6 +45,13 @@ + # pragma warning( disable : 4127 ) // "conditional expression is constant" + #endif + ++#if defined(__GNUC__) ++// Because GCC complains of strict aliasing problems, we make it ++// treat the header as a system header, becoming more forgiving with ++// treating implementation details that may be potentially harmful. ++# pragma GCC system_header ++#endif ++ + // Define BOOST_FUNCTION_STD_NS to the namespace that contains type_info. + #ifdef BOOST_NO_STD_TYPEINFO + // Embedded VC++ does not have type_info in namespace std +@@ -314,15 +322,15 @@ + { + if (op == clone_functor_tag || op == move_functor_tag) { + const functor_type* in_functor = +- reinterpret_cast<const functor_type*>(&in_buffer.data); ++ static_cast<const functor_type*>(static_cast<void*>(&in_buffer.data)); + new ((void*)&out_buffer.data) functor_type(*in_functor); + + if (op == move_functor_tag) { +- reinterpret_cast<functor_type*>(&in_buffer.data)->~Functor(); ++ static_cast<functor_type*>(static_cast<void*>(&in_buffer.data))->~Functor(); + } + } else if (op == destroy_functor_tag) { + // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. +- reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor(); ++ static_cast<functor_type*>(static_cast<void*>(&out_buffer.data))->~Functor(); + } else if (op == check_functor_type_tag) { + const detail::sp_typeinfo& check_type + = *out_buffer.type.type; +@@ -714,8 +722,11 @@ + + public: // should be protected, but GCC 2.95.3 will fail to allow access + detail::function::vtable_base* get_vtable() const { +- return reinterpret_cast<detail::function::vtable_base*>( +- reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01); ++ return static_cast<detail::function::vtable_base*>( ++ (void*)( ++ (std::size_t(static_cast<void*>(vtable)) & ~(std::size_t(0x01))) ++ ) ++ ); + } + + bool has_trivial_copy_and_destroy() const { diff --git a/boost/makefile.mk b/boost/makefile.mk index 1f430d7045db..8602cf9a07c4 100644 --- a/boost/makefile.mk +++ b/boost/makefile.mk @@ -51,6 +51,8 @@ all: TARFILE_NAME=boost_1_39_0 TARFILE_MD5=fcc6df1160753d0b8c835d17fdeeb0a7 PATCH_FILES=$(TARFILE_NAME).patch +# See https://svn.boost.org/trac/boost/ticket/3780 +PATCH_FILES+=aliasing.patch #https://svn.boost.org/trac/boost/ticket/4713 PATCH_FILES+=boost.4713.warnings.patch |