Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52107 - in branches/release/boost/archive: . detail impl iterators
From: ramey_at_[hidden]
Date: 2009-04-01 11:58:28


Author: ramey
Date: 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
New Revision: 52107
URL: http://svn.boost.org/trac/boost/changeset/52107

Log:
Merge changes from trunk to release
Text files modified:
   branches/release/boost/archive/archive_exception.hpp | 8 ++++
   branches/release/boost/archive/basic_binary_iprimitive.hpp | 4 +-
   branches/release/boost/archive/basic_binary_oprimitive.hpp | 2
   branches/release/boost/archive/basic_text_iprimitive.hpp | 11 +++---
   branches/release/boost/archive/basic_text_oprimitive.hpp | 1
   branches/release/boost/archive/basic_xml_iarchive.hpp | 4 +-
   branches/release/boost/archive/basic_xml_oarchive.hpp | 5 +-
   branches/release/boost/archive/codecvt_null.hpp | 7 ++++
   branches/release/boost/archive/detail/archive_pointer_iserializer.hpp | 2 +
   branches/release/boost/archive/detail/basic_oarchive.hpp | 2
   branches/release/boost/archive/detail/iserializer.hpp | 66 +++++++++++++++++++++++++--------------
   branches/release/boost/archive/detail/register_archive.hpp | 43 +++++++++++++++++++++++++
   branches/release/boost/archive/impl/basic_binary_oprimitive.ipp | 2
   branches/release/boost/archive/iterators/dataflow.hpp | 3 +
   branches/release/boost/archive/iterators/head_iterator.hpp | 6 +-
   branches/release/boost/archive/polymorphic_iarchive.hpp | 9 ++++-
   branches/release/boost/archive/polymorphic_oarchive.hpp | 9 ++++-
   branches/release/boost/archive/tmpdir.hpp | 6 +-
   branches/release/boost/archive/xml_archive_exception.hpp | 2
   19 files changed, 138 insertions(+), 54 deletions(-)

Modified: branches/release/boost/archive/archive_exception.hpp
==============================================================================
--- branches/release/boost/archive/archive_exception.hpp (original)
+++ branches/release/boost/archive/archive_exception.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -51,8 +51,11 @@
         invalid_class_name, // class name greater than the maximum permitted.
                             // most likely a corrupted archive or an attempt
                             // to insert virus via buffer overrun method.
- unregistered_cast // base - derived relationship not registered with
+ unregistered_cast, // base - derived relationship not registered with
                             // void_cast_register
+ unsupported_class_version // type saved with a version # greater than the
+ // one used by the program. This indicates that the proggram
+ // needs to be rebuilt.
     } exception_code;
     exception_code code;
     archive_exception(exception_code c) :
@@ -92,6 +95,9 @@
         case unregistered_cast:
             msg = "unregistered void cast";
             break;
+ case unsupported_class_version:
+ msg = "class version";
+ break;
         case other_exception:
             // if get here - it indicates a derived exception
             // was sliced by passing by value in catch

Modified: branches/release/boost/archive/basic_binary_iprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_binary_iprimitive.hpp (original)
+++ branches/release/boost/archive/basic_binary_iprimitive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -156,7 +156,7 @@
         static_cast<Elem *>(address),
         s
     );
- if(scount != static_cast<std::streamsize>(s))
+ if(scount != s)
         boost::serialization::throw_exception(
             archive_exception(archive_exception::stream_error)
         );
@@ -180,6 +180,6 @@
 } // namespace archive
 } // namespace boost
 
-#include <boost/archive/detail/abi_suffix.hpp> // pop pragams
+#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
 
 #endif // BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP

Modified: branches/release/boost/archive/basic_binary_oprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_binary_oprimitive.hpp (original)
+++ branches/release/boost/archive/basic_binary_oprimitive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -178,6 +178,6 @@
 } //namespace boost
 } //namespace archive
 
-#include <boost/archive/detail/abi_suffix.hpp> // pop pragams
+#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
 
 #endif // BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP

Modified: branches/release/boost/archive/basic_text_iprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_text_iprimitive.hpp (original)
+++ branches/release/boost/archive/basic_text_iprimitive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -16,11 +16,11 @@
 
 // See http://www.boost.org for updates, documentation, and revision history.
 
-// archives stored as text - note these ar templated on the basic
+// archives stored as text - note these are templated on the basic
 // stream templates to accommodate wide (and other?) kind of characters
 //
-// note the fact that on libraries without wide characters, ostream is
-// is not a specialization of basic_ostream which in fact is not defined
+// Note the fact that on libraries without wide characters, ostream is
+// not a specialization of basic_ostream which in fact is not defined
 // in such cases. So we can't use basic_ostream<IStream::char_type> but rather
 // use two template parameters
 
@@ -43,13 +43,12 @@
 #include <boost/archive/dinkumware.hpp>
 #endif
 
-#include <boost/serialization/throw_exception.hpp>
 #include <boost/limits.hpp>
 #include <boost/io/ios_state.hpp>
 #include <boost/scoped_ptr.hpp>
 
+#include <boost/serialization/throw_exception.hpp>
 #include <boost/archive/archive_exception.hpp>
-
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
 namespace boost {
@@ -139,6 +138,6 @@
 } // namespace archive
 } // namespace boost
 
-#include <boost/archive/detail/abi_suffix.hpp> // pop pragams
+#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
 
 #endif // BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP

Modified: branches/release/boost/archive/basic_text_oprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_text_oprimitive.hpp (original)
+++ branches/release/boost/archive/basic_text_oprimitive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -49,6 +49,7 @@
 #include <boost/io/ios_state.hpp>
 #include <boost/scoped_ptr.hpp>
 #include <boost/serialization/throw_exception.hpp>
+
 #include <boost/archive/archive_exception.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header

Modified: branches/release/boost/archive/basic_xml_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/basic_xml_iarchive.hpp (original)
+++ branches/release/boost/archive/basic_xml_iarchive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -77,9 +77,9 @@
         boost::serialization::nvp<T> & t,
         int
     ){
- load_start(t.name());
+ this->This()->load_start(t.name());
         this->detail_common_iarchive::load_override(t.value(), 0);
- load_end(t.name());
+ this->This()->load_end(t.name());
     }
 
     // specific overrides for attributes - handle as

Modified: branches/release/boost/archive/basic_xml_oarchive.hpp
==============================================================================
--- branches/release/boost/archive/basic_xml_oarchive.hpp (original)
+++ branches/release/boost/archive/basic_xml_oarchive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -28,7 +28,6 @@
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
-
 namespace boost {
 namespace archive {
 
@@ -99,9 +98,9 @@
         ::boost::serialization::nvp<T> & t,
         int
     ){
- save_start(t.name());
+ this->This()->save_start(t.name());
         this->detail_common_oarchive::save_override(t.const_value(), 0);
- save_end(t.name());
+ this->This()->save_end(t.name());
     }
 
     // specific overrides for attributes - not name value pairs so we

Modified: branches/release/boost/archive/codecvt_null.hpp
==============================================================================
--- branches/release/boost/archive/codecvt_null.hpp (original)
+++ branches/release/boost/archive/codecvt_null.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -21,9 +21,14 @@
 #include <cwchar> // for mbstate_t
 #include <boost/config.hpp>
 #include <boost/archive/detail/auto_link_archive.hpp>
+#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
 #if defined(BOOST_NO_STDC_NAMESPACE)
+// For STLport on WinCE, BOOST_NO_STDC_NAMESPACE can get defined if STLport is putting symbols in its own namespace.
+// In the case of codecvt, however, this does not mean that codecvt is in the global namespace (it will be in STLport's namespace)
+# if !defined(UNDER_CE) || (!defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION))
     using ::codecvt;
+# endif
     using ::mbstate_t;
     using ::size_t;
 #endif
@@ -80,4 +85,6 @@
 } // namespace archive
 } // namespace boost
 
+#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
+
 #endif //BOOST_ARCHIVE_CODECVT_NULL_HPP

Modified: branches/release/boost/archive/detail/archive_pointer_iserializer.hpp
==============================================================================
--- branches/release/boost/archive/detail/archive_pointer_iserializer.hpp (original)
+++ branches/release/boost/archive/detail/archive_pointer_iserializer.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -35,6 +35,8 @@
 namespace archive {
 namespace detail {
 
+class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive;
+
 template<class Archive>
 class archive_pointer_iserializer :
     public basic_pointer_iserializer {

Modified: branches/release/boost/archive/detail/basic_oarchive.hpp
==============================================================================
--- branches/release/boost/archive/detail/basic_oarchive.hpp (original)
+++ branches/release/boost/archive/detail/basic_oarchive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -36,7 +36,7 @@
 namespace archive {
 namespace detail {
 
-class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive_impl;
+class basic_oarchive_impl;
 class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
 class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
 //////////////////////////////////////////////////////////////////////

Modified: branches/release/boost/archive/detail/iserializer.hpp
==============================================================================
--- branches/release/boost/archive/detail/iserializer.hpp (original)
+++ branches/release/boost/archive/detail/iserializer.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -47,6 +47,17 @@
 #include <boost/serialization/assume_abstract.hpp>
 #include <boost/type_traits/is_polymorphic.hpp>
 
+#define NO_HAS_NEW_OPERATOR ( \
+ defined(__BORLANDC__) \
+ || defined(__IBMCPP__) \
+ || defined(BOOST_MSVC) && (BOOST_MSVC <= 1300) \
+ || defined(__SUNPRO_CC) && (__SUBPRO_CC < 0x590) \
+)
+
+#if ! NO_USE_HAS_NEW_OPERATOR
+#include <boost/type_traits/has_new_operator.hpp>
+#endif
+
 #include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/identity.hpp>
@@ -147,6 +158,12 @@
     void *x,
     const unsigned int file_version
 ) const {
+ // trap case where the program cannot handle the current version
+ if(file_version > version())
+ boost::serialization::throw_exception(archive::archive_exception(
+ boost::archive::archive_exception::unsupported_class_version
+ ));
+
     // make sure call is routed through the higest interface that might
     // be specialized by the user.
     boost::serialization::serialize_adl(
@@ -186,36 +203,34 @@
 // }
 //}
 
-// note: this should really be a member of the load_ptr function
-// below but some compilers still complain about this.
 template<class T>
 struct heap_allocator
 {
- #if 0
- // note: this fails on msvc 7.0 and gcc 3.2
- template <class U, U x> struct test;
- typedef char* yes;
- typedef int* no;
- template <class U>
- yes has_op_new(U*, test<void* (*)(std::size_t), &U::operator new>* = 0);
- no has_op_new(...);
-
- template<class U>
- T * new_operator(U);
-
- T * new_operator(yes){
- return (T::operator new)(sizeof(T));
- }
- T * new_operator(no){
- return static_cast<T *>(operator new(sizeof(T)));
- }
+ // boost::has_new_operator<T> doesn't work on these compilers
+ #if NO_USE_HAS_NEW_OPERATOR
+ // This doesn't handle operator new overload for class T
         static T * invoke(){
- return new_operator(has_op_new(static_cast<T *>(NULL)));
+ return static_cast<T *>(operator new(sizeof(T)));
         }
     #else
- // while this doesn't handle operator new overload for class T
- static T * invoke(){
- return static_cast<T *>(operator new(sizeof(T)));
+ struct has_new_operator {
+ static T* invoke() {
+ return static_cast<T *>((T::operator new)(sizeof(T)));
+ }
+ };
+ struct doesnt_have_new_operator {
+ static T* invoke() {
+ return static_cast<T *>(operator new(sizeof(T)));
+ }
+ };
+ static T * invoke() {
+ typedef BOOST_DEDUCED_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();
         }
     #endif
 };
@@ -474,6 +489,9 @@
         typedef BOOST_DEDUCED_TYPENAME remove_extent<T>::type value_type;
         
         // convert integers to correct enum to load
+ // determine number of elements in the array. Consider the
+ // fact that some machines will align elements on boundries
+ // other than characters.
         int current_count = sizeof(t) / (
             static_cast<char *>(static_cast<void *>(&t[1]))
             - static_cast<char *>(static_cast<void *>(&t[0]))

Modified: branches/release/boost/archive/detail/register_archive.hpp
==============================================================================
--- branches/release/boost/archive/detail/register_archive.hpp (original)
+++ branches/release/boost/archive/detail/register_archive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -28,6 +28,47 @@
     typedef int type;
 };
 
+#ifdef __SUNPRO_CC
+
+template<int N>
+struct counter : counter<N-1> {};
+template<>
+struct counter<0> {};
+
+template<class Serializable>
+void instantiate_ptr_serialization(Serializable* s, int, adl_tag) {
+ instantiate_ptr_serialization(s, counter<20>());
+}
+
+template<class Archive>
+struct get_counter {
+ static const int value = sizeof(adjust_counter(counter<20>()));
+ typedef counter<value> type;
+ typedef counter<value - 1> prior;
+ typedef char (&next)[value+1];
+};
+
+char adjust_counter(counter<0>);
+template<class Serializable>
+void instantiate_ptr_serialization(Serializable*, counter<0>) {}
+
+#define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \
+namespace boost { namespace archive { namespace detail { \
+ get_counter<Archive>::next adjust_counter(get_counter<Archive>::type);\
+ template<class Serializable> \
+ void instantiate_ptr_serialization(Serializable* s, \
+ get_counter<Archive>::type) { \
+ ptr_serialization_support<Archive, Serializable> x; \
+ instantiate_ptr_serialization(s, get_counter<Archive>::prior()); \
+ }\
+}}}
+
+
+#else
+
+ // This function gets called, but its only purpose is to participate
+ // in overload resolution with the functions declared by
+ // BOOST_SERIALIZATION_REGISTER_ARCHIVE, below.
 // This function gets called, but its only purpose is to participate
 // in overload resolution with the functions declared by
 // BOOST_SERIALIZATION_REGISTER_ARCHIVE, below.
@@ -47,7 +88,7 @@
 instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \
                                                                         \
 }}}
-
+#endif
 }}} // namespace boost::archive::detail
 
 #endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP

Modified: branches/release/boost/archive/impl/basic_binary_oprimitive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_binary_oprimitive.ipp (original)
+++ branches/release/boost/archive/impl/basic_binary_oprimitive.ipp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -71,7 +71,7 @@
 BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
 basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::string &s)
 {
- std::size_t l = static_cast<unsigned int>(s.size());
+ std::size_t l = static_cast<std::size_t>(s.size());
     this->This()->save(l);
     save_binary(s.data(), l);
 }

Modified: branches/release/boost/archive/iterators/dataflow.hpp
==============================================================================
--- branches/release/boost/archive/iterators/dataflow.hpp (original)
+++ branches/release/boost/archive/iterators/dataflow.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -43,7 +43,7 @@
     enum state_enum {
         is_false = false,
         is_true = true,
- is_indeterminant,
+ is_indeterminant
     } m_state;
     // convert to bool
     operator bool (){
@@ -53,6 +53,7 @@
     // assign from bool
     tri_state & operator=(bool rhs) {
         m_state = rhs ? is_true : is_false;
+ return *this;
     }
     tri_state(bool rhs) :
         m_state(rhs ? is_true : is_false)

Modified: branches/release/boost/archive/iterators/head_iterator.hpp
==============================================================================
--- branches/release/boost/archive/iterators/head_iterator.hpp (original)
+++ branches/release/boost/archive/iterators/head_iterator.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -48,11 +48,11 @@
 
     reference_type dereference_impl(){
         if(! m_end){
- while(! m_predicate(* base_reference()))
- ++ base_reference();
+ while(! m_predicate(* this->base_reference()))
+ ++ this->base_reference();
             m_end = true;
         }
- return * base_reference();
+ return * this->base_reference();
     }
 
     reference_type dereference() const {

Modified: branches/release/boost/archive/polymorphic_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/polymorphic_iarchive.hpp (original)
+++ branches/release/boost/archive/polymorphic_iarchive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -35,6 +35,9 @@
 #include <boost/serialization/nvp.hpp>
 #include <boost/archive/detail/register_archive.hpp>
 
+#include <boost/archive/detail/decl.hpp>
+#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
+
 // determine if its necessary to handle (u)int64_t specifically
 // i.e. that its not a synonym for (unsigned) long
 // if there is no 64 bit int or if its the same as a long
@@ -63,8 +66,8 @@
 } // namespace serialization
 namespace archive {
 namespace detail {
- class basic_iarchive;
- class basic_iserializer;
+ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive;
+ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_iarchive;
 }
 
 class polymorphic_iarchive;
@@ -189,4 +192,6 @@
 // required by export
 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_iarchive)
 
+#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+
 #endif // BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP

Modified: branches/release/boost/archive/polymorphic_oarchive.hpp
==============================================================================
--- branches/release/boost/archive/polymorphic_oarchive.hpp (original)
+++ branches/release/boost/archive/polymorphic_oarchive.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -34,6 +34,9 @@
 #include <boost/serialization/nvp.hpp>
 #include <boost/archive/detail/register_archive.hpp>
 
+#include <boost/archive/detail/decl.hpp>
+#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
+
 // determine if its necessary to handle (u)int64_t specifically
 // i.e. that its not a synonym for (unsigned) long
 // if there is no 64 bit int or if its the same as a long
@@ -62,8 +65,8 @@
 } // namespace serialization
 namespace archive {
 namespace detail {
- class basic_oarchive;
- class basic_oserializer;
+ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive;
+ class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oserializer;
 }
 
 class polymorphic_oarchive;
@@ -166,4 +169,6 @@
 // required by export
 BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_oarchive)
 
+#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+
 #endif // BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP

Modified: branches/release/boost/archive/tmpdir.hpp
==============================================================================
--- branches/release/boost/archive/tmpdir.hpp (original)
+++ branches/release/boost/archive/tmpdir.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -18,7 +18,7 @@
 
 #include <cstdlib> // getenv
 #include <cstddef> // NULL
-#include <cassert>
+//#include <cassert>
 
 #include <boost/config.hpp>
 #ifdef BOOST_NO_STDC_NAMESPACE
@@ -30,8 +30,8 @@
 namespace boost {
 namespace archive {
 
-inline char * tmpdir(){
- char *dirname;
+inline const char * tmpdir(){
+ const char *dirname;
     dirname = std::getenv("TMP");
     if(NULL == dirname)
         dirname = std::getenv("TMPDIR");

Modified: branches/release/boost/archive/xml_archive_exception.hpp
==============================================================================
--- branches/release/boost/archive/xml_archive_exception.hpp (original)
+++ branches/release/boost/archive/xml_archive_exception.hpp 2009-04-01 11:58:26 EDT (Wed, 01 Apr 2009)
@@ -37,7 +37,7 @@
         xml_archive_tag_name_error
     } exception_code;
     exception_code code;
- xml_archive_exception(exception_code c)
+ xml_archive_exception(exception_code)
     {}
     virtual const char *what( ) const throw( )
     {


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk