Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51906 - in trunk/libs/serialization: performance src test vc7ide
From: ramey_at_[hidden]
Date: 2009-03-22 15:07:35


Author: ramey
Date: 2009-03-22 15:07:34 EDT (Sun, 22 Mar 2009)
New Revision: 51906
URL: http://svn.boost.org/trac/boost/changeset/51906

Log:
fix for virtual base classes
Text files modified:
   trunk/libs/serialization/performance/profile.sh | 6 +++---
   trunk/libs/serialization/src/void_cast.cpp | 20 ++++++++++++--------
   trunk/libs/serialization/test/test_diamond.cpp | 6 ++++--
   trunk/libs/serialization/test/test_shared_ptr.cpp | 2 +-
   trunk/libs/serialization/test/test_shared_ptr_132.cpp | 2 +-
   trunk/libs/serialization/test/test_tools.hpp | 8 ++++----
   trunk/libs/serialization/vc7ide/Library.vcproj | 3 ---
   trunk/libs/serialization/vc7ide/test_diamond.vcproj | 2 +-
   8 files changed, 26 insertions(+), 23 deletions(-)

Modified: trunk/libs/serialization/performance/profile.sh
==============================================================================
--- trunk/libs/serialization/performance/profile.sh (original)
+++ trunk/libs/serialization/performance/profile.sh 2009-03-22 15:07:34 EDT (Sun, 22 Mar 2009)
@@ -5,17 +5,17 @@
 # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 
-# runtest.sh --toolset=gcc --preserve-test-targets variant=profile
+# profile.sh --toolset=gcc preserve-test-targets=on variant=profile
 if test $# -eq 0
 then
     echo "Usage: $0 <bjam arguments>"
     echo "Typical bjam arguements are:"
- echo " --toolset=msvc-7.1,gcc"
+ echo " toolset=msvc-7.1,gcc"
     echo " link=static,shared"
     echo " threading=single,multi"
     echo " -sBOOST_ARCHIVE_LIST=<archive name>"
 else
- bjam --dump-tests --preserve-test-targets variant=profile $@ >bjam.log 2>&1
+ bjam --dump-tests variant=profile preserve-test-targets=on $@ >bjam.log 2>&1
     process_jam_log --v2 <bjam.log
 
     # for each test directory

Modified: trunk/libs/serialization/src/void_cast.cpp
==============================================================================
--- trunk/libs/serialization/src/void_cast.cpp (original)
+++ trunk/libs/serialization/src/void_cast.cpp 2009-03-22 15:07:34 EDT (Sun, 22 Mar 2009)
@@ -76,11 +76,12 @@
         extended_type_info const * derived,
         extended_type_info const * base,
         std::ptrdiff_t difference,
- bool m_includes_virtual_base
+ bool includes_virtual_base
     ) :
- void_caster(derived, base, difference)
+ void_caster(derived, base, difference),
+ m_includes_virtual_base(includes_virtual_base)
     {
- recursive_register(m_includes_virtual_base);
+ recursive_register(includes_virtual_base);
     }
     ~void_caster_shortcut(){
         recursive_unregister();
@@ -96,13 +97,16 @@
         = void_cast_detail::void_caster_registry::get_const_instance();
     void_cast_detail::set_type::const_iterator it;
     for(it = s.begin(); it != s.end(); ++it){
- // if the current candidate doesn't cast to the desired target type
+ // if the current candidate casts to the desired target type
         if ((*it)->m_derived == m_derived){
- // if the current candidate casts from the desired source type
+ // and if it's not us
             if ((*it)->m_base != m_base){
+ // try to cast from the candidate base to our base
                 const void * t_new;
                 t_new = void_downcast(*(*it)->m_base, *m_base, t);
+ // if we were successful
                 if(NULL != t_new)
+ // recast to our derived
                     return (*it)->downcast(t_new);
             }
         }
@@ -119,10 +123,11 @@
         = void_cast_detail::void_caster_registry::get_const_instance();
     void_cast_detail::set_type::const_iterator it;
     for(it = s.begin(); it != s.end(); ++it){
- // if the current candidate doesn't cast to the desired target type
+ // if the current candidate casts from the desired base type
         if((*it)->m_base == m_base){
- // if the current candidate casts from the desired source type
+ // and if it's not us
             if ((*it)->m_derived != m_derived){
+ // try to cast from the candidate derived to our our derived
                 const void * t_new;
                 t_new = void_upcast(*m_derived, *(*it)->m_derived, t);
                 if(NULL != t_new)
@@ -133,7 +138,6 @@
     return NULL;
 }
 
-
 // just used as a search key
 class void_caster_argument : public void_caster
 {

Modified: trunk/libs/serialization/test/test_diamond.cpp
==============================================================================
--- trunk/libs/serialization/test/test_diamond.cpp (original)
+++ trunk/libs/serialization/test/test_diamond.cpp 2009-03-22 15:07:34 EDT (Sun, 22 Mar 2009)
@@ -45,7 +45,8 @@
     void save(Archive &ar, const unsigned int /* file_version */) const
     {
         std::cout << "Saving base\n";
- ar << BOOST_SERIALIZATION_NVP(i) << BOOST_SERIALIZATION_NVP(m);
+ ar << BOOST_SERIALIZATION_NVP(i);
+ ar << BOOST_SERIALIZATION_NVP(m);
         ++save_count;
     }
 
@@ -53,7 +54,8 @@
     void load(Archive & ar, const unsigned int /* file_version */)
     {
         std::cout << "Restoring base\n";
- ar >> BOOST_SERIALIZATION_NVP(i) >> BOOST_SERIALIZATION_NVP(m);
+ ar >> BOOST_SERIALIZATION_NVP(i);
+ ar >> BOOST_SERIALIZATION_NVP(m);
         ++load_count;
     }
 

Modified: trunk/libs/serialization/test/test_shared_ptr.cpp
==============================================================================
--- trunk/libs/serialization/test/test_shared_ptr.cpp (original)
+++ trunk/libs/serialization/test/test_shared_ptr.cpp 2009-03-22 15:07:34 EDT (Sun, 22 Mar 2009)
@@ -97,7 +97,7 @@
     load(testfile, spa1);
 
     BOOST_CHECK(
- spa.get() == NULL && spa1.get() == NULL
+ (spa.get() == NULL && spa1.get() == NULL)
         || * spa == * spa1
     );
     std::remove(testfile);

Modified: trunk/libs/serialization/test/test_shared_ptr_132.cpp
==============================================================================
--- trunk/libs/serialization/test/test_shared_ptr_132.cpp (original)
+++ trunk/libs/serialization/test/test_shared_ptr_132.cpp 2009-03-22 15:07:34 EDT (Sun, 22 Mar 2009)
@@ -119,7 +119,7 @@
     load(testfile, spa1);
 
     BOOST_CHECK(
- spa.get() == NULL && spa1.get() == NULL
+ (spa.get() == NULL && spa1.get() == NULL)
         || * spa == * spa1
     );
     std::remove(testfile);

Modified: trunk/libs/serialization/test/test_tools.hpp
==============================================================================
--- trunk/libs/serialization/test/test_tools.hpp (original)
+++ trunk/libs/serialization/test/test_tools.hpp 2009-03-22 15:07:34 EDT (Sun, 22 Mar 2009)
@@ -29,7 +29,7 @@
 // Substitute a primitive implementation here.
 namespace boost {
 namespace archive {
- char * tmpnam(char * buffer){
+ const char * tmpnam(char * buffer){
         static char ibuffer [512];
         if(NULL == buffer)
             buffer = ibuffer;
@@ -72,7 +72,7 @@
 
 namespace boost {
 namespace archive {
- char * test_filename(char * dir = NULL, char *fname = NULL){
+ const char * test_filename(const char * dir = NULL, char *fname = NULL){
         static char ibuffer [512];
         int i;
         ibuffer[0] = '\0';
@@ -94,8 +94,8 @@
         }
         return ibuffer;
     }
- char * tmpnam(char * buffer){
- char * name = test_filename(NULL, NULL);
+ const char * tmpnam(char * buffer){
+ const char * name = test_filename(NULL, NULL);
         if(NULL != buffer){
             STRCPY(buffer, name);
         }

Modified: trunk/libs/serialization/vc7ide/Library.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/Library.vcproj (original)
+++ trunk/libs/serialization/vc7ide/Library.vcproj 2009-03-22 15:07:34 EDT (Sun, 22 Mar 2009)
@@ -674,9 +674,6 @@
                                 RelativePath="..\..\..\boost\serialization\force_include.hpp">
                         </File>
                         <File
- RelativePath="..\..\..\boost\serialization\is_virtual_base_of.hpp">
- </File>
- <File
                                 RelativePath="..\..\..\boost\serialization\pfto.hpp">
                         </File>
                         <File

Modified: trunk/libs/serialization/vc7ide/test_diamond.vcproj
==============================================================================
--- trunk/libs/serialization/vc7ide/test_diamond.vcproj (original)
+++ trunk/libs/serialization/vc7ide/test_diamond.vcproj 2009-03-22 15:07:34 EDT (Sun, 22 Mar 2009)
@@ -91,7 +91,7 @@
                                 IgnoreImportLibrary="TRUE"
                                 LinkIncremental="2"
                                 SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="&quot;$(ProjectDir)../../../bin.v2/libs/serialization/build/msvc-7.1/debug/link-static&quot;;&quot;$(ProjectDir)../../../bin.v2/libs/serialization/build/msvc-7.1/debug/link-static&quot;"
+ AdditionalLibraryDirectories="&quot;$(ProjectDir)../../../bin.v2/libs/serialization/build/msvc-7.1/debug/link-static&quot;"
                                 GenerateDebugInformation="TRUE"
                                 SubSystem="1"/>
                         <Tool


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