Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57982 - in trunk/libs/serialization: doc src util vc7ide
From: ramey_at_[hidden]
Date: 2009-11-27 16:25:20


Author: ramey
Date: 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
New Revision: 57982
URL: http://svn.boost.org/trac/boost/changeset/57982

Log:
changes to minimize warnings in library build
Text files modified:
   trunk/libs/serialization/doc/contents.html | 2
   trunk/libs/serialization/src/basic_archive.cpp | 4 +-
   trunk/libs/serialization/src/basic_iarchive.cpp | 40 +++++++++++++-------
   trunk/libs/serialization/src/basic_oarchive.cpp | 78 +++++++++++++++++++++++++--------------
   trunk/libs/serialization/src/basic_xml_grammar.ipp | 27 ++++++++++++-
   trunk/libs/serialization/src/extended_type_info.cpp | 14 +++++++
   trunk/libs/serialization/src/extended_type_info_typeid.cpp | 23 +++++++++--
   trunk/libs/serialization/src/void_cast.cpp | 22 ++++++++++-
   trunk/libs/serialization/util/test.jam | 2
   trunk/libs/serialization/vc7ide/test_iterators.vcproj | 2
   trunk/libs/serialization/vc7ide/test_polymorphic.vcproj | 2
   trunk/libs/serialization/vc7ide/test_simple_class.vcproj | 2
   12 files changed, 159 insertions(+), 59 deletions(-)

Modified: trunk/libs/serialization/doc/contents.html
==============================================================================
--- trunk/libs/serialization/doc/contents.html (original)
+++ trunk/libs/serialization/doc/contents.html 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -302,7 +302,7 @@
     <dd><div id="singleton_detail"><dl class="page-index">
       <dt><img style="display:none" src="dot.gif"><a target="detail" href="singleton.html#motivation">Motivation</a>
       <dt><img style="display:none" src="dot.gif"><a target="detail" href="singleton.html#features">Features</a>
- <dt><img style="display:none" src="dot.gif"><a target="detail" href="singleton.html#classinterface">Class Interfac'</a>
+ <dt><img style="display:none" src="dot.gif"><a target="detail" href="singleton.html#classinterface">Class Interface</a>
       <dt><img style="display:none" src="dot.gif"><a target="detail" href="singleton.html#requirements">Requirements</a>
       <dt><img style="display:none" src="dot.gif"><a target="detail" href="singleton.html#examples">Examples</a>
       <dt><img style="display:none" src="dot.gif"><a target="detail" href="singleton.html#multithreading">Multi-Threading</a>

Modified: trunk/libs/serialization/src/basic_archive.cpp
==============================================================================
--- trunk/libs/serialization/src/basic_archive.cpp (original)
+++ trunk/libs/serialization/src/basic_archive.cpp 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -59,9 +59,9 @@
 // types caused backwards compatibility breaking change in 1.35
 // 6 - Boost 1.41, serializing collection sizes as std::size_t
 
-BOOST_ARCHIVE_DECL(unsigned char)
+BOOST_ARCHIVE_DECL(version_type)
 BOOST_ARCHIVE_VERSION(){
- return 6;
+ return version_type(6);
 }
 
 } // namespace archive

Modified: trunk/libs/serialization/src/basic_iarchive.cpp
==============================================================================
--- trunk/libs/serialization/src/basic_iarchive.cpp (original)
+++ trunk/libs/serialization/src/basic_iarchive.cpp 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -23,7 +23,7 @@
 } // namespace std
 #endif
 
-#include <boost/limits.hpp>
+#include <boost/integer_traits.hpp>
 #include <boost/serialization/state_saver.hpp>
 #include <boost/serialization/throw_exception.hpp>
 #include <boost/serialization/tracking.hpp>
@@ -93,18 +93,18 @@
     // used by load object to look up class id given basic_serializer
     struct cobject_type
     {
- const basic_iserializer * bis;
- const class_id_type class_id;
+ const basic_iserializer * m_bis;
+ const class_id_type m_class_id;
         cobject_type(
- class_id_type class_id_,
- const basic_iserializer & bis_
+ std::size_t class_id,
+ const basic_iserializer & bis
         ) :
- bis(& bis_),
- class_id(class_id_)
+ m_bis(& bis),
+ m_class_id(class_id)
         {}
         cobject_type(const cobject_type & rhs) :
- bis(rhs.bis),
- class_id(rhs.class_id)
+ m_bis(rhs.m_bis),
+ m_class_id(rhs.m_class_id)
         {}
         // the following cannot be defined because of the const
         // member. This will generate a link error if an attempt
@@ -112,7 +112,7 @@
         cobject_type & operator=(const cobject_type & rhs);
         bool operator<(const cobject_type &rhs) const
         {
- return *bis < *(rhs.bis);
+ return *m_bis < *(rhs.m_bis);
         }
     };
     typedef std::set<cobject_type> cobject_info_set_type;
@@ -174,7 +174,7 @@
         pending_version(0)
     {}
     ~basic_iarchive_impl(){}
- void set_library_version(unsigned int archive_library_version){
+ void set_library_version(version_type archive_library_version){
         m_archive_library_version = archive_library_version;
     }
     bool
@@ -289,7 +289,14 @@
 basic_iarchive_impl::register_type(
     const basic_iserializer & bis
 ){
- class_id_type id(static_cast<int>(cobject_info_set.size()));
+ assert(
+ cobject_info_set.size()
+ <=
+ boost::integer_traits<class_id_type>::const_max
+ );
+ class_id_type id(static_cast<class_id_type>(
+ cobject_info_set.size()
+ ));
     cobject_type co(id, bis);
     std::pair<cobject_info_set_type::const_iterator, bool>
         result = cobject_info_set.insert(co);
@@ -298,7 +305,7 @@
         cobject_id_vector.push_back(cobject_id(bis));
         assert(cobject_info_set.size() == cobject_id_vector.size());
     }
- id = result.first->class_id;
+ id = result.first->m_class_id;
     // borland complains without this minor hack
     const int tid = id;
     cobject_id & coid = cobject_id_vector[tid];
@@ -405,6 +412,11 @@
         return bpis_ptr;
     }
 
+ assert(
+ cobject_info_set.size()
+ <=
+ boost::integer_traits<class_id_type>::const_max
+ );
     // if its a new class type - i.e. never been registered
     if(class_id_type(cobject_info_set.size()) <= cid){
         // if its either abstract
@@ -509,7 +521,7 @@
 }
 
 BOOST_ARCHIVE_DECL(void)
-basic_iarchive::set_library_version(unsigned int archive_library_version){
+basic_iarchive::set_library_version(version_type archive_library_version){
     pimpl->set_library_version(archive_library_version);
 }
 

Modified: trunk/libs/serialization/src/basic_oarchive.cpp
==============================================================================
--- trunk/libs/serialization/src/basic_oarchive.cpp (original)
+++ trunk/libs/serialization/src/basic_oarchive.cpp 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -91,26 +91,28 @@
     // keyed on type_info
     struct cobject_type
     {
- const basic_oserializer * bos_ptr;
- const class_id_type class_id;
- bool initialized;
+ const basic_oserializer * m_bos_ptr;
+ const class_id_type m_class_id;
+ bool m_initialized;
         cobject_type(
- std::size_t class_id_,
- const basic_oserializer & bos_
+ std::size_t class_id,
+ const basic_oserializer & bos
         ) :
- bos_ptr(& bos_),
- class_id(class_id_),
- initialized(false)
+ m_bos_ptr(& bos),
+ m_class_id(
+ static_cast<class_id_type>(class_id)
+ ),
+ m_initialized(false)
         {}
- cobject_type(const basic_oserializer & bos_)
- : bos_ptr(& bos_)
+ cobject_type(const basic_oserializer & bos)
+ : m_bos_ptr(& bos)
         {}
         cobject_type(
             const cobject_type & rhs
         ) :
- bos_ptr(rhs.bos_ptr),
- class_id(rhs.class_id),
- initialized(rhs.initialized)
+ m_bos_ptr(rhs.m_bos_ptr),
+ m_class_id(rhs.m_class_id),
+ m_initialized(rhs.m_initialized)
         {}
         // the following cannot be defined because of the const
         // member. This will generate a link error if an attempt
@@ -118,7 +120,7 @@
         // use this only for lookup argument
         cobject_type & operator=(const cobject_type &rhs);
         bool operator<(const cobject_type &rhs) const {
- return *bos_ptr < *(rhs.bos_ptr);
+ return *m_bos_ptr < *(rhs.m_bos_ptr);
         }
     };
     // keyed on type_info
@@ -167,9 +169,14 @@
 // return NULL if not found
 inline const basic_oserializer *
 basic_oarchive_impl::find(const serialization::extended_type_info & ti) const {
- class bosarg : public basic_oserializer
+ #ifdef BOOST_MSVC
+ # pragma warning(push)
+ # pragma warning(disable : 4511 4512)
+ #endif
+ class bosarg :
+ public basic_oserializer
     {
- bool class_info() const {
+ bool class_info() const {
             assert(false);
             return false;
         }
@@ -179,9 +186,9 @@
             return false;
         }
         // returns class version
- unsigned int version() const {
+ version_type version() const {
             assert(false);
- return 0;
+ return version_type(0);
         }
         // returns true if this class is polymorphic
         bool is_polymorphic() const{
@@ -189,7 +196,7 @@
             return false;
         }
         void save_object_data(
- basic_oarchive & ar, const void * x
+ basic_oarchive & /*ar*/, const void * /*x*/
         ) const {
             assert(false);
         }
@@ -198,6 +205,9 @@
           boost::archive::detail::basic_oserializer(eti)
         {}
     };
+ #ifdef BOOST_MSVC
+ #pragma warning(pop)
+ #endif
     bosarg bos(ti);
     cobject_info_set_type::const_iterator cit
         = cobject_info_set.find(cobject_type(bos));
@@ -209,12 +219,17 @@
         return NULL;
     }
     // return pointer to the real class
- return cit->bos_ptr;
+ return cit->m_bos_ptr;
 }
 
 inline const basic_oarchive_impl::cobject_type &
 basic_oarchive_impl::find(const basic_oserializer & bos)
 {
+ assert(
+ cobject_info_set.size()
+ <=
+ boost::integer_traits<class_id_type>::const_max
+ );
     std::pair<cobject_info_set_type::iterator, bool> cresult =
         cobject_info_set.insert(cobject_type(cobject_info_set.size(), bos));
     return *(cresult.first);
@@ -224,6 +239,11 @@
 basic_oarchive_impl::register_type(
     const basic_oserializer & bos
 ){
+ assert(
+ cobject_info_set.size()
+ <=
+ boost::integer_traits<class_id_type>::const_max
+ );
     cobject_type co(cobject_info_set.size(), bos);
     std::pair<cobject_info_set_type::const_iterator, bool>
         result = cobject_info_set.insert(co);
@@ -247,11 +267,11 @@
     // get class information for this object
     const cobject_type & co = register_type(bos);
     if(bos.class_info()){
- if( ! co.initialized){
- ar.vsave(class_id_optional_type(co.class_id));
+ if( ! co.m_initialized){
+ ar.vsave(class_id_optional_type(co.m_class_id));
             ar.vsave(tracking_type(bos.tracking(m_flags)));
             ar.vsave(version_type(bos.version()));
- (const_cast<cobject_type &>(co)).initialized = true;
+ (const_cast<cobject_type &>(co)).m_initialized = true;
         }
     }
 
@@ -267,7 +287,7 @@
     // look for an existing object id
     object_id_type oid(object_set.size());
     // lookup to see if this object has already been written to the archive
- basic_oarchive_impl::aobject ao(t, co.class_id, oid);
+ basic_oarchive_impl::aobject ao(t, co.m_class_id, oid);
     std::pair<basic_oarchive_impl::object_set_type::const_iterator, bool>
         aresult = object_set.insert(ao);
     oid = aresult.first->object_id;
@@ -306,8 +326,8 @@
     const basic_oserializer & bos = bpos_ptr->get_basic_serializer();
     std::size_t original_count = cobject_info_set.size();
     const cobject_type & co = register_type(bos);
- if(! co.initialized){
- ar.vsave(co.class_id);
+ if(! co.m_initialized){
+ ar.vsave(co.m_class_id);
         // if its a previously unregistered class
         if((cobject_info_set.size() > original_count)){
             if(bos.is_polymorphic()){
@@ -335,10 +355,10 @@
             ar.vsave(tracking_type(bos.tracking(m_flags)));
             ar.vsave(version_type(bos.version()));
         }
- (const_cast<cobject_type &>(co)).initialized = true;
+ (const_cast<cobject_type &>(co)).m_initialized = true;
     }
     else{
- ar.vsave(class_id_reference_type(co.class_id));
+ ar.vsave(class_id_reference_type(co.m_class_id));
     }
 
     // if we're not tracking
@@ -355,7 +375,7 @@
 
     object_id_type oid(object_set.size());
     // lookup to see if this object has already been written to the archive
- basic_oarchive_impl::aobject ao(t, co.class_id, oid);
+ basic_oarchive_impl::aobject ao(t, co.m_class_id, oid);
     std::pair<basic_oarchive_impl::object_set_type::const_iterator, bool>
         aresult = object_set.insert(ao);
     oid = aresult.first->object_id;

Modified: trunk/libs/serialization/src/basic_xml_grammar.ipp
==============================================================================
--- trunk/libs/serialization/src/basic_xml_grammar.ipp (original)
+++ trunk/libs/serialization/src/basic_xml_grammar.ipp 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -16,11 +16,20 @@
 #include <algorithm>
 #include <boost/config.hpp> // BOOST_DEDUCED_TYPENAME
 
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4511 4512)
+#endif
+
 // spirit stuff
 #include <boost/spirit/core/composite/operators.hpp>
 #include <boost/spirit/core/composite/actions.hpp>
 #include <boost/spirit/core/primitives/numerics.hpp>
 
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
 // for head_iterator test
 //#include <boost/bind.hpp>
 #include <boost/function.hpp>
@@ -43,6 +52,11 @@
 
 namespace xml { // anonymous
 
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4511 4512)
+#endif
+
 template<class T>
 struct assign_impl {
     T & t;
@@ -67,6 +81,9 @@
             ++b;
         }
     }
+ assign_impl<std::string> & operator=(
+ assign_impl<std::string> & rhs
+ );
     assign_impl(std::string & t_)
         : t(t_)
     {}
@@ -150,6 +167,10 @@
     {}
 };
 
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
 } // namespace anonymous
 
 template<class CharType>
@@ -171,10 +192,12 @@
     
     CharType val;
     do{
- val = is.get();
- arg += val;
+ BOOST_DEDUCED_TYPENAME basic_xml_grammar<CharType>::IStream::int_type
+ result = is.get();
         if(is.fail())
             return false;
+ val = static_cast<CharType>(result);
+ arg += val;
     }
     while(val != delimiter);
     

Modified: trunk/libs/serialization/src/extended_type_info.cpp
==============================================================================
--- trunk/libs/serialization/src/extended_type_info.cpp (original)
+++ trunk/libs/serialization/src/extended_type_info.cpp 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -32,6 +32,11 @@
 #define BOOST_SERIALIZATION_SOURCE
 #include <boost/serialization/extended_type_info.hpp>
 
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4511 4512)
+#endif
+
 namespace boost {
 namespace serialization {
 namespace detail {
@@ -63,6 +68,11 @@
 
 typedef std::multiset<const extended_type_info *, key_compare> ktmap;
 
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4511 4512)
+#endif
+
 class extended_type_info_arg : public extended_type_info
 {
     virtual bool
@@ -87,6 +97,10 @@
     }
 };
 
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
 } // namespace detail
 
 BOOST_SERIALIZATION_DECL(void)

Modified: trunk/libs/serialization/src/extended_type_info_typeid.cpp
==============================================================================
--- trunk/libs/serialization/src/extended_type_info_typeid.cpp (original)
+++ trunk/libs/serialization/src/extended_type_info_typeid.cpp 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -51,9 +51,9 @@
     // shortcut for common case
     if(this == & rhs)
         return false;
- return static_cast<bool>(m_ti->before(
+ return 0 != m_ti->before(
         *(static_cast<const extended_type_info_typeid_0 &>(rhs).m_ti)
- ));
+ );
 }
 
 BOOST_SERIALIZATION_DECL(bool)
@@ -63,10 +63,14 @@
     // shortcut for common case
     if(this == & rhs)
         return true;
- return static_cast<bool>(
+ return
+ // note: std::type_info == operator returns an int !!!
+ // the following permits conversion to bool without a warning.
+ ! (
         * m_ti
- == *(static_cast<const extended_type_info_typeid_0 &>(rhs).m_ti)
- );
+ != *(static_cast<const extended_type_info_typeid_0 &>(rhs).m_ti)
+ )
+ ;
 }
 
 BOOST_SERIALIZATION_DECL(BOOST_PP_EMPTY())
@@ -109,6 +113,11 @@
     m_ti = NULL;
 }
 
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4511 4512)
+#endif
+
 // this derivation is used for creating search arguments
 class extended_type_info_typeid_arg :
     public extended_type_info_typeid_0
@@ -127,6 +136,10 @@
     }
 };
 
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
 BOOST_SERIALIZATION_DECL(const extended_type_info *)
 extended_type_info_typeid_0::get_extended_type_info(
     const std::type_info & ti

Modified: trunk/libs/serialization/src/void_cast.cpp
==============================================================================
--- trunk/libs/serialization/src/void_cast.cpp (original)
+++ trunk/libs/serialization/src/void_cast.cpp 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -67,6 +67,11 @@
 typedef std::set<const void_caster *, void_caster_compare> set_type;
 typedef boost::serialization::singleton<set_type> void_caster_registry;
 
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4511 4512)
+#endif
+
 // implementation of shortcut void caster
 class void_caster_shortcut : public void_caster
 {
@@ -113,6 +118,10 @@
     }
 };
 
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
 void const *
 void_caster_shortcut::vbc_downcast(
     void const * const t
@@ -165,16 +174,21 @@
     return NULL;
 }
 
+#ifdef BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4511 4512)
+#endif
+
 // just used as a search key
 class void_caster_argument : public void_caster
 {
     virtual void const *
- upcast(void const * const t) const {
+ upcast(void const * const /*t*/) const {
         assert(false);
         return NULL;
     }
     virtual void const *
- downcast( void const * const t) const {
+ downcast( void const * const /*t*/) const {
         assert(false);
         return NULL;
     }
@@ -188,6 +202,10 @@
     ~void_caster_argument(){};
 };
 
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
 // implementation of void caster base class
 BOOST_SERIALIZATION_DECL(void)
 void_caster::recursive_register(bool includes_virtual_base) const {

Modified: trunk/libs/serialization/util/test.jam
==============================================================================
--- trunk/libs/serialization/util/test.jam (original)
+++ trunk/libs/serialization/util/test.jam 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -42,7 +42,7 @@
             <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
             <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
             <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
- <toolset>msvc-8.0:<cxxflags>"-wd4996"
+ <toolset>msvc:<cxxflags>"-wd4996"
             # toolset optimizations
             <toolset>gcc:<cxxflags>"-ftemplate-depth-255"
             <toolset>msvc:<cxxflags>"-Gy"

Modified: trunk/libs/serialization/vc7ide/test_iterators.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/test_iterators.vcproj (original)
+++ trunk/libs/serialization/vc7ide/test_iterators.vcproj 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -29,7 +29,7 @@
                                 TreatWChar_tAsBuiltInType="TRUE"
                                 ForceConformanceInForLoopScope="TRUE"
                                 RuntimeTypeInfo="TRUE"
- WarningLevel="3"
+ WarningLevel="4"
                                 Detect64BitPortabilityProblems="FALSE"
                                 DebugInformationFormat="1"
                                 CompileAs="0"/>

Modified: trunk/libs/serialization/vc7ide/test_polymorphic.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/test_polymorphic.vcproj (original)
+++ trunk/libs/serialization/vc7ide/test_polymorphic.vcproj 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -21,7 +21,7 @@
                                 Optimization="0"
                                 ImproveFloatingPointConsistency="TRUE"
                                 AdditionalIncludeDirectories="&quot;$(ProjectDir)..\..\..\&quot;"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_LIB_DIAGNOSTIC=1;BOOST_ALL_DYN_LINK=1"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_LIB_DIAGNOSTIC=1;BOOST_ALL_DYN_LINK=1;BOOST_ARCHIVE_TEST=polymorphic_text_archive.hpp"
                                 SmallerTypeCheck="TRUE"
                                 RuntimeLibrary="3"
                                 BufferSecurityCheck="TRUE"

Modified: trunk/libs/serialization/vc7ide/test_simple_class.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/test_simple_class.vcproj (original)
+++ trunk/libs/serialization/vc7ide/test_simple_class.vcproj 2009-11-27 16:25:18 EST (Fri, 27 Nov 2009)
@@ -29,7 +29,7 @@
                                 TreatWChar_tAsBuiltInType="TRUE"
                                 ForceConformanceInForLoopScope="TRUE"
                                 RuntimeTypeInfo="TRUE"
- WarningLevel="3"
+ WarningLevel="4"
                                 Detect64BitPortabilityProblems="FALSE"
                                 DebugInformationFormat="1"
                                 CompileAs="0"/>


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