diff --git a/test/A.cpp b/test/A.cpp new file mode 100644 index 00000000..cc3111e1 --- /dev/null +++ b/test/A.cpp @@ -0,0 +1,213 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// A.cpp simple class test + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // rand() +#include // fabs() +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::rand; + using ::fabs; + using ::size_t; +} +#endif + +#include +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include "A.hpp" + +template +void randomize(S &x) +{ + assert(0 == x.size()); + for(;;){ + unsigned int i = std::rand() % 27; + if(0 == i) + break; + x += static_cast('a' - 1 + i); + } +} + +template +void accumulate(std::size_t & s, const T & t){ + const char * tptr = (const char *)(& t); + unsigned int count = sizeof(t); + while(count-- > 0){ + s += *tptr++; + } +} + +A::operator std::size_t () const { + std::size_t retval = 0; + accumulate(retval, b); + #ifndef BOOST_NO_INT64_T + accumulate(retval, f); + accumulate(retval, g); + #endif + accumulate(retval, l); + accumulate(retval, m); + accumulate(retval, n); + accumulate(retval, o); + accumulate(retval, p); + accumulate(retval, q); + #ifndef BOOST_NO_CWCHAR + accumulate(retval, r); + #endif + accumulate(retval, c); + accumulate(retval, s); + accumulate(retval, t); + accumulate(retval, u); + accumulate(retval, v); + return retval; +} + +A::A() : + b(true), + #ifndef BOOST_NO_INT64_T + f(std::rand() * std::rand()), + g(std::rand() * std::rand()), + #endif + l(static_cast(std::rand() % 3)), + m(std::rand()), + n(std::rand()), + o(std::rand()), + p(std::rand()), + q(std::rand()), + #ifndef BOOST_NO_CWCHAR + r(std::rand()), + #endif + c(std::rand()), + s(std::rand()), + t(std::rand()), + u(std::rand()), + v(std::rand()), + w((float)std::rand()), + x((double)std::rand()) +{ + randomize(y); + #ifndef BOOST_NO_STD_WSTRING + randomize(z); + #endif +} + +bool A::operator==(const A &rhs) const +{ + if(b != rhs.b) + return false; + if(l != rhs.l) + return false; + #ifndef BOOST_NO_INT64_T + if(f != rhs.f) + return false; + if(g != rhs.g) + return false; + #endif + if(m != rhs.m) + return false; + if(n != rhs.n) + return false; + if(o != rhs.o) + return false; + if(p != rhs.p) + return false; + if(q != rhs.q) + return false; + #ifndef BOOST_NO_CWCHAR + if(r != rhs.r) + return false; + #endif + if(c != rhs.c) + return false; + if(s != rhs.s) + return false; + if(t != rhs.t) + return false; + if(u != rhs.u) + return false; + if(v != rhs.v) + return false; + if(w == 0 && std::fabs(rhs.w) > std::numeric_limits::epsilon()) + return false; + if(std::fabs(rhs.w/w - 1.0) > std::numeric_limits::epsilon()) + return false; + if(x == 0 && std::fabs(rhs.x - x) > std::numeric_limits::epsilon()) + return false; + if(std::fabs(rhs.x/x - 1.0) > std::numeric_limits::epsilon()) + return false; + if(0 != y.compare(rhs.y)) + return false; + #ifndef BOOST_NO_STD_WSTRING + if(0 != z.compare(rhs.z)) + return false; + #endif + return true; +} + +inline bool A::operator!=(const A &rhs) const +{ + return ! (*this == rhs); +} + +inline bool A::operator<(const A &rhs) const +{ + if(b != rhs.b) + return b < rhs.b; + #ifndef BOOST_NO_INT64_T + if(f != rhs.f) + return f < rhs.f; + if(g != rhs.g) + return g < rhs.g; + #endif + if(l != rhs.l ) + return l < rhs.l; + if(m != rhs.m ) + return m < rhs.m; + if(n != rhs.n ) + return n < rhs.n; + if(o != rhs.o ) + return o < rhs.o; + if(p != rhs.p ) + return p < rhs.p; + if(q != rhs.q ) + return q < rhs.q; + #ifndef BOOST_NO_CWCHAR + if(r != rhs.r ) + return r < rhs.r; + #endif + if(c != rhs.c ) + return c < rhs.c; + if(s != rhs.s ) + return s < rhs.s; + if(t != rhs.t ) + return t < rhs.t; + if(u != rhs.u ) + return u < rhs.u; + if(v != rhs.v ) + return v < rhs.v; + if(w != rhs.w ) + return w < rhs.w; + if(x != rhs.x ) + return x < rhs.x; + int i = y.compare(rhs.y); + if(i != 0 ) + return i < 0; + #ifndef BOOST_NO_STD_WSTRING + int j = z.compare(rhs.z); + if(j != 0 ) + return j < 0; + #endif + return false; +} diff --git a/test/A.hpp b/test/A.hpp index 84a1ff32..a40d332b 100644 --- a/test/A.hpp +++ b/test/A.hpp @@ -16,83 +16,97 @@ // See http://www.boost.org for updates, documentation, and revision history. -#include -#include // for rand() -#include // for fabs() #include // size_t +#include + #include +#include + #if defined(BOOST_NO_STDC_NAMESPACE) namespace std{ - using ::rand; - using ::fabs; using ::size_t; } #endif -//#include #include #include -#include -#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) -#include +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + #include + #if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) + #include + #endif #endif #include #include -#include -class A +#ifndef DLL_DECL +#define DLL_DECL +#endif + +class DLL_DECL A { private: friend class boost::serialization::access; // note: from an aesthetic perspective, I would much prefer to have this // defined out of line. Unfortunately, this trips a bug in the VC 6.0 // compiler. So hold our nose and put it her to permit running of tests. + // mscvc 6.0 requires template functions to be implemented. For this + // reason we can't make abstract. + #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + template + void A::serialize( + Archive &ar, + const unsigned int /* file_version */ + ){ + ar & BOOST_SERIALIZATION_NVP(b); + #ifndef BOOST_NO_INT64_T + ar & BOOST_SERIALIZATION_NVP(f); + ar & BOOST_SERIALIZATION_NVP(g); + #endif + #if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 ) + int i; + if(Archive::is_saving::value){ + i = l; + ar & BOOST_SERIALIZATION_NVP(i); + } + else{ + ar & BOOST_SERIALIZATION_NVP(i); + l = i; + } + #else + ar & BOOST_SERIALIZATION_NVP(l); + #endif + ar & BOOST_SERIALIZATION_NVP(m); + ar & BOOST_SERIALIZATION_NVP(n); + ar & BOOST_SERIALIZATION_NVP(o); + ar & BOOST_SERIALIZATION_NVP(p); + ar & BOOST_SERIALIZATION_NVP(q); + #ifndef BOOST_NO_CWCHAR + ar & BOOST_SERIALIZATION_NVP(r); + #endif + ar & BOOST_SERIALIZATION_NVP(c); + ar & BOOST_SERIALIZATION_NVP(s); + ar & BOOST_SERIALIZATION_NVP(t); + ar & BOOST_SERIALIZATION_NVP(u); + ar & BOOST_SERIALIZATION_NVP(v); + ar & BOOST_SERIALIZATION_NVP(w); + ar & BOOST_SERIALIZATION_NVP(x); + ar & BOOST_SERIALIZATION_NVP(y); + #ifndef BOOST_NO_STD_WSTRING + ar & BOOST_SERIALIZATION_NVP(z); + #endif + } + #endif template - void serialize( + DLL_DECL void serialize( Archive &ar, const unsigned int /* file_version */ - ){ - ar & BOOST_SERIALIZATION_NVP(b); - #ifndef BOOST_NO_INT64_T - ar & BOOST_SERIALIZATION_NVP(f); - ar & BOOST_SERIALIZATION_NVP(g); - #endif - #if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 ) - int i; - if(Archive::is_saving::value){ - i = l; - ar & BOOST_SERIALIZATION_NVP(i); - } - else{ - ar & BOOST_SERIALIZATION_NVP(i); - l = i; - } - #else - ar & BOOST_SERIALIZATION_NVP(l); - #endif - ar & BOOST_SERIALIZATION_NVP(m); - ar & BOOST_SERIALIZATION_NVP(n); - ar & BOOST_SERIALIZATION_NVP(o); - ar & BOOST_SERIALIZATION_NVP(p); - ar & BOOST_SERIALIZATION_NVP(q); - #ifndef BOOST_NO_CWCHAR - ar & BOOST_SERIALIZATION_NVP(r); - #endif - ar & BOOST_SERIALIZATION_NVP(c); - ar & BOOST_SERIALIZATION_NVP(s); - ar & BOOST_SERIALIZATION_NVP(t); - ar & BOOST_SERIALIZATION_NVP(u); - ar & BOOST_SERIALIZATION_NVP(v); - ar & BOOST_SERIALIZATION_NVP(w); - ar & BOOST_SERIALIZATION_NVP(x); - ar & BOOST_SERIALIZATION_NVP(y); - #ifndef BOOST_NO_STD_WSTRING - ar & BOOST_SERIALIZATION_NVP(z); - #endif - } + ); bool b; #ifndef BOOST_NO_INT64_T boost::int64_t f; @@ -133,189 +147,4 @@ public: friend std::istream & operator>>(std::istream & is, A & a); }; -//BOOST_TEST_DONT_PRINT_LOG_VALUE(A); - -template -void randomize(S &x) -{ - assert(0 == x.size()); - for(;;){ - unsigned int i = std::rand() % 27; - if(0 == i) - break; - x += static_cast('a' - 1 + i); - } -} - -template -void accumulate(std::size_t & s, const T & t){ - const char * tptr = (const char *)(& t); - unsigned int count = sizeof(t); - while(count-- > 0){ - s += *tptr++; - } -} - -A::operator std::size_t () const { - std::size_t retval = 0; - accumulate(retval, b); - #ifndef BOOST_NO_INT64_T - accumulate(retval, f); - accumulate(retval, g); - #endif - accumulate(retval, l); - accumulate(retval, m); - accumulate(retval, n); - accumulate(retval, o); - accumulate(retval, p); - accumulate(retval, q); - #ifndef BOOST_NO_CWCHAR - accumulate(retval, r); - #endif - accumulate(retval, c); - accumulate(retval, s); - accumulate(retval, t); - accumulate(retval, u); - accumulate(retval, v); - return retval; -} - -inline A::A() : - b(true), - #ifndef BOOST_NO_INT64_T - f(std::rand() * std::rand()), - g(std::rand() * std::rand()), - #endif - l(static_cast(std::rand() % 3)), - m(std::rand()), - n(std::rand()), - o(std::rand()), - p(std::rand()), - q(std::rand()), - #ifndef BOOST_NO_CWCHAR - r(std::rand()), - #endif - c(std::rand()), - s(std::rand()), - t(std::rand()), - u(std::rand()), - v(std::rand()), - w((float)std::rand()), - x((double)std::rand()) -{ - randomize(y); - #ifndef BOOST_NO_STD_WSTRING - randomize(z); - #endif -} - -inline bool A::operator==(const A &rhs) const -{ - if(b != rhs.b) - return false; - if(l != rhs.l) - return false; - #ifndef BOOST_NO_INT64_T - if(f != rhs.f) - return false; - if(g != rhs.g) - return false; - #endif - if(m != rhs.m) - return false; - if(n != rhs.n) - return false; - if(o != rhs.o) - return false; - if(p != rhs.p) - return false; - if(q != rhs.q) - return false; - #ifndef BOOST_NO_CWCHAR - if(r != rhs.r) - return false; - #endif - if(c != rhs.c) - return false; - if(s != rhs.s) - return false; - if(t != rhs.t) - return false; - if(u != rhs.u) - return false; - if(v != rhs.v) - return false; - if(w == 0 && std::fabs(rhs.w) > std::numeric_limits::epsilon()) - return false; - if(std::fabs(rhs.w/w - 1.0) > std::numeric_limits::epsilon()) - return false; - if(x == 0 && std::fabs(rhs.x - x) > std::numeric_limits::epsilon()) - return false; - if(std::fabs(rhs.x/x - 1.0) > std::numeric_limits::epsilon()) - return false; - if(0 != y.compare(rhs.y)) - return false; - #ifndef BOOST_NO_STD_WSTRING - if(0 != z.compare(rhs.z)) - return false; - #endif - return true; -} - -inline bool A::operator!=(const A &rhs) const -{ - return ! (*this == rhs); -} - -inline bool A::operator<(const A &rhs) const -{ - if(b != rhs.b) - return b < rhs.b; - #ifndef BOOST_NO_INT64_T - if(f != rhs.f) - return f < rhs.f; - if(g != rhs.g) - return g < rhs.g; - #endif - if(l != rhs.l ) - return l < rhs.l; - if(m != rhs.m ) - return m < rhs.m; - if(n != rhs.n ) - return n < rhs.n; - if(o != rhs.o ) - return o < rhs.o; - if(p != rhs.p ) - return p < rhs.p; - if(q != rhs.q ) - return q < rhs.q; - #ifndef BOOST_NO_CWCHAR - if(r != rhs.r ) - return r < rhs.r; - #endif - if(c != rhs.c ) - return c < rhs.c; - if(s != rhs.s ) - return s < rhs.s; - if(t != rhs.t ) - return t < rhs.t; - if(u != rhs.u ) - return u < rhs.u; - if(v != rhs.v ) - return v < rhs.v; - if(w != rhs.w ) - return w < rhs.w; - if(x != rhs.x ) - return x < rhs.x; - int i = y.compare(rhs.y); - if(i != 0 ) - return i < 0; - #ifndef BOOST_NO_STD_WSTRING - int j = z.compare(rhs.z); - if(j != 0 ) - return j < 0; - #endif - return false; -} - #endif // BOOST_SERIALIZATION_TEST_A_HPP diff --git a/test/A.ipp b/test/A.ipp new file mode 100644 index 00000000..574e33b8 --- /dev/null +++ b/test/A.ipp @@ -0,0 +1,67 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// A.ipp simple class test + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1300) + +#include "A.hpp" + +#include +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include +#include + +template +void A::serialize( + Archive &ar, + const unsigned int /* file_version */ +){ + ar & BOOST_SERIALIZATION_NVP(b); + #ifndef BOOST_NO_INT64_T + ar & BOOST_SERIALIZATION_NVP(f); + ar & BOOST_SERIALIZATION_NVP(g); + #endif + #if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 ) + int i; + if(Archive::is_saving::value){ + i = l; + ar & BOOST_SERIALIZATION_NVP(i); + } + else{ + ar & BOOST_SERIALIZATION_NVP(i); + l = i; + } + #else + ar & BOOST_SERIALIZATION_NVP(l); + #endif + ar & BOOST_SERIALIZATION_NVP(m); + ar & BOOST_SERIALIZATION_NVP(n); + ar & BOOST_SERIALIZATION_NVP(o); + ar & BOOST_SERIALIZATION_NVP(p); + ar & BOOST_SERIALIZATION_NVP(q); + #ifndef BOOST_NO_CWCHAR + ar & BOOST_SERIALIZATION_NVP(r); + #endif + ar & BOOST_SERIALIZATION_NVP(c); + ar & BOOST_SERIALIZATION_NVP(s); + ar & BOOST_SERIALIZATION_NVP(t); + ar & BOOST_SERIALIZATION_NVP(u); + ar & BOOST_SERIALIZATION_NVP(v); + ar & BOOST_SERIALIZATION_NVP(w); + ar & BOOST_SERIALIZATION_NVP(x); + ar & BOOST_SERIALIZATION_NVP(y); + #ifndef BOOST_NO_STD_WSTRING + ar & BOOST_SERIALIZATION_NVP(z); + #endif +} + +#endif // workaround \ No newline at end of file diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 11b45d22..dfd4f016 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -13,6 +13,7 @@ project libs/serialization/test # import rules from the boost serialization test # import ../util/test : test-bsl-run-no-lib ; import ../util/test : + run-template run-invoke run-winvoke test-bsl-run-no-lib @@ -22,32 +23,19 @@ import ../util/test : test-bsl-run_polymorphic_archive ; -BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ; +if 0 { +lib dll_a + : dll_a.cpp + ../build//boost_serialization + : + msvc:/Gy + ; -rule run-template ( test-name : sources * : requirements * ) { - return [ - run - $(sources) - : # command - : # input files - : # requirements - # toolset suppress-warnings - gcc:"-Wno-non-virtual-dtor -Wno-ctor-dtor-privacy" - msvc-8.0:"-wd4996" - borland:"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008 -w-0018 -w-8066" - # toolset optimizations - gcc:"-ftemplate-depth-255" - msvc:"-Gy" - # toolset shared library support - como,shared:no - msvc,stlport,shared:no - cw,static:no - $(requirements) - : # test name - $(test-name) - ] ; +test-suite "xxx" : [ run-template test_dll_one : test_dll_one.cpp dll_a ] ; } +BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ; + test-suite "serialization" : [ test-bsl-run_files test_array ] [ test-bsl-run_files test_binary ] diff --git a/test/base.hpp b/test/base.hpp new file mode 100644 index 00000000..ddf2767d --- /dev/null +++ b/test/base.hpp @@ -0,0 +1,38 @@ +#ifndef BOOST_SERIALIZATION_TEST_BASE_HPP +#define BOOST_SERIALIZATION_TEST_BASE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// base.hpp simple class test + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include + +#ifndef DLL_DECL +#define DLL_DECL +#endif + +class DLL_DECL polymorphic_base +{ + friend class boost::serialization::access; + template + void serialize(Archive & /* ar */, const unsigned int /* file_version */); +public: + // msvc 7.1 has a link time problem with making this abstract - look in to this + virtual ~polymorphic_base() {} /* = 0 */; +}; + +//BOOST_IS_ABSTRACT(polymorphic_base) + +#endif // BOOST_SERIALIZATION_TEST_BASE_HPP diff --git a/test/derived2.hpp b/test/derived2.hpp new file mode 100644 index 00000000..8eb9d614 --- /dev/null +++ b/test/derived2.hpp @@ -0,0 +1,39 @@ +#ifndef BOOST_SERIALIZATION_TEST_DERIVED2_HPP +#define BOOST_SERIALIZATION_TEST_DERIVED2_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// derived2.hpp simple class test + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include "base.hpp" + +#ifndef DLL_DECL +#define DLL_DECL +#endif + +class DLL_DECL polymorphic_derived2 : public polymorphic_base +{ + friend class boost::serialization::access; + template + void serialize(Archive &ar, const unsigned int /* file_version */); +public: + ~polymorphic_derived2(){} +}; + +// MWerks users can do this to make their code work +BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived2) + +#endif // BOOST_SERIALIZATION_TEST_DERIVED2_HPP diff --git a/test/dll_a.cpp b/test/dll_a.cpp new file mode 100644 index 00000000..bda48dc1 --- /dev/null +++ b/test/dll_a.cpp @@ -0,0 +1,50 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// dll_a.cpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Build a dll which contains the serialization for a class A +// used in testing distribution of serialization code in DLLS +#include "test_decl.hpp" + +#define DLL_DECL EXPORT_DECL(BOOST_PP_EMPTY()) +#include "A.hpp" +#include "A.ipp" +#include "A.cpp" +#undef DLL_DECL + +// instantiate code for text archives + +#include +#include + +template +EXPORT_DECL(void) A::serialize( + boost::archive::text_oarchive &ar, + const unsigned int /* file_version */ +); +template +EXPORT_DECL(void) A::serialize( + boost::archive::text_iarchive &ar, + const unsigned int /* file_version */ +); + +// instantiate code for polymorphic archives + +#include +#include + +template +EXPORT_DECL(void) A::serialize( + boost::archive::polymorphic_oarchive &ar, + const unsigned int /* file_version */ +); +template +EXPORT_DECL(void) A::serialize( + boost::archive::polymorphic_iarchive &ar, + const unsigned int /* file_version */ +); + diff --git a/test/dll_base.cpp b/test/dll_base.cpp new file mode 100644 index 00000000..5a2bbf2c --- /dev/null +++ b/test/dll_base.cpp @@ -0,0 +1,61 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// dll_base.cpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Build a dll which contains the serialization for a class A +// used in testing distribution of serialization code in DLLS +#include + +#include "test_decl.hpp" +#define DLL_DECL EXPORT_DECL(BOOST_PP_EMPTY()) +#include "base.hpp" +#undef DLL_DECL + +// instantiate code for text archives + +#include + +template +void polymorphic_base::serialize( + Archive &ar, + const unsigned int /* file_version */){ +} + +// for some reason this is required at least by MSVC +// given that its declared virtual .. = 0; This +// seems wrong to me but here it is. +polymorphic_base::~polymorphic_base(){} + +// instantiate code for text archives +#include +#include + +// instantiate code for polymorphic archives +#include +#include + +// note: BOOST_CLASS_EXPORT cannot be used to instantiate +// serialization code for an abstract base class. So use +// explicit instantiation in this case. +//BOOST_CLASS_EXPORT(polymorphic_base) + +template EXPORT_DECL(void) polymorphic_base::serialize( + boost::archive::text_oarchive & ar, + const unsigned int version +); +template EXPORT_DECL(void) polymorphic_base::serialize( + boost::archive::text_iarchive & ar, + const unsigned int version +); +template EXPORT_DECL(void) polymorphic_base::serialize( + boost::archive::polymorphic_oarchive & ar, + const unsigned int version +); +template EXPORT_DECL(void) polymorphic_base::serialize( + boost::archive::polymorphic_iarchive & ar, + const unsigned int version +); diff --git a/test/dll_derived2.cpp b/test/dll_derived2.cpp new file mode 100644 index 00000000..bd124777 --- /dev/null +++ b/test/dll_derived2.cpp @@ -0,0 +1,39 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// dll_derived2.cpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// Build a dll which contains the serialization for a class A +// used in testing distribution of serialization code in DLLS +#include "test_decl.hpp" + +#define DLL_DECL IMPORT_DECL +#include "base.hpp" +#undef DLL_DECL + +#define DLL_DECL EXPORT_DECL(BOOST_PP_EMPTY()) +#include "derived2.hpp" +#undef DLL_DECL + +#include +template +void polymorphic_derived2::serialize( + Archive &ar, + const unsigned int /* file_version */ +){ + ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base); +} + +// instantiate code for text archives +#include +#include + +// instantiate code for polymorphic archives +#include +#include + +// note: export has to be AFTER #includes for all archive classes +BOOST_CLASS_EXPORT(polymorphic_derived2) diff --git a/test/test_array.cpp b/test/test_array.cpp index 9335169a..7f65b372 100644 --- a/test/test_array.cpp +++ b/test/test_array.cpp @@ -21,8 +21,8 @@ namespace std{ #include #include -#include #include "A.hpp" +#include "A.ipp" struct array_equal_to //: public std::binary_function { diff --git a/test/test_cyclic_ptrs.cpp b/test/test_cyclic_ptrs.cpp index 5e3cb711..b08f2c31 100644 --- a/test/test_cyclic_ptrs.cpp +++ b/test/test_cyclic_ptrs.cpp @@ -27,6 +27,7 @@ namespace std{ #include #include "A.hpp" +#include "A.ipp" /////////////////////////////////////////////////////// // class with a member which refers to itself diff --git a/test/test_decl.hpp b/test/test_decl.hpp new file mode 100644 index 00000000..76f1d90a --- /dev/null +++ b/test/test_decl.hpp @@ -0,0 +1,60 @@ +#ifndef BOOST_TEST_DECL_HPP +#define BOOST_TEST_DECL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2///////// 3/////////4/////////5/////////6/////////7/////////8 +// test_decl.hpp +// +// © Copyright Robert Ramey 2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See library home page at http://www.boost.org/libs/serialization +// export if this is our own source, otherwise import: + +// usage: +// class header declarations should look something like: +// class DLL_DECL A { +// ... +// }; +// +// code which includes such headers should look something like: +// +// #define DLL_DECL IMPORT_DECL +// #include "A.hpp" +// #undef DLL_DECL +// +// for declarations used in dlls for exporting, and +// +// #define DLL_DECL EXPORT_DECL +// #include "A.hpp" +// #include "A.ipp" +// #undef DLL_DECL +// +// when a declaration is to be imported. +#include +#include + +#ifdef BOOST_HAS_DECLSPEC // defined in config system + #if ! defined(EXPORT_DECL) + #if defined(__BORLANDC__) + #define EXPORT_DECL(T) T __export + #else + #define EXPORT_DECL(T) __declspec(dllexport) T + #endif + #endif + #if ! defined(IMPORT_DECL) + #if defined(__BORLANDC__) + #define IMPORT_DECL __import + #else + #define IMPORT_DECL __declspec(dllimport) + #endif + #endif +#endif // BOOST_HAS_DECLSPEC + +#endif // BOOST_TEST_DECL_HPP diff --git a/test/test_deque.cpp b/test/test_deque.cpp index 953d7015..81436e31 100644 --- a/test/test_deque.cpp +++ b/test/test_deque.cpp @@ -22,7 +22,9 @@ namespace std{ #include "test_tools.hpp" #include + #include "A.hpp" +#include "A.ipp" int test_main( int /* argc */, char* /* argv */[] ) { diff --git a/test/test_dll_exported.cpp b/test/test_dll_exported.cpp new file mode 100644 index 00000000..c494c17c --- /dev/null +++ b/test/test_dll_exported.cpp @@ -0,0 +1,117 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// test_exported.cpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// should pass compilation and execution + +#include + +#include // remove +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::remove; +} +#endif + +#include +#include "test_tools.hpp" +#include "test_decl.hpp" + +#define DLL_DECL IMPORT_DECL +#include "base.hpp" +#undef DLL_DECL + +#include +#include +#include +#include + +class polymorphic_derived1 : public polymorphic_base +{ + friend class boost::serialization::access; + template + void serialize(Archive &ar, const unsigned int /* file_version */){ + ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base); + } +public: + virtual ~polymorphic_derived1(){} +}; + +BOOST_CLASS_EXPORT(polymorphic_derived1) + +// MWerks users can do this to make their code work +BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived1) + +#define DLL_DECL IMPORT_DECL +#include "derived2.hpp" +#undef DLL_DECL + +// save exported polymorphic class +void save_exported(const char *testfile) +{ + test_ostream os(testfile, TEST_STREAM_FLAGS); + test_oarchive oa(os, TEST_ARCHIVE_FLAGS); + + polymorphic_base *rb1 = new polymorphic_derived1; + polymorphic_base *rb2 = new polymorphic_derived2; + + // export will permit correct serialization + // through a pointer to a base class + oa << BOOST_SERIALIZATION_NVP(rb1); + oa << BOOST_SERIALIZATION_NVP(rb2); + + delete rb1; + delete rb2; +} + +// save exported polymorphic class +void load_exported(const char *testfile) +{ + test_istream is(testfile, TEST_STREAM_FLAGS); + test_iarchive ia(is, TEST_ARCHIVE_FLAGS); + + polymorphic_base *rb1 = NULL; + polymorphic_base *rb2 = NULL; + + // export will permit correct serialization + // through a pointer to a base class + ia >> BOOST_SERIALIZATION_NVP(rb1); + BOOST_CHECK_MESSAGE( + boost::serialization::type_info_implementation + ::type::get_const_instance() + == + * boost::serialization::type_info_implementation + ::type::get_const_instance().get_derived_extended_type_info(*rb1), + "restored pointer b1 not of correct type" + ); + ia >> BOOST_SERIALIZATION_NVP(rb2); + BOOST_CHECK_MESSAGE( + boost::serialization::type_info_implementation + ::type::get_const_instance() + == + * boost::serialization::type_info_implementation + ::type::get_const_instance().get_derived_extended_type_info(*rb2), + "restored pointer b2 not of correct type" + ); + delete rb1; + delete rb2; +} + +int +test_main( int /* argc */, char* /* argv */[] ) +{ + const char * testfile = boost::archive::tmpnam(NULL); + BOOST_REQUIRE(NULL != testfile); + + save_exported(testfile); + load_exported(testfile); + std::remove(testfile); + return EXIT_SUCCESS; +} + +// EOF diff --git a/test/test_dll_simple.cpp b/test/test_dll_simple.cpp new file mode 100644 index 00000000..e81fcedd --- /dev/null +++ b/test/test_dll_simple.cpp @@ -0,0 +1,235 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// test_dll_simple.cpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// should pass compilation and execution + +// invoke header for a custom archive test. + +#include + +#include // remove +#include + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::remove; +} +#endif + +#include "test_tools.hpp" + +#include +#include + +#include +#include + +#include "test_decl.hpp" +#define DLL_DECL IMPORT_DECL +#include "A.hpp" +#undef DLL_DECL + +// simple class with text archive compiled in dll +void +test1(){ + const char * testfile = boost::archive::tmpnam(NULL); + BOOST_REQUIRE(NULL != testfile); + + A a, a1; + { + test_ostream os(testfile, TEST_STREAM_FLAGS); + boost::archive::text_oarchive oa(os, TEST_ARCHIVE_FLAGS); + oa << boost::serialization::make_nvp("a", a); + } + { + test_istream is(testfile, TEST_STREAM_FLAGS); + boost::archive::text_iarchive ia(is, TEST_ARCHIVE_FLAGS); + ia >> boost::serialization::make_nvp("a", a1); + } + BOOST_CHECK_EQUAL(a, a1); + + std::remove(testfile); +} + +// simple class with polymorphic archive compiled in dll +void +test2(){ + const char * testfile = boost::archive::tmpnam(NULL); + BOOST_REQUIRE(NULL != testfile); + + A a, a1; + { + test_ostream os(testfile, TEST_STREAM_FLAGS); + boost::archive::polymorphic_text_oarchive oa(os, TEST_ARCHIVE_FLAGS); + oa << boost::serialization::make_nvp("a", a); + } + { + test_istream is(testfile, TEST_STREAM_FLAGS); + boost::archive::polymorphic_text_iarchive ia(is, TEST_ARCHIVE_FLAGS); + ia >> boost::serialization::make_nvp("a", a1); + } + BOOST_CHECK_EQUAL(a, a1); + + std::remove(testfile); +} + +// simple class pointer with text archive compiled in dll +void +test3(){ + const char * testfile = boost::archive::tmpnam(NULL); + BOOST_REQUIRE(NULL != testfile); + + A *a = & A(); + A *a1; + { + test_ostream os(testfile, TEST_STREAM_FLAGS); + boost::archive::text_oarchive oa(os, TEST_ARCHIVE_FLAGS); + oa << boost::serialization::make_nvp("a", a); + } + { + test_istream is(testfile, TEST_STREAM_FLAGS); + boost::archive::text_iarchive ia(is, TEST_ARCHIVE_FLAGS); + ia >> boost::serialization::make_nvp("a", a1); + } + BOOST_CHECK_EQUAL(*a, *a1); + + std::remove(testfile); +} + +// simple class pointer with polymorphic archive compiled in dll +void +test4(){ + const char * testfile = boost::archive::tmpnam(NULL); + BOOST_REQUIRE(NULL != testfile); + + A *a = & A(); + A *a1; + { + test_ostream os(testfile, TEST_STREAM_FLAGS); + boost::archive::polymorphic_text_oarchive oa(os, TEST_ARCHIVE_FLAGS); + oa << boost::serialization::make_nvp("a", a); + } + { + test_istream is(testfile, TEST_STREAM_FLAGS); + boost::archive::polymorphic_text_iarchive ia(is, TEST_ARCHIVE_FLAGS); + ia >> boost::serialization::make_nvp("a", a1); + } + BOOST_CHECK_EQUAL(*a, *a1); + + std::remove(testfile); +} + +#define DLL_DECL IMPORT_DECL +#include "B.hpp" +#undef DLL_DECL + +// derived class with base text archive compiled in dll +void +test5(){ + const char * testfile = boost::archive::tmpnam(NULL); + BOOST_REQUIRE(NULL != testfile); + + B b, b1; + { + test_ostream os(testfile, TEST_STREAM_FLAGS); + boost::archive::text_oarchive oa(os, TEST_ARCHIVE_FLAGS); + oa << boost::serialization::make_nvp("b", b); + } + { + test_istream is(testfile, TEST_STREAM_FLAGS); + boost::archive::text_iarchive ia(is, TEST_ARCHIVE_FLAGS); + ia >> boost::serialization::make_nvp("b", b1); + } + BOOST_CHECK_EQUAL(b, b1); + + std::remove(testfile); +} + +// derived class with base base compiled with polymorphic archive in dll +void +test6(){ + const char * testfile = boost::archive::tmpnam(NULL); + BOOST_REQUIRE(NULL != testfile); + + B b, b1; + { + test_ostream os(testfile, TEST_STREAM_FLAGS); + boost::archive::polymorphic_text_oarchive oa(os, TEST_ARCHIVE_FLAGS); + oa << boost::serialization::make_nvp("b", b); + } + { + test_istream is(testfile, TEST_STREAM_FLAGS); + boost::archive::polymorphic_text_iarchive ia(is, TEST_ARCHIVE_FLAGS); + ia >> boost::serialization::make_nvp("b", b1); + } + BOOST_CHECK_EQUAL(b, b1); + + std::remove(testfile); +} + +// derived class pointer with base text archive compiled in dll +void +test7(){ + const char * testfile = boost::archive::tmpnam(NULL); + BOOST_REQUIRE(NULL != testfile); + + B *b = & B(); + B *b1; + { + test_ostream os(testfile, TEST_STREAM_FLAGS); + boost::archive::text_oarchive oa(os, TEST_ARCHIVE_FLAGS); + oa << boost::serialization::make_nvp("b", b); + } + { + test_istream is(testfile, TEST_STREAM_FLAGS); + boost::archive::text_iarchive ia(is, TEST_ARCHIVE_FLAGS); + ia >> boost::serialization::make_nvp("b", b1); + } + BOOST_CHECK_EQUAL(*b, *b1); + + std::remove(testfile); +} + +// derived class pointer with base polymorphic archive compiled in dll +void +test8(){ + const char * testfile = boost::archive::tmpnam(NULL); + BOOST_REQUIRE(NULL != testfile); + + B *b = & B(); + B *b1; + { + test_ostream os(testfile, TEST_STREAM_FLAGS); + boost::archive::polymorphic_text_oarchive oa(os, TEST_ARCHIVE_FLAGS); + oa << boost::serialization::make_nvp("b", b); + } + { + test_istream is(testfile, TEST_STREAM_FLAGS); + boost::archive::polymorphic_text_iarchive ia(is, TEST_ARCHIVE_FLAGS); + ia >> boost::serialization::make_nvp("b", b1); + } + BOOST_CHECK_EQUAL(*b, *b1); + + std::remove(testfile); +} + + +int +test_main( int /* argc */, char* /* argv */[] ) +{ + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + return EXIT_SUCCESS; +} + diff --git a/test/test_exported.cpp b/test/test_exported.cpp index 59847863..13b1e033 100644 --- a/test/test_exported.cpp +++ b/test/test_exported.cpp @@ -25,17 +25,13 @@ namespace std{ #include #include "test_tools.hpp" -class polymorphic_base -{ - friend class boost::serialization::access; - template - void serialize(Archive & /* ar */, const unsigned int /* file_version */){ - } -public: - virtual ~polymorphic_base(){}; -}; +#include "base.hpp" -BOOST_IS_ABSTRACT(polymorphic_base) +template +void polymorphic_base::serialize( + Archive &ar, + const unsigned int /* file_version */){ +} class polymorphic_derived1 : public polymorphic_base { @@ -45,7 +41,7 @@ class polymorphic_derived1 : public polymorphic_base ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base); } public: - virtual ~polymorphic_derived1(){} + ~polymorphic_derived1(){} }; BOOST_CLASS_EXPORT(polymorphic_derived1) @@ -53,22 +49,17 @@ BOOST_CLASS_EXPORT(polymorphic_derived1) // MWerks users can do this to make their code work BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived1) -class polymorphic_derived2 : public polymorphic_base -{ - friend class boost::serialization::access; - template - void serialize(Archive &ar, const unsigned int /* file_version */){ - ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base); - } -public: - virtual ~polymorphic_derived2(){} -}; +#include "derived2.hpp" +template +void polymorphic_derived2::serialize( + Archive &ar, + const unsigned int /* file_version */ +){ + ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base); +} BOOST_CLASS_EXPORT(polymorphic_derived2) -// MWerks users can do this to make their code work -BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived2) - // save exported polymorphic class void save_exported(const char *testfile) { @@ -100,20 +91,20 @@ void load_exported(const char *testfile) // through a pointer to a base class ia >> BOOST_SERIALIZATION_NVP(rb1); BOOST_CHECK_MESSAGE( - & boost::serialization::type_info_implementation + boost::serialization::type_info_implementation ::type::get_const_instance() == - boost::serialization::type_info_implementation + * boost::serialization::type_info_implementation ::type::get_const_instance().get_derived_extended_type_info(*rb1), "restored pointer b1 not of correct type" ); ia >> BOOST_SERIALIZATION_NVP(rb2); BOOST_CHECK_MESSAGE( - & boost::serialization::type_info_implementation + boost::serialization::type_info_implementation ::type::get_const_instance() == - boost::serialization::type_info_implementation + * boost::serialization::type_info_implementation ::type::get_const_instance().get_derived_extended_type_info(*rb2), "restored pointer b2 not of correct type" ); diff --git a/test/test_list.cpp b/test/test_list.cpp index 93f87145..9fad4178 100644 --- a/test/test_list.cpp +++ b/test/test_list.cpp @@ -27,6 +27,7 @@ namespace std{ #endif #include "A.hpp" +#include "A.ipp" int test_main( int /* argc */, char* /* argv */[] ) { diff --git a/test/test_list_ptrs.cpp b/test/test_list_ptrs.cpp index 7170e8bc..3f213a51 100644 --- a/test/test_list_ptrs.cpp +++ b/test/test_list_ptrs.cpp @@ -32,6 +32,7 @@ namespace std{ #include #include "A.hpp" +#include "A.ipp" template struct ptr_equal_to : public std::binary_function diff --git a/test/test_map.cpp b/test/test_map.cpp index 8afa5847..290b127e 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -30,6 +30,7 @@ namespace std{ #include #include "A.hpp" +#include "A.ipp" /////////////////////////////////////////////////////// // a key value initialized with a random value for use diff --git a/test/test_mult_archive_types.cpp b/test/test_mult_archive_types.cpp index 29391257..d7bb272e 100644 --- a/test/test_mult_archive_types.cpp +++ b/test/test_mult_archive_types.cpp @@ -42,6 +42,7 @@ public: virtual ~A(){--count;} // default destructor }; +BOOST_CLASS_EXPORT(A) // B is a subclass of A class B : public A @@ -59,7 +60,6 @@ public: virtual ~B() {}; }; -BOOST_CLASS_EXPORT(A) BOOST_CLASS_EXPORT(B) int A::count = 0; diff --git a/test/test_no_rtti.cpp b/test/test_no_rtti.cpp index 51f2d417..a9160e98 100644 --- a/test/test_no_rtti.cpp +++ b/test/test_no_rtti.cpp @@ -55,7 +55,7 @@ BOOST_CLASS_TYPE_INFO( extended_type_info_no_rtti ) // note: types which use ...no_rtti MUST be exported -BOOST_CLASS_EXPORT(polymorphic_base) +// BOOST_CLASS_EXPORT(polymorphic_base) class polymorphic_derived1 : public polymorphic_base { diff --git a/test/test_optional.cpp b/test/test_optional.cpp index efa6f46a..552ec6ec 100644 --- a/test/test_optional.cpp +++ b/test/test_optional.cpp @@ -25,6 +25,7 @@ namespace std{ #include #include "A.hpp" +#include "A.ipp" int test_main( int /* argc */, char* /* argv */[] ) { diff --git a/test/test_polymorphic_A.cpp b/test/test_polymorphic_A.cpp index 9eb7eda2..c7c598ca 100644 --- a/test/test_polymorphic_A.cpp +++ b/test/test_polymorphic_A.cpp @@ -8,7 +8,9 @@ #include "test_polymorphic_A.hpp" #include + #include "A.hpp" +#include "A.ipp" data::data() : a(new A) diff --git a/test/test_reset_object_address.cpp b/test/test_reset_object_address.cpp index 28207476..b1eb60f9 100644 --- a/test/test_reset_object_address.cpp +++ b/test/test_reset_object_address.cpp @@ -35,6 +35,7 @@ namespace std{ // simple test of untracked value #include "A.hpp" +#include "A.ipp" void test1(){ std::stringstream ss; diff --git a/test/test_set.cpp b/test/test_set.cpp index 39f37bb7..957a26ef 100644 --- a/test/test_set.cpp +++ b/test/test_set.cpp @@ -30,6 +30,7 @@ namespace std{ #include #include "A.hpp" +#include "A.ipp" void test_set(){ diff --git a/test/test_simple_class.cpp b/test/test_simple_class.cpp index be6dbd04..59a4a915 100644 --- a/test/test_simple_class.cpp +++ b/test/test_simple_class.cpp @@ -23,8 +23,8 @@ namespace std{ #include "test_tools.hpp" -#include #include "A.hpp" +#include "A.ipp" int test_main( int /* argc */, char* /* argv */[] ) diff --git a/test/test_simple_class_ptr.cpp b/test/test_simple_class_ptr.cpp index aeb62bd7..ac0bef20 100644 --- a/test/test_simple_class_ptr.cpp +++ b/test/test_simple_class_ptr.cpp @@ -21,6 +21,7 @@ namespace std{ #include "test_tools.hpp" #include "A.hpp" +#include "A.ipp" int test_main( int /* argc */, char* /* argv */[] ) { diff --git a/test/test_tools.hpp b/test/test_tools.hpp index e4c11207..8c46f43f 100644 --- a/test/test_tools.hpp +++ b/test/test_tools.hpp @@ -82,30 +82,6 @@ namespace archive { } return name; } -#if 0 - char * tmpnam(char * buffer){ - char old_dir[256]; - _getcwd(old_dir, sizeof(old_dir) - 1); - - char * temp_dir = boost::archive::tmpdir(); - chdir(temp_dir); - - char temp_name[256]; - std::tmpnam(temp_name); - - chdir(old_dir); - static char ibuffer [512]; - - if(NULL == buffer) - buffer = ibuffer; - - STRCPY(buffer, temp_dir); - std::strcat(buffer, temp_name); - return buffer; - } -#endif - - } // archive } // boost @@ -177,22 +153,23 @@ int test_main(int argc, char * argv[]); int main(int argc, char * argv[]){ - boost::serialization::global_lock::get_mutable_instance().lock(); + + boost::serialization::singleton_module::lock(); BOOST_TRY{ test_main(argc, argv); } #ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE BOOST_CATCH(const std::exception e){ - BOOST_FAIL(e.what()); + BOOST_ERROR(e.what()); } #endif BOOST_CATCH(...){ - BOOST_FAIL("failed with uncaught exception:"); + BOOST_ERROR("failed with uncaught exception:"); } BOOST_CATCH_END - boost::serialization::global_lock::get_mutable_instance().unlock(); + boost::serialization::singleton_module::unlock(); return boost::report_errors(); } @@ -218,9 +195,6 @@ main(int argc, char * argv[]){ #define BOOST_ARCHIVE_TEST text_archive.hpp #endif -//#undef BOOST_ARCHIVE_TEST -//#define BOOST_ARCHIVE_TEST portable_le_binary_archive.hpp - #include #include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST) diff --git a/test/test_variant.cpp b/test/test_variant.cpp index b64857ac..0e5e4b2a 100644 --- a/test/test_variant.cpp +++ b/test/test_variant.cpp @@ -42,6 +42,7 @@ namespace std{ #include #include "A.hpp" +#include "A.ipp" class are_equal : public boost::static_visitor diff --git a/test/test_vector.cpp b/test/test_vector.cpp index a1872a64..8f140b6a 100644 --- a/test/test_vector.cpp +++ b/test/test_vector.cpp @@ -23,6 +23,7 @@ namespace std{ #include #include "A.hpp" +#include "A.ipp" template int test_vector(T) diff --git a/test/test_void_cast.cpp b/test/test_void_cast.cpp index f2608b9f..3c06c194 100644 --- a/test/test_void_cast.cpp +++ b/test/test_void_cast.cpp @@ -10,6 +10,7 @@ #include "test_tools.hpp" #include #include +#include class Base1 { @@ -33,8 +34,9 @@ class MostDerived : public Derived template const boost::serialization::extended_type_info & eti(){ - return boost::serialization::extended_type_info_typeid - ::get_const_instance(); + return boost::serialization::singleton< + boost::serialization::extended_type_info_typeid + >::get_const_instance(); } int