diff options
author | Tobias Markmann <tm@ayena.de> | 2014-10-19 20:22:58 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2014-10-20 13:49:33 (GMT) |
commit | 6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch) | |
tree | 2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/archive/detail | |
parent | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff) | |
download | swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2 |
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0.
Updated our update.sh script to stop on error.
Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to
missing include of <iostream> with newer Boost.
Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/archive/detail')
22 files changed, 298 insertions, 169 deletions
diff --git a/3rdParty/Boost/src/boost/archive/detail/archive_serializer_map.hpp b/3rdParty/Boost/src/boost/archive/detail/archive_serializer_map.hpp index 6d2eec4..53fcae4 100644 --- a/3rdParty/Boost/src/boost/archive/detail/archive_serializer_map.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/archive_serializer_map.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_SERIALIZER_MAP_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/auto_link_archive.hpp b/3rdParty/Boost/src/boost/archive/detail/auto_link_archive.hpp index 05956f0..79b0e49 100644 --- a/3rdParty/Boost/src/boost/archive/detail/auto_link_archive.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/auto_link_archive.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/auto_link_warchive.hpp b/3rdParty/Boost/src/boost/archive/detail/auto_link_warchive.hpp index 4d4efcd..683d191 100644 --- a/3rdParty/Boost/src/boost/archive/detail/auto_link_warchive.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/auto_link_warchive.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/basic_iarchive.hpp b/3rdParty/Boost/src/boost/archive/detail/basic_iarchive.hpp index f62987e..fdafbbf 100644 --- a/3rdParty/Boost/src/boost/archive/detail/basic_iarchive.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/basic_iarchive.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif @@ -22,10 +22,10 @@ #include <boost/config.hpp> #include <boost/noncopyable.hpp> -#include <boost/type_traits/broken_compiler_spec.hpp> #include <boost/serialization/tracking_enum.hpp> #include <boost/archive/basic_archive.hpp> #include <boost/archive/detail/decl.hpp> +#include <boost/archive/detail/helper_collection.hpp> #include <boost/archive/detail/abi_prefix.hpp> // must be the last header namespace boost { @@ -42,7 +42,8 @@ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer; ////////////////////////////////////////////////////////////////////// // class basic_iarchive - read serialized objects from a input stream class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive : - private boost::noncopyable + private boost::noncopyable, + public boost::archive::detail::helper_collection { friend class basic_iarchive_impl; // hide implementation of this class to minimize header conclusion @@ -99,12 +100,6 @@ public: } // namespace archive } // namespace boost -// required by smart_cast for compilers not implementing -// partial template specialization -BOOST_TT_BROKEN_COMPILER_SPEC( - boost::archive::detail::basic_iarchive -) - #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas #endif //BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP diff --git a/3rdParty/Boost/src/boost/archive/detail/basic_iserializer.hpp b/3rdParty/Boost/src/boost/archive/detail/basic_iserializer.hpp index 2f4f6d8..3bff3e1 100644 --- a/3rdParty/Boost/src/boost/archive/detail/basic_iserializer.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/basic_iserializer.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/basic_oarchive.hpp b/3rdParty/Boost/src/boost/archive/detail/basic_oarchive.hpp index 402e569..f65d110 100644 --- a/3rdParty/Boost/src/boost/archive/detail/basic_oarchive.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/basic_oarchive.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_BASIC_OARCHIVE_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif @@ -20,14 +20,12 @@ #include <boost/config.hpp> #include <boost/noncopyable.hpp> -#include <boost/type_traits/broken_compiler_spec.hpp> - // can't use this - much as I'd like to as borland doesn't support it // #include <boost/scoped_ptr.hpp> #include <boost/archive/basic_archive.hpp> #include <boost/serialization/tracking_enum.hpp> - +#include <boost/archive/detail/helper_collection.hpp> #include <boost/archive/detail/abi_prefix.hpp> // must be the last header namespace boost { @@ -41,10 +39,12 @@ namespace detail { class basic_oarchive_impl; class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer; class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer; + ////////////////////////////////////////////////////////////////////// // class basic_oarchive - write serialized objects to an output stream class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive : - private boost::noncopyable + private boost::noncopyable, + public boost::archive::detail::helper_collection { friend class basic_oarchive_impl; // hide implementation of this class to minimize header conclusion @@ -95,12 +95,6 @@ public: } // namespace archive } // namespace boost -// required by smart_cast for compilers not implementing -// partial template specialization -BOOST_TT_BROKEN_COMPILER_SPEC( - boost::archive::detail::basic_oarchive -) - #include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas #endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP diff --git a/3rdParty/Boost/src/boost/archive/detail/basic_oserializer.hpp b/3rdParty/Boost/src/boost/archive/detail/basic_oserializer.hpp index 74af7e6..6ae063f 100644 --- a/3rdParty/Boost/src/boost/archive/detail/basic_oserializer.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/basic_oserializer.hpp @@ -2,7 +2,7 @@ #define BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/basic_pointer_iserializer.hpp b/3rdParty/Boost/src/boost/archive/detail/basic_pointer_iserializer.hpp index d957b83..86badc1 100644 --- a/3rdParty/Boost/src/boost/archive/detail/basic_pointer_iserializer.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/basic_pointer_iserializer.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif @@ -52,10 +52,11 @@ protected: #endif ~basic_pointer_iserializer(); public: + virtual void * heap_allocation() const = 0; virtual const basic_iserializer & get_basic_serializer() const = 0; virtual void load_object_ptr( basic_iarchive & ar, - void * & x, + void * x, const unsigned int file_version ) const = 0; }; diff --git a/3rdParty/Boost/src/boost/archive/detail/basic_pointer_oserializer.hpp b/3rdParty/Boost/src/boost/archive/detail/basic_pointer_oserializer.hpp index b0d3fb9..bafc46a 100644 --- a/3rdParty/Boost/src/boost/archive/detail/basic_pointer_oserializer.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/basic_pointer_oserializer.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/basic_serializer.hpp b/3rdParty/Boost/src/boost/archive/detail/basic_serializer.hpp index 5dbd886..c7d3b4b 100644 --- a/3rdParty/Boost/src/boost/archive/detail/basic_serializer.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/basic_serializer.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_BASIC_SERIALIZER_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/basic_serializer_map.hpp b/3rdParty/Boost/src/boost/archive/detail/basic_serializer_map.hpp index a991ea1..202c20e 100644 --- a/3rdParty/Boost/src/boost/archive/detail/basic_serializer_map.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/basic_serializer_map.hpp @@ -2,7 +2,7 @@ #define BOOST_SERIALIZER_MAP_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/check.hpp b/3rdParty/Boost/src/boost/archive/detail/check.hpp index c9cba51..10034e7 100644 --- a/3rdParty/Boost/src/boost/archive/detail/check.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/check.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_CHECK_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #pragma inline_depth(511) #pragma inline_recursion(on) @@ -50,7 +50,7 @@ namespace detail { template<class T> inline void check_object_level(){ typedef - BOOST_DEDUCED_TYPENAME mpl::greater_equal< + typename mpl::greater_equal< serialization::implementation_level< T >, mpl::int_<serialization::primitive_type> >::type typex; @@ -63,12 +63,12 @@ inline void check_object_level(){ template<class T> inline void check_object_versioning(){ typedef - BOOST_DEDUCED_TYPENAME mpl::or_< - BOOST_DEDUCED_TYPENAME mpl::greater< + typename mpl::or_< + typename mpl::greater< serialization::implementation_level< T >, mpl::int_<serialization::object_serializable> >, - BOOST_DEDUCED_TYPENAME mpl::equal_to< + typename mpl::equal_to< serialization::version< T >, mpl::int_<0> > @@ -83,7 +83,7 @@ inline void check_object_tracking(){ // presume it has already been determined that // T is not a const BOOST_STATIC_ASSERT(! boost::is_const< T >::value); - typedef BOOST_DEDUCED_TYPENAME mpl::equal_to< + typedef typename mpl::equal_to< serialization::tracking_level< T >, mpl::int_<serialization::track_never> >::type typex; @@ -105,13 +105,13 @@ inline void check_pointer_level(){ // we should only invoke this once we KNOW that T // has been used as a pointer!! typedef - BOOST_DEDUCED_TYPENAME mpl::or_< - BOOST_DEDUCED_TYPENAME mpl::greater< + typename mpl::or_< + typename mpl::greater< serialization::implementation_level< T >, mpl::int_<serialization::object_serializable> >, - BOOST_DEDUCED_TYPENAME mpl::not_< - BOOST_DEDUCED_TYPENAME mpl::equal_to< + typename mpl::not_< + typename mpl::equal_to< serialization::tracking_level< T >, mpl::int_<serialization::track_selectively> > @@ -139,7 +139,7 @@ inline void check_pointer_level(){ template<class T> void inline check_pointer_tracking(){ - typedef BOOST_DEDUCED_TYPENAME mpl::greater< + typedef typename mpl::greater< serialization::tracking_level< T >, mpl::int_<serialization::track_never> >::type typex; @@ -151,10 +151,10 @@ void inline check_pointer_tracking(){ template<class T> inline void check_const_loading(){ typedef - BOOST_DEDUCED_TYPENAME mpl::or_< - BOOST_DEDUCED_TYPENAME boost::serialization::is_wrapper< T >, - BOOST_DEDUCED_TYPENAME mpl::not_< - BOOST_DEDUCED_TYPENAME boost::is_const< T > + typename mpl::or_< + typename boost::serialization::is_wrapper< T >, + typename mpl::not_< + typename boost::is_const< T > > >::type typex; // cannot load data into a "const" object unless it's a diff --git a/3rdParty/Boost/src/boost/archive/detail/common_iarchive.hpp b/3rdParty/Boost/src/boost/archive/detail/common_iarchive.hpp index 54c07c3..45e6d34 100644 --- a/3rdParty/Boost/src/boost/archive/detail/common_iarchive.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/common_iarchive.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/common_oarchive.hpp b/3rdParty/Boost/src/boost/archive/detail/common_oarchive.hpp index 7962063..0d7474b 100644 --- a/3rdParty/Boost/src/boost/archive/detail/common_oarchive.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/common_oarchive.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/decl.hpp b/3rdParty/Boost/src/boost/archive/detail/decl.hpp index 9695001..44e22be 100644 --- a/3rdParty/Boost/src/boost/archive/detail/decl.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/decl.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_DECL_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/helper_collection.hpp b/3rdParty/Boost/src/boost/archive/detail/helper_collection.hpp new file mode 100644 index 0000000..ba3c60c --- /dev/null +++ b/3rdParty/Boost/src/boost/archive/detail/helper_collection.hpp @@ -0,0 +1,111 @@ +#ifndef BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP +#define BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// helper_collection.hpp: archive support for run-time helpers + +// (C) Copyright 2002-2008 Robert Ramey and Joaquin M Lopez Munoz +// 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) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include <cstddef> // NULL +#include <typeinfo> +#include <vector> +#include <utility> +#include <memory> +#include <algorithm> + +#include <boost/config.hpp> + +#ifdef BOOST_NO_CXX11_SMART_PTR + #include <boost/smart_ptr/shared_ptr.hpp> + #include <boost/smart_ptr/make_shared.hpp> +#endif + +namespace boost { + +namespace archive { +namespace detail { + +class helper_collection +{ + helper_collection(const helper_collection&); // non-copyable + helper_collection& operator = (const helper_collection&); // non-copyable + + // note: we dont' actually "share" the function object pointer + // we only use shared_ptr to make sure that it get's deleted + + #ifndef BOOST_NO_CXX11_SMART_PTR + typedef std::pair< + const std::type_info *, + std::shared_ptr<void> + > helper_value_type; + template<class T> + std::shared_ptr<void> make_helper_ptr(){ + return std::make_shared<T>(); + } + #else + typedef std::pair< + const std::type_info *, + boost::shared_ptr<void> + > helper_value_type; + template<class T> + boost::shared_ptr<void> make_helper_ptr(){ + return boost::make_shared<T>(); + } + #endif + typedef std::vector<helper_value_type> collection; + collection m_collection; + + struct predicate { + const std::type_info * m_ti; + bool operator()(helper_value_type const &rhs) const { + return *m_ti == *rhs.first; + } + predicate(const std::type_info * ti) : + m_ti(ti) + {} + }; +protected: + helper_collection(){} + ~helper_collection(){} +public: + template<typename Helper> + Helper& get_helper(Helper * = NULL) { + + const std::type_info * eti = & typeid(Helper); + + collection::const_iterator it = + std::find_if( + m_collection.begin(), + m_collection.end(), + predicate(eti) + ); + + void * rval; + if(it == m_collection.end()){ + m_collection.push_back( + std::make_pair(eti, make_helper_ptr<Helper>()) + ); + rval = m_collection.back().second.get(); + } + else{ + rval = it->second.get(); + } + return *static_cast<Helper *>(rval); + } +}; + +} // namespace detail +} // namespace serialization +} // namespace boost + +#endif // BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP diff --git a/3rdParty/Boost/src/boost/archive/detail/interface_iarchive.hpp b/3rdParty/Boost/src/boost/archive/detail/interface_iarchive.hpp index 0648752..b7bd165 100644 --- a/3rdParty/Boost/src/boost/archive/detail/interface_iarchive.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/interface_iarchive.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/interface_oarchive.hpp b/3rdParty/Boost/src/boost/archive/detail/interface_oarchive.hpp index e8db7a2..7ae7176 100644 --- a/3rdParty/Boost/src/boost/archive/detail/interface_oarchive.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/interface_oarchive.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #endif diff --git a/3rdParty/Boost/src/boost/archive/detail/iserializer.hpp b/3rdParty/Boost/src/boost/archive/detail/iserializer.hpp index 53765af..cf547de 100644 --- a/3rdParty/Boost/src/boost/archive/detail/iserializer.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/iserializer.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #pragma inline_depth(511) #pragma inline_recursion(on) @@ -23,7 +23,6 @@ // See http://www.boost.org for updates, documentation, and revision history. #include <new> // for placement new -#include <memory> // for auto_ptr #include <cstddef> // size_t, NULL #include <boost/config.hpp> @@ -59,14 +58,11 @@ namespace std{ #include <boost/serialization/assume_abstract.hpp> -#define DONT_USE_HAS_NEW_OPERATOR ( \ +#if ! ( \ defined(__BORLANDC__) \ || BOOST_WORKAROUND(__IBMCPP__, < 1210) \ - || defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) \ || defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \ ) - -#if ! DONT_USE_HAS_NEW_OPERATOR #include <boost/type_traits/has_new_operator.hpp> #endif @@ -127,7 +123,7 @@ protected: explicit iserializer() : basic_iserializer( boost::serialization::singleton< - BOOST_DEDUCED_TYPENAME + typename boost::serialization::type_info_implementation< T >::type >::get_const_instance() ) @@ -197,85 +193,84 @@ BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data( # pragma warning(disable : 4511 4512) #endif -template<class Archive, class T> -class pointer_iserializer : - public basic_pointer_iserializer -{ -private: - virtual const basic_iserializer & get_basic_serializer() const { - return boost::serialization::singleton< - iserializer<Archive, T> - >::get_const_instance(); - } - BOOST_DLLEXPORT virtual void load_object_ptr( - basic_iarchive & ar, - void * & x, - const unsigned int file_version - ) const BOOST_USED; -protected: - // this should alway be a singleton so make the constructor protected - pointer_iserializer(); - ~pointer_iserializer(); -}; - -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif - -// note trick to be sure that operator new is using class specific -// version if such exists. Due to Peter Dimov. -// note: the following fails if T has no default constructor. -// otherwise it would have been ideal -//struct heap_allocator : public T -//{ -// T * invoke(){ -// return ::new(sizeof(T)); -// } -//} +// the purpose of this code is to allocate memory for an object +// without requiring the constructor to be called. Presumably +// the allocated object will be subsequently initialized with +// "placement new". +// note: we have the boost type trait has_new_operator but we +// have no corresponding has_delete_operator. So we presume +// that the former being true would imply that the a delete +// operator is also defined for the class T. template<class T> -struct heap_allocator -{ +struct heap_allocation { // boost::has_new_operator< T > doesn't work on these compilers #if DONT_USE_HAS_NEW_OPERATOR // This doesn't handle operator new overload for class T - static T * invoke(){ + static T * invoke_new(){ return static_cast<T *>(operator new(sizeof(T))); } + static viod invoke_delete(){ + (operator delete(sizeof(T))); + } #else + // note: we presume that a true value for has_new_operator + // implies the existence of a class specific delete operator as well + // as a class specific new operator. struct has_new_operator { - static T* invoke() { + static T * invoke_new() { return static_cast<T *>((T::operator new)(sizeof(T))); } + static void invoke_delete(T * t) { + // if compilation fails here, the likely cause that the class + // T has a class specific new operator but no class specific + // delete operator which matches the following signature. Fix + // your program to have this. Note that adding operator delete + // with only one parameter doesn't seem correct to me since + // the standard(3.7.4.2) says " + // "If a class T has a member deallocation function named + // 'operator delete' with exactly one parameter, then that function + // is a usual (non-placement) deallocation function" which I take + // to mean that it will call the destructor of type T which we don't + // want to do here. + // Note: reliance upon automatic conversion from T * to void * here + (T::operator delete)(t, sizeof(T)); + } }; struct doesnt_have_new_operator { - static T* invoke() { + static T* invoke_new() { return static_cast<T *>(operator new(sizeof(T))); } + static void invoke_delete(T * t) { + // Note: I'm reliance upon automatic conversion from T * to void * here + (operator delete)(t); + } }; - static T * invoke() { - typedef BOOST_DEDUCED_TYPENAME + static T * invoke_new() { + typedef typename mpl::eval_if< boost::has_new_operator< T >, mpl::identity<has_new_operator >, mpl::identity<doesnt_have_new_operator > >::type typex; - return typex::invoke(); + return typex::invoke_new(); + } + static void invoke_delete(T *t) { + typedef typename + mpl::eval_if< + boost::has_new_operator< T >, + mpl::identity<has_new_operator >, + mpl::identity<doesnt_have_new_operator > + >::type typex; + typex::invoke_delete(t); } #endif -}; - -// due to Martin Ecker -template <typename T> -class auto_ptr_with_deleter -{ -public: - explicit auto_ptr_with_deleter(T* p) : - m_p(p) - {} - ~auto_ptr_with_deleter(){ - if (m_p) - boost::serialization::access::destroy(m_p); + explicit heap_allocation(){ + m_p = invoke_new(); + } + ~heap_allocation(){ + if (0 != m_p) + invoke_delete(m_p); } T* get() const { return m_p; @@ -283,60 +278,88 @@ public: T* release() { T* p = m_p; - m_p = NULL; + m_p = 0; return p; } private: T* m_p; }; +template<class Archive, class T> +class pointer_iserializer : + public basic_pointer_iserializer +{ +private: + virtual void * heap_allocation() const { + detail::heap_allocation<T> h; + T * t = h.get(); + h.release(); + return t; + } + virtual const basic_iserializer & get_basic_serializer() const { + return boost::serialization::singleton< + iserializer<Archive, T> + >::get_const_instance(); + } + BOOST_DLLEXPORT virtual void load_object_ptr( + basic_iarchive & ar, + void * x, + const unsigned int file_version + ) const BOOST_USED; +protected: + // this should alway be a singleton so make the constructor protected + pointer_iserializer(); + ~pointer_iserializer(); +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + // note: BOOST_DLLEXPORT is so that code for polymorphic class // serialized only through base class won't get optimized out template<class Archive, class T> BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr( basic_iarchive & ar, - void * & x, + void * t, const unsigned int file_version ) const { Archive & ar_impl = boost::serialization::smart_cast_reference<Archive &>(ar); - auto_ptr_with_deleter< T > ap(heap_allocator< T >::invoke()); - if(NULL == ap.get()) - boost::serialization::throw_exception(std::bad_alloc()) ; - - T * t = ap.get(); - x = t; + // note that the above will throw std::bad_alloc if the allocation + // fails so we don't have to address this contingency here. // catch exception during load_construct_data so that we don't // automatically delete the t which is most likely not fully // constructed BOOST_TRY { - // this addresses an obscure situtation that occurs when + // this addresses an obscure situation that occurs when // load_constructor de-serializes something through a pointer. ar.next_object_pointer(t); boost::serialization::load_construct_data_adl<Archive, T>( ar_impl, - t, + static_cast<T *>(t), file_version ); } BOOST_CATCH(...){ - ap.release(); + // if we get here the load_construct failed. The heap_allocation + // will be automatically deleted so we don't have to do anything + // special here. BOOST_RETHROW; } BOOST_CATCH_END - ar_impl >> boost::serialization::make_nvp(NULL, * t); - ap.release(); + ar_impl >> boost::serialization::make_nvp(NULL, * static_cast<T *>(t)); } template<class Archive, class T> pointer_iserializer<Archive, T>::pointer_iserializer() : basic_pointer_iserializer( boost::serialization::singleton< - BOOST_DEDUCED_TYPENAME + typename boost::serialization::type_info_implementation< T >::type >::get_const_instance() ) @@ -405,7 +428,7 @@ struct load_non_pointer_type { template<class T> static void invoke(Archive & ar, T &t){ - typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + typedef typename mpl::eval_if< // if its primitive mpl::equal_to< boost::serialization::implementation_level< T >, @@ -413,7 +436,7 @@ struct load_non_pointer_type { >, mpl::identity<load_primitive>, // else - BOOST_DEDUCED_TYPENAME mpl::eval_if< + typename mpl::eval_if< // class info / version mpl::greater_equal< boost::serialization::implementation_level< T >, @@ -422,7 +445,7 @@ struct load_non_pointer_type { // do standard load mpl::identity<load_standard>, // else - BOOST_DEDUCED_TYPENAME mpl::eval_if< + typename mpl::eval_if< // no tracking mpl::equal_to< boost::serialization::tracking_level< T >, @@ -466,7 +489,7 @@ struct load_pointer_type { // class pointer. Inhibiting code generation for this // permits abstract base classes to be used - note: exception // virtual serialize functions used for plug-ins - typedef BOOST_DEDUCED_TYPENAME + typedef typename mpl::eval_if< boost::serialization::is_abstract<const T>, boost::mpl::identity<abstract>, @@ -482,18 +505,21 @@ struct load_pointer_type { const T & ) { // tweak the pointer back to the base class - return static_cast<T *>( - const_cast<void *>( - boost::serialization::void_upcast( - eti, - boost::serialization::singleton< - BOOST_DEDUCED_TYPENAME - boost::serialization::type_info_implementation< T >::type - >::get_const_instance(), - t - ) + void * upcast = const_cast<void *>( + boost::serialization::void_upcast( + eti, + boost::serialization::singleton< + typename + boost::serialization::type_info_implementation< T >::type + >::get_const_instance(), + t ) ); + if(NULL == upcast) + boost::serialization::throw_exception( + archive_exception(archive_exception::unregistered_class) + ); + return static_cast<T *>(upcast); } template<class T> @@ -544,7 +570,7 @@ template<class Archive> struct load_array_type { template<class T> static void invoke(Archive &ar, T &t){ - typedef BOOST_DEDUCED_TYPENAME remove_extent< T >::type value_type; + typedef typename remove_extent< T >::type value_type; // convert integers to correct enum to load // determine number of elements in the array. Consider the @@ -576,13 +602,13 @@ inline void load(Archive & ar, T &t){ // handled below. detail::check_const_loading< T >(); typedef - BOOST_DEDUCED_TYPENAME mpl::eval_if<is_pointer< T >, + typename mpl::eval_if<is_pointer< T >, mpl::identity<detail::load_pointer_type<Archive> > ,//else - BOOST_DEDUCED_TYPENAME mpl::eval_if<is_array< T >, + typename mpl::eval_if<is_array< T >, mpl::identity<detail::load_array_type<Archive> > ,//else - BOOST_DEDUCED_TYPENAME mpl::eval_if<is_enum< T >, + typename mpl::eval_if<is_enum< T >, mpl::identity<detail::load_enum_type<Archive> > ,//else mpl::identity<detail::load_non_pointer_type<Archive> > diff --git a/3rdParty/Boost/src/boost/archive/detail/oserializer.hpp b/3rdParty/Boost/src/boost/archive/detail/oserializer.hpp index 7d2694d..7a7e239 100644 --- a/3rdParty/Boost/src/boost/archive/detail/oserializer.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/oserializer.hpp @@ -2,7 +2,7 @@ #define BOOST_ARCHIVE_OSERIALIZER_HPP // MS compatible compilers support #pragma once -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) # pragma once #pragma inline_depth(511) #pragma inline_recursion(on) @@ -106,7 +106,7 @@ public: explicit BOOST_DLLEXPORT oserializer() : basic_oserializer( boost::serialization::singleton< - BOOST_DEDUCED_TYPENAME + typename boost::serialization::type_info_implementation< T >::type >::get_const_instance() ) @@ -205,7 +205,7 @@ template<class Archive, class T> pointer_oserializer<Archive, T>::pointer_oserializer() : basic_pointer_oserializer( boost::serialization::singleton< - BOOST_DEDUCED_TYPENAME + typename boost::serialization::type_info_implementation< T >::type >::get_const_instance() ) @@ -275,7 +275,7 @@ struct save_non_pointer_type { template<class T> static void invoke(Archive & ar, const T & t){ typedef - BOOST_DEDUCED_TYPENAME mpl::eval_if< + typename mpl::eval_if< // if its primitive mpl::equal_to< boost::serialization::implementation_level< T >, @@ -283,7 +283,7 @@ struct save_non_pointer_type { >, mpl::identity<save_primitive>, // else - BOOST_DEDUCED_TYPENAME mpl::eval_if< + typename mpl::eval_if< // class info / version mpl::greater_equal< boost::serialization::implementation_level< T >, @@ -292,7 +292,7 @@ struct save_non_pointer_type { // do standard save mpl::identity<save_standard>, // else - BOOST_DEDUCED_TYPENAME mpl::eval_if< + typename mpl::eval_if< // no tracking mpl::equal_to< boost::serialization::tracking_level< T >, @@ -342,7 +342,7 @@ struct save_pointer_type { // permits abstract base classes to be used - note: exception // virtual serialize functions used for plug-ins typedef - BOOST_DEDUCED_TYPENAME mpl::eval_if< + typename mpl::eval_if< boost::serialization::is_abstract< T >, mpl::identity<abstract>, mpl::identity<non_abstract> @@ -373,10 +373,10 @@ struct save_pointer_type { Archive &ar, T & t ){ - BOOST_DEDUCED_TYPENAME + typename boost::serialization::type_info_implementation< T >::type const & i = boost::serialization::singleton< - BOOST_DEDUCED_TYPENAME + typename boost::serialization::type_info_implementation< T >::type >::get_const_instance(); @@ -452,7 +452,7 @@ struct save_pointer_type { ){ check_pointer_level< T >(); check_pointer_tracking< T >(); - typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< + typedef typename mpl::eval_if< is_polymorphic< T >, mpl::identity<polymorphic>, mpl::identity<non_polymorphic> @@ -490,7 +490,7 @@ struct save_array_type { template<class T> static void invoke(Archive &ar, const T &t){ - typedef BOOST_DEDUCED_TYPENAME boost::remove_extent< T >::type value_type; + typedef typename boost::remove_extent< T >::type value_type; save_access::end_preamble(ar); // consider alignment @@ -509,13 +509,13 @@ struct save_array_type template<class Archive, class T> inline void save(Archive & ar, /*const*/ T &t){ typedef - BOOST_DEDUCED_TYPENAME mpl::eval_if<is_pointer< T >, + typename mpl::eval_if<is_pointer< T >, mpl::identity<detail::save_pointer_type<Archive> >, //else - BOOST_DEDUCED_TYPENAME mpl::eval_if<is_enum< T >, + typename mpl::eval_if<is_enum< T >, mpl::identity<detail::save_enum_type<Archive> >, //else - BOOST_DEDUCED_TYPENAME mpl::eval_if<is_array< T >, + typename mpl::eval_if<is_array< T >, mpl::identity<detail::save_array_type<Archive> >, //else mpl::identity<detail::save_non_pointer_type<Archive> > diff --git a/3rdParty/Boost/src/boost/archive/detail/register_archive.hpp b/3rdParty/Boost/src/boost/archive/detail/register_archive.hpp index e31ae46..81a19b9 100644 --- a/3rdParty/Boost/src/boost/archive/detail/register_archive.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/register_archive.hpp @@ -81,7 +81,7 @@ void instantiate_ptr_serialization(Serializable*, int, adl_tag ) {} namespace boost { namespace archive { namespace detail { \ \ template <class Serializable> \ -BOOST_DEDUCED_TYPENAME _ptr_serialization_support<Archive, Serializable>::type \ +typename _ptr_serialization_support<Archive, Serializable>::type \ instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \ \ }}} diff --git a/3rdParty/Boost/src/boost/archive/detail/utf8_codecvt_facet.hpp b/3rdParty/Boost/src/boost/archive/detail/utf8_codecvt_facet.hpp index bd859ff..b2430d5 100644 --- a/3rdParty/Boost/src/boost/archive/detail/utf8_codecvt_facet.hpp +++ b/3rdParty/Boost/src/boost/archive/detail/utf8_codecvt_facet.hpp @@ -7,15 +7,17 @@ #ifndef BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP #define BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP -#define BOOST_UTF8_BEGIN_NAMESPACE \ - namespace boost { namespace archive { namespace detail { -#define BOOST_UTF8_DECL -#define BOOST_UTF8_END_NAMESPACE }}} +#ifdef BOOST_NO_CXX11_HDR_CODECVT + #define BOOST_UTF8_BEGIN_NAMESPACE \ + namespace boost { namespace archive { namespace detail { + #define BOOST_UTF8_DECL + #define BOOST_UTF8_END_NAMESPACE }}} -#include <boost/detail/utf8_codecvt_facet.hpp> - -#undef BOOST_UTF8_END_NAMESPACE -#undef BOOST_UTF8_DECL -#undef BOOST_UTF8_BEGIN_NAMESPACE + #include <boost/detail/utf8_codecvt_facet.hpp> + #undef BOOST_UTF8_END_NAMESPACE + #undef BOOST_UTF8_DECL + #undef BOOST_UTF8_BEGIN_NAMESPACE +#endif // BOOST_NO_CXX11_HDR_CODECVT #endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP + |