Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56223 - trunk/boost/serialization
From: ramey_at_[hidden]
Date: 2009-09-15 16:22:51


Author: ramey
Date: 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
New Revision: 56223
URL: http://svn.boost.org/trac/boost/changeset/56223

Log:
Formalize compiler time errors and warnings

Text files modified:
   trunk/boost/serialization/array.hpp | 2
   trunk/boost/serialization/binary_object.hpp | 25 ++-----------------
   trunk/boost/serialization/level.hpp | 15 +++++++---
   trunk/boost/serialization/nvp.hpp | 2
   trunk/boost/serialization/serialization.hpp | 4 +-
   trunk/boost/serialization/static_warning.hpp | 4 +-
   trunk/boost/serialization/tracking.hpp | 9 +++++-
   trunk/boost/serialization/version.hpp | 2
   trunk/boost/serialization/wrapper.hpp | 51 ++++++++++++++++++---------------------
   9 files changed, 51 insertions(+), 63 deletions(-)

Modified: trunk/boost/serialization/array.hpp
==============================================================================
--- trunk/boost/serialization/array.hpp (original)
+++ trunk/boost/serialization/array.hpp 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
@@ -43,7 +43,7 @@
 
 template<class T>
 class array
- : public wrapper_traits<array<T> >
+ : public wrapper_traits<const array<T> >
 {
 public:
     typedef T value_type;

Modified: trunk/boost/serialization/binary_object.hpp
==============================================================================
--- trunk/boost/serialization/binary_object.hpp (original)
+++ trunk/boost/serialization/binary_object.hpp 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
@@ -36,7 +36,9 @@
 namespace boost {
 namespace serialization {
 
-struct binary_object {
+struct binary_object :
+ public wrapper_traits<nvp<const binary_object> >
+{
     /* const */ void * const m_t;
     const std::size_t m_size;
     template<class Archive>
@@ -69,28 +71,7 @@
     return binary_object(t, size);
 }
 
-// this is a wrapper
-
-template <>
-struct is_wrapper<binary_object>
- : public mpl::true_
-{};
-
 } // namespace serialization
 } // boost
 
-// don't need versioning info for this type
-BOOST_CLASS_IMPLEMENTATION(
- binary_object,
- boost::serialization::object_serializable
-)
-
-// don't track binary objects - usually they will be created on the stack
-// and tracking algorithm (which uses the object address) might get
-// confused. note that these address will likely be members of some
-// other structure which itself is tracked, so as a practical matter
-// suppressing tracking shouldn't cause any redundancy.
-
-BOOST_CLASS_TRACKING(binary_object, boost::serialization::track_never)
-
 #endif // BOOST_SERIALIZATION_BINARY_OBJECT_HPP

Modified: trunk/boost/serialization/level.hpp
==============================================================================
--- trunk/boost/serialization/level.hpp (original)
+++ trunk/boost/serialization/level.hpp 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
@@ -40,10 +40,10 @@
 
 // default serialization implementation level
 template<class T>
-struct implementation_level {
+struct implementation_level_impl {
     template<class U>
     struct traits_class_level {
- typedef BOOST_DEDUCED_TYPENAME U::level type;
+ typedef BOOST_DEDUCED_TYPENAME U::level type;
     };
 
     typedef mpl::integral_c_tag tag;
@@ -85,9 +85,14 @@
>
>::type type;
         // vc 7.1 doesn't like enums here
- BOOST_STATIC_CONSTANT(int, value = implementation_level::type::value);
+ BOOST_STATIC_CONSTANT(int, value = type::value);
 };
 
+template<class T>
+struct implementation_level :
+ public implementation_level_impl<const T>
+{
+};
 
 template<class T, BOOST_MPL_AUX_NTTP_DECL(int, L) >
 inline bool operator>=(implementation_level<T> t, enum level_type l)
@@ -104,13 +109,13 @@
     namespace boost { \
     namespace serialization { \
     template <> \
- struct implementation_level< T > \
+ struct implementation_level_impl< const T > \
     { \
         typedef mpl::integral_c_tag tag; \
         typedef mpl::int_< E > type; \
         BOOST_STATIC_CONSTANT( \
             int, \
- value = implementation_level::type::value \
+ value = implementation_level_impl::type::value \
         ); \
     }; \
     } \

Modified: trunk/boost/serialization/nvp.hpp
==============================================================================
--- trunk/boost/serialization/nvp.hpp (original)
+++ trunk/boost/serialization/nvp.hpp 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
@@ -41,7 +41,7 @@
 template<class T>
 struct nvp :
     public std::pair<const char *, T *>,
- public wrapper_traits<nvp<T> >
+ public wrapper_traits<const nvp<T> >
 {
     explicit nvp(const char * name_, T & t) :
         // note: redundant cast works around borland issue

Modified: trunk/boost/serialization/serialization.hpp
==============================================================================
--- trunk/boost/serialization/serialization.hpp (original)
+++ trunk/boost/serialization/serialization.hpp 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
@@ -66,7 +66,7 @@
 
 BOOST_STRONG_TYPEDEF(unsigned int, version_type)
 
-// default implemenation - call the member function "serialize"
+// default implementation - call the member function "serialize"
 template<class Archive, class T>
 inline void serialize(
     Archive & ar, T & t, const BOOST_PFTO unsigned int file_version
@@ -88,7 +88,7 @@
 // load data required for construction and invoke constructor in place
 template<class Archive, class T>
 inline void load_construct_data(
- Archive & ar,
+ Archive & /*ar*/,
     T * t,
     const BOOST_PFTO unsigned int /*file_version*/
 ){

Modified: trunk/boost/serialization/static_warning.hpp
==============================================================================
--- trunk/boost/serialization/static_warning.hpp (original)
+++ trunk/boost/serialization/static_warning.hpp 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
@@ -77,7 +77,7 @@
 namespace serialization {
 
 template<int L>
-struct STATIC_WARNING{};
+struct STATIC_WARNING_LINE{};
 
 template<bool B, int L>
 struct static_warning_test{
@@ -86,7 +86,7 @@
         boost::mpl::true_,
         typename boost::mpl::identity<
             boost::mpl::print<
- STATIC_WARNING<L>
+ STATIC_WARNING_LINE<L>
>
>
>::type type;

Modified: trunk/boost/serialization/tracking.hpp
==============================================================================
--- trunk/boost/serialization/tracking.hpp (original)
+++ trunk/boost/serialization/tracking.hpp 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
@@ -38,7 +38,7 @@
 
 // default tracking level
 template<class T>
-struct tracking_level {
+struct tracking_level_impl {
     template<class U>
     struct traits_class_tracking {
         typedef BOOST_DEDUCED_TYPENAME U::tracking type;
@@ -67,9 +67,14 @@
             // otherwise its selective
             mpl::int_<track_selectively>
> > >::type type;
- BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value);
+ BOOST_STATIC_CONSTANT(int, value = type::value);
 };
 
+template<class T>
+struct tracking_level :
+ public tracking_level_impl<const T>
+{
+};
 
 template<class T, enum tracking_type L>
 inline bool operator>=(tracking_level<T> t, enum tracking_type l)

Modified: trunk/boost/serialization/version.hpp
==============================================================================
--- trunk/boost/serialization/version.hpp (original)
+++ trunk/boost/serialization/version.hpp 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
@@ -49,7 +49,7 @@
             traits_class_version<T>,
             mpl::int_<0>
>::type type;
- BOOST_STATIC_CONSTANT(unsigned int, value = version::type::value);
+ BOOST_STATIC_CONSTANT(int, value = version::type::value);
 };
 
 } // namespace serialization

Modified: trunk/boost/serialization/wrapper.hpp
==============================================================================
--- trunk/boost/serialization/wrapper.hpp (original)
+++ trunk/boost/serialization/wrapper.hpp 2009-09-15 16:22:49 EDT (Tue, 15 Sep 2009)
@@ -9,6 +9,7 @@
 #include <boost/serialization/traits.hpp>
 #include <boost/type_traits/is_base_and_derived.hpp>
 #include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/bool.hpp>
 
 namespace boost { namespace serialization {
 
@@ -25,39 +26,35 @@
     unsigned int Version = 0,
     class ETII = extended_type_info_impl< T >
>
-struct wrapper_traits : public traits<T,Level,Tracking,Version,ETII,mpl::true_>
+struct wrapper_traits :
+ public traits<T,Level,Tracking,Version,ETII,mpl::true_>
 {};
 
-/// the is_wrapper type traits class.
-
-namespace detail {
-template <class T>
-struct is_wrapper_member
-{
- typedef BOOST_DEDUCED_TYPENAME T::is_wrapper type;
-};
-
-}
-
-
 template<class T>
-struct is_wrapper
- : mpl::eval_if<
- is_base_and_derived<basic_traits,T>,
- detail::is_wrapper_member<T>,
- mpl::false_
+struct is_wrapper_impl :
+ boost::mpl::eval_if<
+ boost::is_base_and_derived<basic_traits,T>,
+ boost::mpl::true_,
+ boost::mpl::false_
>::type
 {};
-
-} } // end namespace boost::serialization
 
-// A macro to define that a class is a wrapper
-#define BOOST_CLASS_IS_WRAPPER(T) \
-namespace boost { \
-namespace serialization { \
-template<> \
-struct is_wrapper< T > : mpl::true_ {}; \
-}}
+template<class T>
+struct is_wrapper {
+ typedef BOOST_DEDUCED_TYPENAME is_wrapper_impl<const T>::type type;
+};
 
+} // serialization
+} // boost
+
+// A macro to define that a class is a wrapper
+#define BOOST_CLASS_IS_WRAPPER(T) \
+namespace boost { \
+namespace serialization { \
+template<> \
+struct is_wrapper_impl<const T> : boost::mpl::true_ {}; \
+} \
+} \
+/**/
 
 #endif //BOOST_SERIALIZATION_WRAPPER_HPP


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