|
Boost-Commit : |
From: ramey_at_[hidden]
Date: 2007-11-01 16:24:37
Author: ramey
Date: 2007-11-01 16:24:36 EDT (Thu, 01 Nov 2007)
New Revision: 40660
URL: http://svn.boost.org/trac/boost/changeset/40660
Log:
passing all msvc and gcc tests
except gcc(release) test_no_rtti and test_shared_ptr132
Text files modified:
branches/serialization_next_release/boost/boost/serialization/base_object.hpp | 77 +++++++++++++++++++++------------------
branches/serialization_next_release/boost/boost/serialization/config.hpp | 66 +++++++++++++++++----------------
branches/serialization_next_release/boost/boost/serialization/export.hpp | 8 +--
branches/serialization_next_release/boost/boost/serialization/extended_type_info.hpp | 2
branches/serialization_next_release/boost/boost/serialization/extended_type_info_no_rtti.hpp | 9 +---
branches/serialization_next_release/boost/boost/serialization/extended_type_info_typeid.hpp | 44 +++++++++-------------
branches/serialization_next_release/boost/boost/serialization/void_cast.hpp | 72 ++++++++++++++++++------------------
branches/serialization_next_release/boost/boost/serialization/void_cast_fwd.hpp | 2 +
8 files changed, 139 insertions(+), 141 deletions(-)
Modified: branches/serialization_next_release/boost/boost/serialization/base_object.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/base_object.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/base_object.hpp 2007-11-01 16:24:36 EDT (Thu, 01 Nov 2007)
@@ -25,12 +25,15 @@
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/int.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/identity.hpp>
+
#include <boost/type_traits/is_base_and_derived.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/is_polymorphic.hpp>
#include <boost/static_assert.hpp>
-#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/serialization/void_cast_fwd.hpp>
@@ -39,40 +42,44 @@
namespace detail
{
-// only register void casts if the types are polymorphic
- template<class Base, class Derived>
- struct base_register
- {
- static void const* execute(mpl::false_) { return 0; }
-
- static void const* execute(mpl::true_)
- {
- return &void_cast_register((Derived const*)0, (Base const*)0);
- }
-
- static void const* invoke()
- {
- typedef mpl::bool_<
- type_info_implementation<Base>::type::is_polymorphic::value
- > is_polymorphic;
-
- return execute(is_polymorphic());
- }
- };
-
- // get the base type for a given derived type
- // preserving the const-ness
- template<class B, class D>
- struct base_cast
- {
- typedef BOOST_DEDUCED_TYPENAME
- mpl::if_<
- is_const<D>,
- const B,
- B
- >::type type;
- BOOST_STATIC_ASSERT(is_const<type>::value == is_const<D>::value);
- };
+ // get the base type for a given derived type
+ // preserving the const-ness
+ template<class B, class D>
+ struct base_cast
+ {
+ typedef BOOST_DEDUCED_TYPENAME
+ mpl::if_<
+ is_const<D>,
+ const B,
+ B
+ >::type type;
+ BOOST_STATIC_ASSERT(is_const<type>::value == is_const<D>::value);
+ };
+
+ // only register void casts if the types are polymorphic
+ template<class Base, class Derived>
+ struct base_register
+ {
+ struct polymorphic {
+ static void const * invoke(){
+ return &void_cast_register((Derived const*)0, (Base const*)0);
+ }
+ };
+ struct non_polymorphic {
+ static void const * invoke(){
+ return 0;
+ }
+ };
+ static void const * invoke(){
+ typedef BOOST_DEDUCED_TYPENAME mpl::eval_if<
+ is_polymorphic<Base>,
+ mpl::identity<polymorphic>,
+ mpl::identity<non_polymorphic>
+ >::type type;
+ return type::invoke();
+ }
+ };
+
} // namespace detail
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
Modified: branches/serialization_next_release/boost/boost/serialization/config.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/config.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/config.hpp 2007-11-01 16:24:36 EDT (Thu, 01 Nov 2007)
@@ -1,10 +1,4 @@
-#ifndef BOOST_SERIALIZATION_CONFIG_HPP
-#define BOOST_SERIALIZATION_CONFIG_HPP
-
-// MS compatible compilers support #pragma once
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
+// note lack of include guards. This is intentional
// config.hpp ---------------------------------------------//
@@ -28,22 +22,34 @@
// the same library as BOOST_ARCHIVE. This could change some day in the
// future
+// if BOOST_SERIALIZATION_DECL is defined undefine it now:
+#ifdef BOOST_SERIALIZATION_DECL
+ #undef BOOST_SERIALIZATION_DECL
+#endif
+
#ifdef BOOST_HAS_DECLSPEC // defined in config system
// we need to import/export our code only if the user has specifically
// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
// libraries to be dynamically linked, or BOOST_SERIALIZATION_DYN_LINK
// if they want just this one to be dynamically liked:
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
-#define BOOST_DYN_LINK
-// export if this is our own source, otherwise import:
-#if defined(BOOST_SERIALIZATION_SOURCE)
- #if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN) || defined(__MWERKS__)
- #define BOOST_SERIALIZATION_DECL(T) __declspec(dllexport) T
- #else
- #define BOOST_SERIALIZATION_DECL(T) T __declspec(dllexport)
+ #if !defined(BOOST_DYN_LINK)
+ #define BOOST_DYN_LINK
#endif
- #pragma message( "BOOST_SERIALIZATION_DECL __declspec(dllexport)" )
-#endif // defined(BOOST_SERIALIZATION_SOURCE)
+ // export if this is our own source, otherwise import:
+ #if defined(BOOST_SERIALIZATION_SOURCE)
+ #if defined(__BORLANDC__)
+ #define BOOST_SERIALIZATION_DECL(T) T __export
+ #else
+ #define BOOST_SERIALIZATION_DECL(T) __declspec(dllexport) T
+ #endif
+ #else
+ #if defined(__BORLANDC__)
+ #define BOOST_SERIALIZATION_DECL(T) T __import
+ #else
+ #define BOOST_SERIALIZATION_DECL(T) __declspec(dllimport) T
+ #endif
+ #endif // defined(BOOST_SERIALIZATION_SOURCE)
#endif // defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
#endif // BOOST_HAS_DECLSPEC
@@ -55,20 +61,16 @@
// enable automatic library variant selection ------------------------------//
#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \
-&& !defined(BOOST_SERIALIZATION_SOURCE) \
-&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE)
-//
-// Set the name of our library, this will get undef'ed by auto_link.hpp
-// once it's done with it:
-//
-#define BOOST_LIB_NAME boost_serialization
-//
-// And include the header that does the work:
-//
-#include <boost/config/auto_link.hpp>
-
-#endif // !defined(BOOST_SERIALIZATION_SOURCE) && !defined(BOOST_ARCHIVE_SOURCE)
-
-//----------------------------------------------------------------------------//
+&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) \
+&& !defined(BOOST_SERIALIZATION_SOURCE)
+ //
+ // Set the name of our library, this will get undef'ed by auto_link.hpp
+ // once it's done with it:
+ //
+ #define BOOST_LIB_NAME boost_serialization
+ //
+ // And include the header that does the work:
+ //
+ #include <boost/config/auto_link.hpp>
-#endif // BOOST_SERIALIZATION_CONFIG_HPP
+#endif
Modified: branches/serialization_next_release/boost/boost/serialization/export.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/export.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/export.hpp 2007-11-01 16:24:36 EDT (Thu, 01 Nov 2007)
@@ -79,9 +79,8 @@
const guid_initializer & export_guid(char const* key)
{
assert(NULL != key);
- boost::serialization::singleton<
- boost::serialization::type_info_implementation<T>::type
- >::get_mutable_instance().key_register(key);
+ boost::serialization::type_info_implementation<T>::type
+ ::get_mutable_instance().key_register(key);
// generates the statically-initialized objects whose constructors
// register the information allowing serialization of T objects
@@ -182,8 +181,7 @@
// need to export it.
#define BOOST_CLASS_EXPORT_CHECK(T) \
BOOST_STATIC_WARNING( \
- boost::serialization::type_info_implementation< T > \
- ::type::is_polymorphic::value \
+ boost::is_polymorphic<U>::value \
); \
/**/
Modified: branches/serialization_next_release/boost/boost/serialization/extended_type_info.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/extended_type_info.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/extended_type_info.hpp 2007-11-01 16:24:36 EDT (Thu, 01 Nov 2007)
@@ -47,7 +47,7 @@
#if defined(__GNUC__)
virtual
#endif
- virtual ~extended_type_info();
+ ~extended_type_info();
public:
void key_register(const char *key);
const char * get_key() const {
Modified: branches/serialization_next_release/boost/boost/serialization/extended_type_info_no_rtti.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/extended_type_info_no_rtti.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/extended_type_info_no_rtti.hpp 2007-11-01 16:24:36 EDT (Thu, 01 Nov 2007)
@@ -22,6 +22,7 @@
#include <boost/type_traits/is_const.hpp>
#include <boost/serialization/extended_type_info.hpp>
+#include <boost/serialization/singleton.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/config/abi_prefix.hpp> // must be the last header
@@ -38,14 +39,10 @@
template<class T>
class extended_type_info_no_rtti :
- public extended_type_info
+ public extended_type_info,
+ public singleton<extended_type_info_no_rtti<T> >
{
public:
- struct is_polymorphic
- {
- typedef boost::mpl::bool_<true> type;
- BOOST_STATIC_CONSTANT(bool, value = is_polymorphic::type::value);
- };
// private constructor to inhibit any existence other than the
// static one
extended_type_info_no_rtti(){}
Modified: branches/serialization_next_release/boost/boost/serialization/extended_type_info_typeid.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/extended_type_info_typeid.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/extended_type_info_typeid.hpp 2007-11-01 16:24:36 EDT (Thu, 01 Nov 2007)
@@ -23,11 +23,13 @@
//#include <boost/static_warning.hpp>
#include <boost/static_assert.hpp>
+#include <boost/static_warning.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_polymorphic.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <boost/serialization/extended_type_info.hpp>
+#include <boost/serialization/singleton.hpp>
#include <boost/config/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
@@ -47,7 +49,7 @@
extended_type_info_typeid_0() :
m_ti(NULL)
{}
- virtual ~extended_type_info_typeid_0();
+ ~extended_type_info_typeid_0();
void type_register(const std::type_info & ti);
static const extended_type_info *
get_derived_extended_type_info(const std::type_info & ti);
@@ -57,37 +59,35 @@
}
};
+} // namespace detail
+
///////////////////////////////////////////////////////////////////////////////
// layer to fold T and const T into the same table entry.
template<class T>
-class extended_type_info_typeid_1 :
- public detail::extended_type_info_typeid_0
+class extended_type_info_typeid :
+ public detail::extended_type_info_typeid_0,
+ public singleton<extended_type_info_typeid<const T> >
{
protected:
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
+public:
+#endif
+public:
// protected constructor to inhibit any existence other than the
// static one
- extended_type_info_typeid_1() :
+ extended_type_info_typeid() :
detail::extended_type_info_typeid_0()
{
type_register(typeid(T));
}
-#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
-public:
-#endif
- ~extended_type_info_typeid_1(){}
-public:
- struct is_polymorphic
- {
- typedef BOOST_DEDUCED_TYPENAME boost::is_polymorphic<T>::type type;
- BOOST_STATIC_CONSTANT(bool, value = is_polymorphic::type::value);
- };
+ ~extended_type_info_typeid(){}
const extended_type_info *
get_derived_extended_type_info(const T & t) const {
// note: this implementation - based on usage of typeid (rtti)
- // only works if the class has at least one virtual function.
-// BOOST_STATIC_WARNING(
-// static_cast<bool>(is_polymorphic::value)
-// );
+ // only does something if the class has at least one virtual function.
+ BOOST_STATIC_WARNING(
+ static_cast<bool>(boost::is_polymorphic<T>::value)
+ );
return
detail::extended_type_info_typeid_0::get_derived_extended_type_info(
typeid(t)
@@ -95,14 +95,6 @@
}
};
-} // namespace detail
-
-///////////////////////////////////////////////////////////////////////////////
-template<class T>
-class extended_type_info_typeid :
- public detail::extended_type_info_typeid_1<const T>
-{};
-
} // namespace serialization
} // namespace boost
Modified: branches/serialization_next_release/boost/boost/serialization/void_cast.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/void_cast.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/void_cast.hpp 2007-11-01 16:24:36 EDT (Thu, 01 Nov 2007)
@@ -18,12 +18,11 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/smart_cast.hpp>
-
-#include <boost/serialization/config.hpp>
#include <boost/serialization/singleton.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/serialization/type_info_implementation.hpp>
+#include <boost/serialization/config.hpp>
#include <boost/config/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
@@ -34,7 +33,7 @@
namespace boost {
namespace serialization {
-class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info;
+//class BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY()) extended_type_info;
// Given a void *, assume that it really points to an instance of one type
// and alter it so that it would point to an instance of a related type.
@@ -43,40 +42,40 @@
BOOST_SERIALIZATION_DECL(void const *)
void_upcast(
- extended_type_info const & derived_type,
- extended_type_info const & base_type,
+ extended_type_info const & derived,
+ extended_type_info const & base,
void const * const t
);
inline void *
void_upcast(
- extended_type_info const & derived_type_,
- extended_type_info const & base_type_,
+ extended_type_info const & derived,
+ extended_type_info const & base,
void * const t
){
return const_cast<void*>(void_upcast(
- derived_type_,
- base_type_,
+ derived,
+ base,
const_cast<void const *>(t)
));
}
BOOST_SERIALIZATION_DECL(void const *)
void_downcast(
- extended_type_info const & derived_type,
- extended_type_info const & base_type,
+ extended_type_info const & derived,
+ extended_type_info const & base,
void const * const t
);
inline void *
void_downcast(
- extended_type_info const & derived_type,
- extended_type_info const & base_type,
+ extended_type_info const & derived,
+ extended_type_info const & base,
void * const t
){
return const_cast<void*>(void_downcast(
- derived_type,
- base_type,
+ derived,
+ base,
const_cast<void const *>(t)
));
}
@@ -89,27 +88,27 @@
friend
BOOST_SERIALIZATION_DECL(void const *)
boost::serialization::void_upcast(
- const extended_type_info & derived,
- const extended_type_info & base,
- const void * t
+ extended_type_info const & derived,
+ extended_type_info const & base,
+ void const * const
);
friend
BOOST_SERIALIZATION_DECL(void const *)
boost::serialization::void_downcast(
- const extended_type_info & derived,
- const extended_type_info & base,
- const void * t
+ extended_type_info const & derived,
+ extended_type_info const & base,
+ void const * const
);
// Data members
const extended_type_info & m_derived;
const extended_type_info & m_base;
// each derived class must re-implement these;
- virtual void const * upcast(void const * t) const = 0;
- virtual void const * downcast(void const * t) const = 0;
+ virtual void const * upcast(void const * const t) const = 0;
+ virtual void const * downcast(void const * const t) const = 0;
protected:
- BOOST_SERIALIZATION_DECL(void)
+ void
static_register() const;
- BOOST_SERIALIZATION_DECL(void)
+ void
static_unregister() const;
public:
// Constructor
@@ -120,42 +119,42 @@
virtual ~void_caster(){};
private:
// cw 8.3 requires this!!
- void_caster& operator=(void_caster const&);
+ void_caster& operator=(void_caster const &);
};
template <class Derived, class Base>
class void_caster_primitive :
public void_caster
{
- virtual void const* downcast( void const * t ) const {
+ virtual void const * downcast(void const * const t) const {
const Derived * d = boost::smart_cast<const Derived *, const Base *>(
static_cast<const Base *>(t)
);
return d;
}
- virtual void const* upcast(void const * t) const {
+ virtual void const * upcast(void const * const t) const {
const Base * b = boost::smart_cast<const Base *, const Derived *>(
static_cast<const Derived *>(t)
);
return b;
}
public:
- BOOST_DLLEXPORT void_caster_primitive() BOOST_USED;
- BOOST_DLLEXPORT ~void_caster_primitive() BOOST_USED;
+ void_caster_primitive();
+ ~void_caster_primitive();
};
template <class Derived, class Base>
-BOOST_DLLEXPORT void_caster_primitive<Derived, Base>::void_caster_primitive() :
+void_caster_primitive<Derived, Base>::void_caster_primitive() :
void_caster(
- singleton<type_info_implementation<Derived>::type>::get_const_instance(),
- singleton<type_info_implementation<Base>::type>::get_const_instance()
+ type_info_implementation<Derived>::type::get_const_instance(),
+ type_info_implementation<Base>::type::get_const_instance()
)
{
static_register();
}
template <class Derived, class Base>
-BOOST_DLLEXPORT void_caster_primitive<Derived, Base>::~void_caster_primitive(){
+void_caster_primitive<Derived, Base>::~void_caster_primitive(){
static_unregister();
}
@@ -171,11 +170,12 @@
const Derived * dnull,
const Base * bnull
) BOOST_USED;
+
template<class Derived, class Base>
BOOST_DLLEXPORT
inline const void_cast_detail::void_caster & void_cast_register(
- const Derived * /* dnull = NULL */,
- const Base * /* bnull = NULL */
+ Derived const * /* dnull = NULL */,
+ Base const * /* bnull = NULL */
){
return singleton<void_cast_detail::void_caster_primitive<
Derived, Base
Modified: branches/serialization_next_release/boost/boost/serialization/void_cast_fwd.hpp
==============================================================================
--- branches/serialization_next_release/boost/boost/serialization/void_cast_fwd.hpp (original)
+++ branches/serialization_next_release/boost/boost/serialization/void_cast_fwd.hpp 2007-11-01 16:24:36 EDT (Thu, 01 Nov 2007)
@@ -17,6 +17,8 @@
// See http://www.boost.org for updates, documentation, and revision history.
+#include <boost/serialization/force_include.hpp>
+
namespace boost {
namespace serialization {
namespace void_cast_detail{
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