From 543bb5589d310ae6f2a0df3ccdcf53cf41277b38 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Tue, 28 Aug 2018 11:39:18 +0200 Subject: [PATCH 01/16] test_dll_exported: Define polymorphic_derived2 methods in SO so the linker doesn't remove references to it --- test/polymorphic_derived2.cpp | 4 ++++ test/polymorphic_derived2.hpp | 5 +++++ test/test_dll_exported.cpp | 1 + 3 files changed, 10 insertions(+) diff --git a/test/polymorphic_derived2.cpp b/test/polymorphic_derived2.cpp index 528d0f5d5a..97ab89aba0 100644 --- a/test/polymorphic_derived2.cpp +++ b/test/polymorphic_derived2.cpp @@ -16,8 +16,12 @@ #include "polymorphic_base.hpp" #define POLYMORPHIC_DERIVED2_EXPORT +#define POLYMORPHIC_DERIVED2_EXTERNAL_DEF #include "polymorphic_derived2.hpp" +polymorphic_derived2::polymorphic_derived2(){} +polymorphic_derived2::~polymorphic_derived2(){} + // instantiate code for text archives #include #include diff --git a/test/polymorphic_derived2.hpp b/test/polymorphic_derived2.hpp index c4dcdaf165..6dc4830f42 100644 --- a/test/polymorphic_derived2.hpp +++ b/test/polymorphic_derived2.hpp @@ -55,8 +55,13 @@ class POLYMORPHIC_DERIVED2_DLL_DECL polymorphic_derived2 : return "polymorphic_derived2"; } public: +#ifdef POLYMORPHIC_DERIVED2_EXTERNAL_DEF + polymorphic_derived2(); + ~polymorphic_derived2(); +#else polymorphic_derived2(){} ~polymorphic_derived2(){} +#endif }; // we use this because we want to assign a key to this type diff --git a/test/test_dll_exported.cpp b/test/test_dll_exported.cpp index 4360b68250..bc985feace 100644 --- a/test/test_dll_exported.cpp +++ b/test/test_dll_exported.cpp @@ -68,6 +68,7 @@ BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived1) BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived1) #define POLYMORPHIC_DERIVED2_IMPORT +#define POLYMORPHIC_DERIVED2_EXTERNAL_DEF #include "polymorphic_derived2.hpp" // save exported polymorphic class From 565926e56033e17dd6541713d8a3916a357511e0 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 29 Aug 2018 15:15:27 +0200 Subject: [PATCH 02/16] test: test_codecvt_null uses a symbol from boost_wserialization --- test/Jamfile.v2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index e8c07963ee..eb1bb5fba3 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -146,7 +146,7 @@ if ! $(BOOST_ARCHIVE_LIST) { [ test-bsl-run test_iterators ] [ test-bsl-run test_iterators_base64 ] [ test-bsl-run test_smart_cast ] - [ test-bsl-run test_codecvt_null ] + [ test-bsl-run test_codecvt_null : : ../build//boost_wserialization ] [ test-bsl-run test_singleton ] # [ test-bsl-run test_z ] From 962f154b12a6ce5d59dff76bc671cbfbf4a7722a Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 29 Aug 2018 15:37:58 +0200 Subject: [PATCH 03/16] Set a blanket symbol visibilty of 'hidden', explicitly expose some symbols --- include/boost/archive/detail/abi_prefix.hpp | 4 +++ include/boost/archive/detail/abi_suffix.hpp | 4 +++ include/boost/archive/detail/decl.hpp | 20 ++++++++---- include/boost/archive/detail/iserializer.hpp | 6 +++- include/boost/archive/detail/oserializer.hpp | 6 +++- include/boost/archive/detail/visibility.hpp | 31 +++++++++++++++++++ .../archive/polymorphic_binary_iarchive.hpp | 3 ++ .../archive/polymorphic_binary_oarchive.hpp | 3 ++ .../archive/polymorphic_text_iarchive.hpp | 3 ++ .../archive/polymorphic_text_oarchive.hpp | 3 ++ .../archive/polymorphic_text_wiarchive.hpp | 3 ++ .../archive/polymorphic_text_woarchive.hpp | 3 ++ .../archive/polymorphic_xml_iarchive.hpp | 3 ++ .../archive/polymorphic_xml_oarchive.hpp | 3 ++ .../archive/polymorphic_xml_wiarchive.hpp | 3 ++ .../archive/polymorphic_xml_woarchive.hpp | 3 ++ .../extended_type_info_no_rtti.hpp | 2 +- .../extended_type_info_typeid.hpp | 2 +- include/boost/serialization/void_cast.hpp | 2 +- 19 files changed, 96 insertions(+), 11 deletions(-) create mode 100644 include/boost/archive/detail/visibility.hpp diff --git a/include/boost/archive/detail/abi_prefix.hpp b/include/boost/archive/detail/abi_prefix.hpp index debf79e9f0..e1d557d48b 100644 --- a/include/boost/archive/detail/abi_prefix.hpp +++ b/include/boost/archive/detail/abi_prefix.hpp @@ -8,9 +8,13 @@ // See http://www.boost.org for updates, documentation, and revision history. +#include #include // must be the last header #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4251 4231 4660 4275) #endif +#if defined(BOOST_SERIALIZATION_HAVE_PRAGMA_VISIBILITY) +# pragma GCC visibility push(hidden) +#endif diff --git a/include/boost/archive/detail/abi_suffix.hpp b/include/boost/archive/detail/abi_suffix.hpp index 4e054d6621..12421edbce 100644 --- a/include/boost/archive/detail/abi_suffix.hpp +++ b/include/boost/archive/detail/abi_suffix.hpp @@ -8,6 +8,10 @@ // See http://www.boost.org for updates, documentation, and revision history. +#if defined(BOOST_SERIALIZATION_HAVE_PRAGMA_VISIBILITY) +# pragma GCC visibility pop +#endif + #ifdef BOOST_MSVC #pragma warning(pop) #endif diff --git a/include/boost/archive/detail/decl.hpp b/include/boost/archive/detail/decl.hpp index 4f731cded3..e9d22b2535 100644 --- a/include/boost/archive/detail/decl.hpp +++ b/include/boost/archive/detail/decl.hpp @@ -22,24 +22,32 @@ // http://www.boost.org/more/separate_compilation.html #include +#include + +#define BOOST_SERIALIZATION_EXPORT BOOST_SYMBOL_EXPORT +#if defined(BOOST_SERIALIZATION_VISIBLE) +# define BOOST_SERIALIZATION_IMPORT BOOST_SERIALIZATION_VISIBLE +#else +# define BOOST_SERIALIZATION_IMPORT BOOST_SYMBOL_IMPORT +#endif #if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)) #if defined(BOOST_ARCHIVE_SOURCE) - #define BOOST_ARCHIVE_DECL BOOST_SYMBOL_EXPORT + #define BOOST_ARCHIVE_DECL BOOST_SERIALIZATION_EXPORT #else - #define BOOST_ARCHIVE_DECL BOOST_SYMBOL_IMPORT + #define BOOST_ARCHIVE_DECL BOOST_SERIALIZATION_IMPORT #endif #if defined(BOOST_WARCHIVE_SOURCE) - #define BOOST_WARCHIVE_DECL BOOST_SYMBOL_EXPORT + #define BOOST_WARCHIVE_DECL BOOST_SERIALIZATION_EXPORT #else - #define BOOST_WARCHIVE_DECL BOOST_SYMBOL_IMPORT + #define BOOST_WARCHIVE_DECL BOOST_SERIALIZATION_IMPORT #endif #if defined(BOOST_WARCHIVE_SOURCE) || defined(BOOST_ARCHIVE_SOURCE) - #define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_EXPORT + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SERIALIZATION_EXPORT #else - #define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_IMPORT + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SERIALIZATION_IMPORT #endif #endif diff --git a/include/boost/archive/detail/iserializer.hpp b/include/boost/archive/detail/iserializer.hpp index 6c2fd67ddd..9102ec2a8a 100644 --- a/include/boost/archive/detail/iserializer.hpp +++ b/include/boost/archive/detail/iserializer.hpp @@ -91,6 +91,8 @@ namespace std{ #include +#include // must be the last header + namespace boost { namespace serialization { @@ -125,7 +127,7 @@ class iserializer : public basic_iserializer } protected: // protected constructor since it's always created by singleton - explicit iserializer() : + explicit BOOST_SERIALIZATION_PRIVATE iserializer() : basic_iserializer( boost::serialization::singleton< typename @@ -629,4 +631,6 @@ inline void load(Archive & ar, T &t){ } // namespace archive } // namespace boost +#include // must be the last header + #endif // BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP diff --git a/include/boost/archive/detail/oserializer.hpp b/include/boost/archive/detail/oserializer.hpp index 612e1f2cb1..6692e14375 100644 --- a/include/boost/archive/detail/oserializer.hpp +++ b/include/boost/archive/detail/oserializer.hpp @@ -71,6 +71,8 @@ #include +#include // must be the last header + namespace boost { namespace serialization { @@ -108,7 +110,7 @@ class oserializer : public basic_oserializer // private constructor to inhibit any existence other than the // static one public: - explicit BOOST_DLLEXPORT oserializer() : + explicit BOOST_SERIALIZATION_PRIVATE oserializer() : basic_oserializer( boost::serialization::singleton< typename @@ -542,4 +544,6 @@ inline void save(Archive & ar, /*const*/ T &t){ } // namespace archive } // namespace boost +#include // must be the last header + #endif // BOOST_ARCHIVE_OSERIALIZER_HPP diff --git a/include/boost/archive/detail/visibility.hpp b/include/boost/archive/detail/visibility.hpp new file mode 100644 index 0000000000..8546eaa6e9 --- /dev/null +++ b/include/boost/archive/detail/visibility.hpp @@ -0,0 +1,31 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// visibility.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// (C) Copyright 2018 Frank Richter +// 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. + +#ifndef BOOST_ARCHIVE_DETAIL_VISIBILITY_HPP +#define BOOST_ARCHIVE_DETAIL_VISIBILITY_HPP + +#include + +#if (defined(BOOST_GCC_VERSION) && (BOOST_GCC_VERSION >= 40000) && !defined(BOOST_HAS_DECLSPEC)) +# define BOOST_SERIALIZATION_HAVE_PRAGMA_VISIBILITY +# define BOOST_SERIALIZATION_PRIVATE __attribute__((visibility("hidden"))) +# define BOOST_SERIALIZATION_VISIBLE __attribute__((visibility("default"))) +#elif (defined(BOOST_CLANG) && !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)) +# define BOOST_SERIALIZATION_HAVE_PRAGMA_VISIBILITY +# define BOOST_SERIALIZATION_PRIVATE __attribute__((__visibility__("hidden"))) +# define BOOST_SERIALIZATION_VISIBLE __attribute__((__visibility__("default"))) +#endif + +#ifndef BOOST_SERIALIZATION_PRIVATE +# define BOOST_SERIALIZATION_PRIVATE +#endif + +#endif // BOOST_ARCHIVE_DETAIL_VISIBILITY_HPP diff --git a/include/boost/archive/polymorphic_binary_iarchive.hpp b/include/boost/archive/polymorphic_binary_iarchive.hpp index 4a898a8ad1..5cbe791cf4 100644 --- a/include/boost/archive/polymorphic_binary_iarchive.hpp +++ b/include/boost/archive/polymorphic_binary_iarchive.hpp @@ -19,6 +19,7 @@ #include #include #include +#include // must be the last header #ifdef BOOST_MSVC # pragma warning(push) @@ -45,6 +46,8 @@ class polymorphic_binary_iarchive : #pragma warning(pop) #endif +#include // must be the last header + // required by export BOOST_SERIALIZATION_REGISTER_ARCHIVE( boost::archive::polymorphic_binary_iarchive diff --git a/include/boost/archive/polymorphic_binary_oarchive.hpp b/include/boost/archive/polymorphic_binary_oarchive.hpp index 931b243feb..2a2f44fccb 100644 --- a/include/boost/archive/polymorphic_binary_oarchive.hpp +++ b/include/boost/archive/polymorphic_binary_oarchive.hpp @@ -19,6 +19,7 @@ #include #include #include +#include // must be the last header namespace boost { namespace archive { @@ -34,6 +35,8 @@ typedef detail::polymorphic_oarchive_route< } // namespace archive } // namespace boost +#include // must be the last header + // required by export BOOST_SERIALIZATION_REGISTER_ARCHIVE( boost::archive::polymorphic_binary_oarchive diff --git a/include/boost/archive/polymorphic_text_iarchive.hpp b/include/boost/archive/polymorphic_text_iarchive.hpp index 7bef292786..7d598193cd 100644 --- a/include/boost/archive/polymorphic_text_iarchive.hpp +++ b/include/boost/archive/polymorphic_text_iarchive.hpp @@ -19,6 +19,7 @@ #include #include #include +#include // must be the last header #ifdef BOOST_MSVC # pragma warning(push) @@ -41,6 +42,8 @@ class polymorphic_text_iarchive : } // namespace archive } // namespace boost +#include // must be the last header + #ifdef BOOST_MSVC #pragma warning(pop) #endif diff --git a/include/boost/archive/polymorphic_text_oarchive.hpp b/include/boost/archive/polymorphic_text_oarchive.hpp index 457aad9fd7..f76003a65a 100644 --- a/include/boost/archive/polymorphic_text_oarchive.hpp +++ b/include/boost/archive/polymorphic_text_oarchive.hpp @@ -19,6 +19,7 @@ #include #include #include +#include // must be the last header namespace boost { namespace archive { @@ -30,6 +31,8 @@ typedef detail::polymorphic_oarchive_route< } // namespace archive } // namespace boost +#include // must be the last header + // required by export BOOST_SERIALIZATION_REGISTER_ARCHIVE( boost::archive::polymorphic_text_oarchive diff --git a/include/boost/archive/polymorphic_text_wiarchive.hpp b/include/boost/archive/polymorphic_text_wiarchive.hpp index 8466f05d6a..6f68aefbcd 100644 --- a/include/boost/archive/polymorphic_text_wiarchive.hpp +++ b/include/boost/archive/polymorphic_text_wiarchive.hpp @@ -23,6 +23,7 @@ #include #include +#include // must be the last header #ifdef BOOST_MSVC # pragma warning(push) @@ -45,6 +46,8 @@ class polymorphic_text_wiarchive : } // namespace archive } // namespace boost +#include // must be the last header + #ifdef BOOST_MSVC #pragma warning(pop) #endif diff --git a/include/boost/archive/polymorphic_text_woarchive.hpp b/include/boost/archive/polymorphic_text_woarchive.hpp index 295625d1bc..eba82033c4 100644 --- a/include/boost/archive/polymorphic_text_woarchive.hpp +++ b/include/boost/archive/polymorphic_text_woarchive.hpp @@ -23,6 +23,7 @@ #include #include +#include // must be the last header namespace boost { namespace archive { @@ -34,6 +35,8 @@ typedef detail::polymorphic_oarchive_route< } // namespace archive } // namespace boost +#include // must be the last header + // required by export BOOST_SERIALIZATION_REGISTER_ARCHIVE( boost::archive::polymorphic_text_woarchive diff --git a/include/boost/archive/polymorphic_xml_iarchive.hpp b/include/boost/archive/polymorphic_xml_iarchive.hpp index 4dc3f894b3..3b7cf26823 100644 --- a/include/boost/archive/polymorphic_xml_iarchive.hpp +++ b/include/boost/archive/polymorphic_xml_iarchive.hpp @@ -19,6 +19,7 @@ #include #include #include +#include // must be the last header #ifdef BOOST_MSVC # pragma warning(push) @@ -45,6 +46,8 @@ class polymorphic_xml_iarchive : #pragma warning(pop) #endif +#include // must be the last header + // required by export BOOST_SERIALIZATION_REGISTER_ARCHIVE( boost::archive::polymorphic_xml_iarchive diff --git a/include/boost/archive/polymorphic_xml_oarchive.hpp b/include/boost/archive/polymorphic_xml_oarchive.hpp index 514f9e530a..8dc4eff713 100644 --- a/include/boost/archive/polymorphic_xml_oarchive.hpp +++ b/include/boost/archive/polymorphic_xml_oarchive.hpp @@ -19,6 +19,7 @@ #include #include #include +#include // must be the last header namespace boost { namespace archive { @@ -30,6 +31,8 @@ typedef detail::polymorphic_oarchive_route< } // namespace archive } // namespace boost +#include // must be the last header + // required by export BOOST_SERIALIZATION_REGISTER_ARCHIVE( boost::archive::polymorphic_xml_oarchive diff --git a/include/boost/archive/polymorphic_xml_wiarchive.hpp b/include/boost/archive/polymorphic_xml_wiarchive.hpp index d4ab731267..bae3e86f59 100644 --- a/include/boost/archive/polymorphic_xml_wiarchive.hpp +++ b/include/boost/archive/polymorphic_xml_wiarchive.hpp @@ -23,6 +23,7 @@ #include #include +#include // must be the last header namespace boost { namespace archive { @@ -40,6 +41,8 @@ class polymorphic_xml_wiarchive : } // namespace archive } // namespace boost +#include // must be the last header + // required by export BOOST_SERIALIZATION_REGISTER_ARCHIVE( boost::archive::polymorphic_xml_wiarchive diff --git a/include/boost/archive/polymorphic_xml_woarchive.hpp b/include/boost/archive/polymorphic_xml_woarchive.hpp index dd8963fbb1..84d68281ae 100644 --- a/include/boost/archive/polymorphic_xml_woarchive.hpp +++ b/include/boost/archive/polymorphic_xml_woarchive.hpp @@ -23,6 +23,7 @@ #include #include +#include // must be the last header namespace boost { namespace archive { @@ -34,6 +35,8 @@ typedef detail::polymorphic_oarchive_route< } // namespace archive } // namespace boost +#include // must be the last header + // required by export BOOST_SERIALIZATION_REGISTER_ARCHIVE( boost::archive::polymorphic_xml_woarchive diff --git a/include/boost/serialization/extended_type_info_no_rtti.hpp b/include/boost/serialization/extended_type_info_no_rtti.hpp index aaa8b44459..ce12d0fcbe 100644 --- a/include/boost/serialization/extended_type_info_no_rtti.hpp +++ b/include/boost/serialization/extended_type_info_no_rtti.hpp @@ -68,7 +68,7 @@ class BOOST_SYMBOL_VISIBLE extended_type_info_no_rtti_0 : } // no_rtti_system template -class extended_type_info_no_rtti : +class BOOST_SERIALIZATION_PRIVATE extended_type_info_no_rtti : public no_rtti_system::extended_type_info_no_rtti_0, public singleton > { diff --git a/include/boost/serialization/extended_type_info_typeid.hpp b/include/boost/serialization/extended_type_info_typeid.hpp index 8ee591b316..f49d3bfdca 100644 --- a/include/boost/serialization/extended_type_info_typeid.hpp +++ b/include/boost/serialization/extended_type_info_typeid.hpp @@ -78,7 +78,7 @@ class BOOST_SYMBOL_VISIBLE extended_type_info_typeid_0 : } // typeid_system template -class extended_type_info_typeid : +class BOOST_SERIALIZATION_PRIVATE extended_type_info_typeid : public typeid_system::extended_type_info_typeid_0, public singleton > { diff --git a/include/boost/serialization/void_cast.hpp b/include/boost/serialization/void_cast.hpp index 97c5fe61ba..0e2bdbd574 100644 --- a/include/boost/serialization/void_cast.hpp +++ b/include/boost/serialization/void_cast.hpp @@ -151,7 +151,7 @@ class BOOST_SYMBOL_VISIBLE void_caster : #endif template -class BOOST_SYMBOL_VISIBLE void_caster_primitive : +class BOOST_SERIALIZATION_PRIVATE void_caster_primitive : public void_caster { virtual void const * downcast(void const * const t) const { From c278b203e7eb7984e864b751d0b507da7f271654 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 29 Aug 2018 16:48:14 +0200 Subject: [PATCH 04/16] clang wants same visibility attribute on forward & actual declarations --- include/boost/archive/detail/archive_serializer_map.hpp | 2 +- include/boost/archive/detail/basic_iarchive.hpp | 6 +++--- include/boost/archive/detail/basic_iserializer.hpp | 6 +++--- include/boost/archive/detail/basic_oarchive.hpp | 6 +++--- include/boost/archive/detail/basic_oserializer.hpp | 6 +++--- include/boost/archive/detail/basic_pointer_iserializer.hpp | 4 ++-- include/boost/archive/detail/basic_pointer_oserializer.hpp | 4 ++-- include/boost/archive/detail/basic_serializer_map.hpp | 2 +- include/boost/archive/detail/common_iarchive.hpp | 2 +- include/boost/archive/detail/iserializer.hpp | 2 +- include/boost/archive/detail/oserializer.hpp | 2 +- include/boost/archive/detail/polymorphic_iarchive_route.hpp | 4 ++-- include/boost/archive/detail/polymorphic_oarchive_route.hpp | 4 ++-- include/boost/archive/polymorphic_iarchive.hpp | 6 +++--- include/boost/archive/polymorphic_oarchive.hpp | 6 +++--- include/boost/serialization/void_cast.hpp | 2 +- src/basic_serializer_map.cpp | 2 +- test/test_polymorphic2.hpp | 4 ++-- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/boost/archive/detail/archive_serializer_map.hpp b/include/boost/archive/detail/archive_serializer_map.hpp index 5432bfc73e..958246b092 100644 --- a/include/boost/archive/detail/archive_serializer_map.hpp +++ b/include/boost/archive/detail/archive_serializer_map.hpp @@ -27,7 +27,7 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/basic_iarchive.hpp b/include/boost/archive/detail/basic_iarchive.hpp index 1f5a8bf63b..f18fa8fe6e 100644 --- a/include/boost/archive/detail/basic_iarchive.hpp +++ b/include/boost/archive/detail/basic_iarchive.hpp @@ -30,15 +30,15 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { namespace detail { class basic_iarchive_impl; -class basic_iserializer; -class basic_pointer_iserializer; +class BOOST_SYMBOL_VISIBLE basic_iserializer; +class BOOST_SYMBOL_VISIBLE basic_pointer_iserializer; ////////////////////////////////////////////////////////////////////// // class basic_iarchive - read serialized objects from a input stream diff --git a/include/boost/archive/detail/basic_iserializer.hpp b/include/boost/archive/detail/basic_iserializer.hpp index 0d66674c34..10bce00ac4 100644 --- a/include/boost/archive/detail/basic_iserializer.hpp +++ b/include/boost/archive/detail/basic_iserializer.hpp @@ -32,15 +32,15 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization // forward declarations namespace archive { namespace detail { -class basic_iarchive; -class basic_pointer_iserializer; +class BOOST_SYMBOL_VISIBLE basic_iarchive; +class BOOST_SYMBOL_VISIBLE basic_pointer_iserializer; class BOOST_SYMBOL_VISIBLE basic_iserializer : public basic_serializer diff --git a/include/boost/archive/detail/basic_oarchive.hpp b/include/boost/archive/detail/basic_oarchive.hpp index c379108d58..4adebba4bc 100644 --- a/include/boost/archive/detail/basic_oarchive.hpp +++ b/include/boost/archive/detail/basic_oarchive.hpp @@ -28,15 +28,15 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { namespace detail { class basic_oarchive_impl; -class basic_oserializer; -class basic_pointer_oserializer; +class BOOST_SYMBOL_VISIBLE basic_oserializer; +class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer; ////////////////////////////////////////////////////////////////////// // class basic_oarchive - write serialized objects to an output stream diff --git a/include/boost/archive/detail/basic_oserializer.hpp b/include/boost/archive/detail/basic_oserializer.hpp index 94247e9005..73f317232c 100644 --- a/include/boost/archive/detail/basic_oserializer.hpp +++ b/include/boost/archive/detail/basic_oserializer.hpp @@ -33,15 +33,15 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization // forward declarations namespace archive { namespace detail { -class basic_oarchive; -class basic_pointer_oserializer; +class BOOST_SYMBOL_VISIBLE basic_oarchive; +class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer; class BOOST_SYMBOL_VISIBLE basic_oserializer : public basic_serializer diff --git a/include/boost/archive/detail/basic_pointer_iserializer.hpp b/include/boost/archive/detail/basic_pointer_iserializer.hpp index 1fc4b14d6e..b1a9b61ae0 100644 --- a/include/boost/archive/detail/basic_pointer_iserializer.hpp +++ b/include/boost/archive/detail/basic_pointer_iserializer.hpp @@ -30,14 +30,14 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization // forward declarations namespace archive { namespace detail { -class basic_iarchive; +class BOOST_SYMBOL_VISIBLE basic_iarchive; class basic_iserializer; class BOOST_SYMBOL_VISIBLE basic_pointer_iserializer diff --git a/include/boost/archive/detail/basic_pointer_oserializer.hpp b/include/boost/archive/detail/basic_pointer_oserializer.hpp index 1a5d9549ea..d8f336e170 100644 --- a/include/boost/archive/detail/basic_pointer_oserializer.hpp +++ b/include/boost/archive/detail/basic_pointer_oserializer.hpp @@ -30,13 +30,13 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { namespace detail { -class basic_oarchive; +class BOOST_SYMBOL_VISIBLE basic_oarchive; class basic_oserializer; class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer : diff --git a/include/boost/archive/detail/basic_serializer_map.hpp b/include/boost/archive/detail/basic_serializer_map.hpp index 7934180336..38fa1db482 100644 --- a/include/boost/archive/detail/basic_serializer_map.hpp +++ b/include/boost/archive/detail/basic_serializer_map.hpp @@ -26,7 +26,7 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } namespace archive { diff --git a/include/boost/archive/detail/common_iarchive.hpp b/include/boost/archive/detail/common_iarchive.hpp index 4176a8a5ef..a702e92e26 100644 --- a/include/boost/archive/detail/common_iarchive.hpp +++ b/include/boost/archive/detail/common_iarchive.hpp @@ -31,7 +31,7 @@ namespace boost { namespace archive { namespace detail { -class extended_type_info; +class BOOST_SYMBOL_VISIBLE extended_type_info; // note: referred to as Curiously Recurring Template Patter (CRTP) template diff --git a/include/boost/archive/detail/iserializer.hpp b/include/boost/archive/detail/iserializer.hpp index 9102ec2a8a..8d35b2e94f 100644 --- a/include/boost/archive/detail/iserializer.hpp +++ b/include/boost/archive/detail/iserializer.hpp @@ -96,7 +96,7 @@ namespace std{ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/oserializer.hpp b/include/boost/archive/detail/oserializer.hpp index 6692e14375..0d69312834 100644 --- a/include/boost/archive/detail/oserializer.hpp +++ b/include/boost/archive/detail/oserializer.hpp @@ -76,7 +76,7 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/polymorphic_iarchive_route.hpp b/include/boost/archive/detail/polymorphic_iarchive_route.hpp index 105685ebbd..40c6af0122 100644 --- a/include/boost/archive/detail/polymorphic_iarchive_route.hpp +++ b/include/boost/archive/detail/polymorphic_iarchive_route.hpp @@ -34,7 +34,7 @@ namespace std{ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { namespace detail{ @@ -48,7 +48,7 @@ class basic_pointer_iserializer; #endif template -class polymorphic_iarchive_route : +class BOOST_SYMBOL_VISIBLE polymorphic_iarchive_route : public polymorphic_iarchive, // note: gcc dynamic cross cast fails if the the derivation below is // not public. I think this is a mistake. diff --git a/include/boost/archive/detail/polymorphic_oarchive_route.hpp b/include/boost/archive/detail/polymorphic_oarchive_route.hpp index b23fd6bf39..35c81e3a9b 100644 --- a/include/boost/archive/detail/polymorphic_oarchive_route.hpp +++ b/include/boost/archive/detail/polymorphic_oarchive_route.hpp @@ -34,7 +34,7 @@ namespace std{ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { namespace detail{ @@ -48,7 +48,7 @@ class basic_pointer_oserializer; #endif template -class polymorphic_oarchive_route : +class BOOST_SYMBOL_VISIBLE polymorphic_oarchive_route : public polymorphic_oarchive, // note: gcc dynamic cross cast fails if the the derivation below is // not public. I think this is a mistake. diff --git a/include/boost/archive/polymorphic_iarchive.hpp b/include/boost/archive/polymorphic_iarchive.hpp index d3c59a9f0f..5f13b8c103 100644 --- a/include/boost/archive/polymorphic_iarchive.hpp +++ b/include/boost/archive/polymorphic_iarchive.hpp @@ -39,15 +39,15 @@ namespace std{ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { namespace detail { - class basic_iarchive; + class BOOST_SYMBOL_VISIBLE basic_iarchive; class basic_iserializer; } -class polymorphic_iarchive; +class BOOST_SYMBOL_VISIBLE polymorphic_iarchive; class BOOST_SYMBOL_VISIBLE polymorphic_iarchive_impl : public detail::interface_iarchive diff --git a/include/boost/archive/polymorphic_oarchive.hpp b/include/boost/archive/polymorphic_oarchive.hpp index edac4edb1e..77df0293e5 100644 --- a/include/boost/archive/polymorphic_oarchive.hpp +++ b/include/boost/archive/polymorphic_oarchive.hpp @@ -38,15 +38,15 @@ namespace std{ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } // namespace serialization namespace archive { namespace detail { - class basic_oarchive; + class BOOST_SYMBOL_VISIBLE basic_oarchive; class basic_oserializer; } -class polymorphic_oarchive; +class BOOST_SYMBOL_VISIBLE polymorphic_oarchive; class BOOST_SYMBOL_VISIBLE polymorphic_oarchive_impl : public detail::interface_oarchive diff --git a/include/boost/serialization/void_cast.hpp b/include/boost/serialization/void_cast.hpp index 0e2bdbd574..90b7da2b54 100644 --- a/include/boost/serialization/void_cast.hpp +++ b/include/boost/serialization/void_cast.hpp @@ -40,7 +40,7 @@ namespace boost { namespace serialization { -class extended_type_info; +class BOOST_SYMBOL_VISIBLE 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. diff --git a/src/basic_serializer_map.cpp b/src/basic_serializer_map.cpp index 5b79107728..d33de12b4c 100644 --- a/src/basic_serializer_map.cpp +++ b/src/basic_serializer_map.cpp @@ -28,7 +28,7 @@ namespace boost { namespace serialization { - class extended_type_info; + class BOOST_SYMBOL_VISIBLE extended_type_info; } namespace archive { namespace detail { diff --git a/test/test_polymorphic2.hpp b/test/test_polymorphic2.hpp index a2cd4f1213..852727bed5 100644 --- a/test/test_polymorphic2.hpp +++ b/test/test_polymorphic2.hpp @@ -9,8 +9,8 @@ // should pass compilation and execution namespace boost { namespace archive { - class polymorphic_oarchive; - class polymorphic_iarchive; + class BOOST_SYMBOL_VISIBLE polymorphic_oarchive; + class BOOST_SYMBOL_VISIBLE polymorphic_iarchive; } } From a376a176eb2cae0c10867f55339364d184850e01 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 29 Aug 2018 17:07:18 +0200 Subject: [PATCH 05/16] Fix gcc warnings after last commit --- include/boost/archive/detail/archive_serializer_map.hpp | 2 +- include/boost/archive/detail/basic_iarchive.hpp | 6 +++--- include/boost/archive/detail/basic_iserializer.hpp | 6 +++--- include/boost/archive/detail/basic_oarchive.hpp | 6 +++--- include/boost/archive/detail/basic_oserializer.hpp | 6 +++--- include/boost/archive/detail/basic_pointer_iserializer.hpp | 4 ++-- include/boost/archive/detail/basic_pointer_oserializer.hpp | 4 ++-- include/boost/archive/detail/basic_serializer_map.hpp | 2 +- include/boost/archive/detail/common_iarchive.hpp | 2 +- include/boost/archive/detail/iserializer.hpp | 2 +- include/boost/archive/detail/oserializer.hpp | 2 +- .../boost/archive/detail/polymorphic_iarchive_route.hpp | 2 +- .../boost/archive/detail/polymorphic_oarchive_route.hpp | 2 +- include/boost/archive/detail/visibility.hpp | 7 +++++++ include/boost/archive/polymorphic_iarchive.hpp | 4 ++-- include/boost/archive/polymorphic_oarchive.hpp | 4 ++-- include/boost/serialization/void_cast.hpp | 2 +- src/basic_serializer_map.cpp | 2 +- 18 files changed, 36 insertions(+), 29 deletions(-) diff --git a/include/boost/archive/detail/archive_serializer_map.hpp b/include/boost/archive/detail/archive_serializer_map.hpp index 958246b092..b7ed1c6517 100644 --- a/include/boost/archive/detail/archive_serializer_map.hpp +++ b/include/boost/archive/detail/archive_serializer_map.hpp @@ -27,7 +27,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/basic_iarchive.hpp b/include/boost/archive/detail/basic_iarchive.hpp index f18fa8fe6e..4d9bcf2550 100644 --- a/include/boost/archive/detail/basic_iarchive.hpp +++ b/include/boost/archive/detail/basic_iarchive.hpp @@ -30,15 +30,15 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail { class basic_iarchive_impl; -class BOOST_SYMBOL_VISIBLE basic_iserializer; -class BOOST_SYMBOL_VISIBLE basic_pointer_iserializer; +class BOOST_SYMBOL_VISIBLE_FWD basic_iserializer; +class BOOST_SYMBOL_VISIBLE_FWD basic_pointer_iserializer; ////////////////////////////////////////////////////////////////////// // class basic_iarchive - read serialized objects from a input stream diff --git a/include/boost/archive/detail/basic_iserializer.hpp b/include/boost/archive/detail/basic_iserializer.hpp index 10bce00ac4..48da703915 100644 --- a/include/boost/archive/detail/basic_iserializer.hpp +++ b/include/boost/archive/detail/basic_iserializer.hpp @@ -32,15 +32,15 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization // forward declarations namespace archive { namespace detail { -class BOOST_SYMBOL_VISIBLE basic_iarchive; -class BOOST_SYMBOL_VISIBLE basic_pointer_iserializer; +class BOOST_SYMBOL_VISIBLE_FWD basic_iarchive; +class BOOST_SYMBOL_VISIBLE_FWD basic_pointer_iserializer; class BOOST_SYMBOL_VISIBLE basic_iserializer : public basic_serializer diff --git a/include/boost/archive/detail/basic_oarchive.hpp b/include/boost/archive/detail/basic_oarchive.hpp index 4adebba4bc..9620cdca6e 100644 --- a/include/boost/archive/detail/basic_oarchive.hpp +++ b/include/boost/archive/detail/basic_oarchive.hpp @@ -28,15 +28,15 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail { class basic_oarchive_impl; -class BOOST_SYMBOL_VISIBLE basic_oserializer; -class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer; +class BOOST_SYMBOL_VISIBLE_FWD basic_oserializer; +class BOOST_SYMBOL_VISIBLE_FWD basic_pointer_oserializer; ////////////////////////////////////////////////////////////////////// // class basic_oarchive - write serialized objects to an output stream diff --git a/include/boost/archive/detail/basic_oserializer.hpp b/include/boost/archive/detail/basic_oserializer.hpp index 73f317232c..a051957c22 100644 --- a/include/boost/archive/detail/basic_oserializer.hpp +++ b/include/boost/archive/detail/basic_oserializer.hpp @@ -33,15 +33,15 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization // forward declarations namespace archive { namespace detail { -class BOOST_SYMBOL_VISIBLE basic_oarchive; -class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer; +class BOOST_SYMBOL_VISIBLE_FWD basic_oarchive; +class BOOST_SYMBOL_VISIBLE_FWD basic_pointer_oserializer; class BOOST_SYMBOL_VISIBLE basic_oserializer : public basic_serializer diff --git a/include/boost/archive/detail/basic_pointer_iserializer.hpp b/include/boost/archive/detail/basic_pointer_iserializer.hpp index b1a9b61ae0..229545bbcf 100644 --- a/include/boost/archive/detail/basic_pointer_iserializer.hpp +++ b/include/boost/archive/detail/basic_pointer_iserializer.hpp @@ -30,14 +30,14 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization // forward declarations namespace archive { namespace detail { -class BOOST_SYMBOL_VISIBLE basic_iarchive; +class BOOST_SYMBOL_VISIBLE_FWD basic_iarchive; class basic_iserializer; class BOOST_SYMBOL_VISIBLE basic_pointer_iserializer diff --git a/include/boost/archive/detail/basic_pointer_oserializer.hpp b/include/boost/archive/detail/basic_pointer_oserializer.hpp index d8f336e170..ca25c70bde 100644 --- a/include/boost/archive/detail/basic_pointer_oserializer.hpp +++ b/include/boost/archive/detail/basic_pointer_oserializer.hpp @@ -30,13 +30,13 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail { -class BOOST_SYMBOL_VISIBLE basic_oarchive; +class BOOST_SYMBOL_VISIBLE_FWD basic_oarchive; class basic_oserializer; class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer : diff --git a/include/boost/archive/detail/basic_serializer_map.hpp b/include/boost/archive/detail/basic_serializer_map.hpp index 38fa1db482..bc2903dff6 100644 --- a/include/boost/archive/detail/basic_serializer_map.hpp +++ b/include/boost/archive/detail/basic_serializer_map.hpp @@ -26,7 +26,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } namespace archive { diff --git a/include/boost/archive/detail/common_iarchive.hpp b/include/boost/archive/detail/common_iarchive.hpp index a702e92e26..16bbee3ea6 100644 --- a/include/boost/archive/detail/common_iarchive.hpp +++ b/include/boost/archive/detail/common_iarchive.hpp @@ -31,7 +31,7 @@ namespace boost { namespace archive { namespace detail { -class BOOST_SYMBOL_VISIBLE extended_type_info; +class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; // note: referred to as Curiously Recurring Template Patter (CRTP) template diff --git a/include/boost/archive/detail/iserializer.hpp b/include/boost/archive/detail/iserializer.hpp index 8d35b2e94f..7adb177dc8 100644 --- a/include/boost/archive/detail/iserializer.hpp +++ b/include/boost/archive/detail/iserializer.hpp @@ -96,7 +96,7 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/oserializer.hpp b/include/boost/archive/detail/oserializer.hpp index 0d69312834..4fd3f31a30 100644 --- a/include/boost/archive/detail/oserializer.hpp +++ b/include/boost/archive/detail/oserializer.hpp @@ -76,7 +76,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/polymorphic_iarchive_route.hpp b/include/boost/archive/detail/polymorphic_iarchive_route.hpp index 40c6af0122..c678792f84 100644 --- a/include/boost/archive/detail/polymorphic_iarchive_route.hpp +++ b/include/boost/archive/detail/polymorphic_iarchive_route.hpp @@ -34,7 +34,7 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail{ diff --git a/include/boost/archive/detail/polymorphic_oarchive_route.hpp b/include/boost/archive/detail/polymorphic_oarchive_route.hpp index 35c81e3a9b..97c66b30a0 100644 --- a/include/boost/archive/detail/polymorphic_oarchive_route.hpp +++ b/include/boost/archive/detail/polymorphic_oarchive_route.hpp @@ -34,7 +34,7 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail{ diff --git a/include/boost/archive/detail/visibility.hpp b/include/boost/archive/detail/visibility.hpp index 8546eaa6e9..a41ede5440 100644 --- a/include/boost/archive/detail/visibility.hpp +++ b/include/boost/archive/detail/visibility.hpp @@ -22,10 +22,17 @@ # define BOOST_SERIALIZATION_HAVE_PRAGMA_VISIBILITY # define BOOST_SERIALIZATION_PRIVATE __attribute__((__visibility__("hidden"))) # define BOOST_SERIALIZATION_VISIBLE __attribute__((__visibility__("default"))) +/* Clang wants forward declarations to have same visibility attribute as actual declaration, + * gcc throws a warning in that case */ +# define BOOST_SYMBOL_VISIBLE_FWD BOOST_SYMBOL_VISIBLE #endif #ifndef BOOST_SERIALIZATION_PRIVATE # define BOOST_SERIALIZATION_PRIVATE #endif +#ifndef BOOST_SYMBOL_VISIBLE_FWD +# define BOOST_SYMBOL_VISIBLE_FWD +#endif + #endif // BOOST_ARCHIVE_DETAIL_VISIBILITY_HPP diff --git a/include/boost/archive/polymorphic_iarchive.hpp b/include/boost/archive/polymorphic_iarchive.hpp index 5f13b8c103..0458229f92 100644 --- a/include/boost/archive/polymorphic_iarchive.hpp +++ b/include/boost/archive/polymorphic_iarchive.hpp @@ -39,11 +39,11 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail { - class BOOST_SYMBOL_VISIBLE basic_iarchive; + class BOOST_SYMBOL_VISIBLE_FWD basic_iarchive; class basic_iserializer; } diff --git a/include/boost/archive/polymorphic_oarchive.hpp b/include/boost/archive/polymorphic_oarchive.hpp index 77df0293e5..ca3f8faf42 100644 --- a/include/boost/archive/polymorphic_oarchive.hpp +++ b/include/boost/archive/polymorphic_oarchive.hpp @@ -38,11 +38,11 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail { - class BOOST_SYMBOL_VISIBLE basic_oarchive; + class BOOST_SYMBOL_VISIBLE_FWD basic_oarchive; class basic_oserializer; } diff --git a/include/boost/serialization/void_cast.hpp b/include/boost/serialization/void_cast.hpp index 90b7da2b54..bffb29ad7e 100644 --- a/include/boost/serialization/void_cast.hpp +++ b/include/boost/serialization/void_cast.hpp @@ -40,7 +40,7 @@ namespace boost { namespace serialization { -class BOOST_SYMBOL_VISIBLE extended_type_info; +class BOOST_SYMBOL_VISIBLE_FWD 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. diff --git a/src/basic_serializer_map.cpp b/src/basic_serializer_map.cpp index d33de12b4c..5d58bb8730 100644 --- a/src/basic_serializer_map.cpp +++ b/src/basic_serializer_map.cpp @@ -28,7 +28,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE extended_type_info; + class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; } namespace archive { namespace detail { From ee8078da05ef9699b947aada6925e2a0d966bf9c Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 29 Aug 2018 17:32:16 +0200 Subject: [PATCH 06/16] Sync some more visibility attributes on forward & actual declaration --- src/basic_archive.cpp | 4 ++-- src/basic_xml_archive.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/basic_archive.cpp b/src/basic_archive.cpp index 42da5d2e20..196eebb6b9 100644 --- a/src/basic_archive.cpp +++ b/src/basic_archive.cpp @@ -42,7 +42,7 @@ namespace archive { // constants used in archive signature //This should never ever change. note that is not an std::string // string. -BOOST_SYMBOL_VISIBLE const char * +BOOST_ARCHIVE_DECL const char * BOOST_ARCHIVE_SIGNATURE(){ return "serialization::archive"; } @@ -81,7 +81,7 @@ BOOST_ARCHIVE_SIGNATURE(){ // and now officially deprecated in the standard // 17- Boost 1.68 August 2018 -BOOST_SYMBOL_VISIBLE library_version_type +BOOST_ARCHIVE_DECL library_version_type BOOST_ARCHIVE_VERSION(){ return library_version_type(17); } diff --git a/src/basic_xml_archive.cpp b/src/basic_xml_archive.cpp index 23ab1819d1..4fa04dc7bd 100644 --- a/src/basic_xml_archive.cpp +++ b/src/basic_xml_archive.cpp @@ -15,35 +15,35 @@ namespace boost { namespace archive { -BOOST_SYMBOL_VISIBLE const char * +BOOST_ARCHIVE_DECL const char * BOOST_ARCHIVE_XML_OBJECT_ID(){ return "object_id"; } -BOOST_SYMBOL_VISIBLE const char * +BOOST_ARCHIVE_DECL const char * BOOST_ARCHIVE_XML_OBJECT_REFERENCE(){ return "object_id_reference"; } -BOOST_SYMBOL_VISIBLE const char * +BOOST_ARCHIVE_DECL const char * BOOST_ARCHIVE_XML_CLASS_ID(){ return "class_id"; } -BOOST_SYMBOL_VISIBLE const char * +BOOST_ARCHIVE_DECL const char * BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE(){ return "class_id_reference"; } -BOOST_SYMBOL_VISIBLE const char * +BOOST_ARCHIVE_DECL const char * BOOST_ARCHIVE_XML_CLASS_NAME(){ return "class_name"; } -BOOST_SYMBOL_VISIBLE const char * +BOOST_ARCHIVE_DECL const char * BOOST_ARCHIVE_XML_TRACKING(){ return "tracking_level"; } -BOOST_SYMBOL_VISIBLE const char * +BOOST_ARCHIVE_DECL const char * BOOST_ARCHIVE_XML_VERSION(){ return "version"; } -BOOST_SYMBOL_VISIBLE const char * +BOOST_ARCHIVE_DECL const char * BOOST_ARCHIVE_XML_SIGNATURE(){ return "signature"; } From bb9095ff2ede00a2b231da4da3ee17ff24c3eaa6 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 30 Aug 2018 14:19:57 +0200 Subject: [PATCH 07/16] Add abi_prefix/abi_suffix to more headers This makes the default ELF visibility more consistent. --- include/boost/archive/detail/basic_serializer.hpp | 4 ++++ include/boost/serialization/array_wrapper.hpp | 3 +++ include/boost/serialization/binary_object.hpp | 4 ++++ include/boost/serialization/extended_type_info.hpp | 4 ++-- include/boost/serialization/extended_type_info_no_rtti.hpp | 4 ++-- include/boost/serialization/extended_type_info_typeid.hpp | 4 ++-- include/boost/serialization/nvp.hpp | 4 ++++ 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/include/boost/archive/detail/basic_serializer.hpp b/include/boost/archive/detail/basic_serializer.hpp index f9c4203f86..21d11ec141 100644 --- a/include/boost/archive/detail/basic_serializer.hpp +++ b/include/boost/archive/detail/basic_serializer.hpp @@ -23,6 +23,8 @@ #include #include +#include // must be the last header + #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4511 4512) @@ -70,6 +72,8 @@ class basic_serializer_arg : public basic_serializer { } // namespace archive } // namespace boost +#include // must be the last header + #ifdef BOOST_MSVC #pragma warning(pop) #endif diff --git a/include/boost/serialization/array_wrapper.hpp b/include/boost/serialization/array_wrapper.hpp index adf436e15b..3634308542 100644 --- a/include/boost/serialization/array_wrapper.hpp +++ b/include/boost/serialization/array_wrapper.hpp @@ -26,6 +26,8 @@ namespace std{ #include #include +#include // must be the last header + namespace boost { namespace serialization { template @@ -117,5 +119,6 @@ const array_wrapper< T > make_array(T* t, S s){ } } // end namespace boost::serialization +#include // must be the last header #endif //BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP diff --git a/include/boost/serialization/binary_object.hpp b/include/boost/serialization/binary_object.hpp index 5c9038e5a9..9af1bdb237 100644 --- a/include/boost/serialization/binary_object.hpp +++ b/include/boost/serialization/binary_object.hpp @@ -33,6 +33,8 @@ namespace std{ #include #include +#include // must be the last header + namespace boost { namespace serialization { @@ -76,4 +78,6 @@ make_binary_object(const void * t, std::size_t size){ } // namespace serialization } // boost +#include // must be the last header + #endif // BOOST_SERIALIZATION_BINARY_OBJECT_HPP diff --git a/include/boost/serialization/extended_type_info.hpp b/include/boost/serialization/extended_type_info.hpp index bb2a190d46..fc9310d50f 100644 --- a/include/boost/serialization/extended_type_info.hpp +++ b/include/boost/serialization/extended_type_info.hpp @@ -26,7 +26,7 @@ #include #include -#include // must be the last header +#include // must be the last header #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4251 4231 4660 4275) @@ -111,6 +111,6 @@ inline const char * guid(){ #pragma warning(pop) #endif -#include // pops abi_suffix.hpp pragmas +#include // pops abi_prefix.hpp pragmas #endif // BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_HPP diff --git a/include/boost/serialization/extended_type_info_no_rtti.hpp b/include/boost/serialization/extended_type_info_no_rtti.hpp index ce12d0fcbe..5a38cf4949 100644 --- a/include/boost/serialization/extended_type_info_no_rtti.hpp +++ b/include/boost/serialization/extended_type_info_no_rtti.hpp @@ -36,7 +36,7 @@ // hijack serialization access #include -#include // must be the last header +#include // must be the last header #ifdef BOOST_MSVC # pragma warning(push) # pragma warning(disable : 4251 4231 4660 4275 4511 4512) @@ -177,6 +177,6 @@ class BOOST_SERIALIZATION_PRIVATE extended_type_info_no_rtti : #ifdef BOOST_MSVC # pragma warning(pop) #endif -#include // pops abi_suffix.hpp pragmas +#include // pops abi_prefix.hpp pragmas #endif // BOOST_EXTENDED_TYPE_INFO_NO_RTTI_HPP diff --git a/include/boost/serialization/extended_type_info_typeid.hpp b/include/boost/serialization/extended_type_info_typeid.hpp index f49d3bfdca..f76507bc7b 100644 --- a/include/boost/serialization/extended_type_info_typeid.hpp +++ b/include/boost/serialization/extended_type_info_typeid.hpp @@ -38,7 +38,7 @@ #include -#include // must be the last header +#include // must be the last header #ifdef BOOST_MSVC # pragma warning(push) @@ -162,6 +162,6 @@ class BOOST_SERIALIZATION_PRIVATE extended_type_info_typeid : #ifdef BOOST_MSVC #pragma warning(pop) #endif -#include // pops abi_suffix.hpp pragmas +#include // pops abi_prefix.hpp pragmas #endif // BOOST_SERIALIZATION_EXTENDED_TYPE_INFO_TYPEID_HPP diff --git a/include/boost/serialization/nvp.hpp b/include/boost/serialization/nvp.hpp index 066fe94d87..8275afaf92 100644 --- a/include/boost/serialization/nvp.hpp +++ b/include/boost/serialization/nvp.hpp @@ -30,6 +30,8 @@ #include +#include // must be the last header + namespace boost { namespace serialization { @@ -109,6 +111,8 @@ struct tracking_level > } // seralization } // boost +#include // must be the last header + #include #define BOOST_SERIALIZATION_NVP(name) \ From 778e21402579663b5d5db12cfa915ce649b8fff3 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 30 Aug 2018 15:44:22 +0200 Subject: [PATCH 08/16] Define BOOST_SERIALIZATION_DECL to explicit default visibility if necessary --- include/boost/serialization/config.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/boost/serialization/config.hpp b/include/boost/serialization/config.hpp index ea8cb9239e..645d170943 100644 --- a/include/boost/serialization/config.hpp +++ b/include/boost/serialization/config.hpp @@ -17,6 +17,7 @@ #include #include +#include // note: this version incorporates the related code into the the // the same library as BOOST_ARCHIVE. This could change some day in the @@ -38,6 +39,8 @@ // export if this is our own source, otherwise import: #if defined(BOOST_SERIALIZATION_SOURCE) #define BOOST_SERIALIZATION_DECL BOOST_SYMBOL_EXPORT + #elif defined(BOOST_SERIALIZATION_VISIBLE) + #define BOOST_SERIALIZATION_DECL BOOST_SERIALIZATION_VISIBLE #else #define BOOST_SERIALIZATION_DECL BOOST_SYMBOL_IMPORT #endif // defined(BOOST_SERIALIZATION_SOURCE) From 83477811e4e4191b68fca2f36c6cfbe02d354216 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 3 Sep 2018 13:31:19 +0200 Subject: [PATCH 09/16] Add BOOST_SERIALIZATION_DECL_FWD For use in forward-declaration of classes with BOOST_SERIALIZATION_DECL. --- include/boost/serialization/config.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/boost/serialization/config.hpp b/include/boost/serialization/config.hpp index 645d170943..4ac9cde75d 100644 --- a/include/boost/serialization/config.hpp +++ b/include/boost/serialization/config.hpp @@ -51,6 +51,16 @@ #define BOOST_SERIALIZATION_DECL #endif +#if (defined(BOOST_CLANG) && !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)) +/* Clang wants forward declarations to have same visibility attribute as actual declaration, + * gcc throws a warning in that case */ +# define BOOST_SERIALIZATION_DECL_FWD BOOST_SERIALIZATION_DECL +#endif + +#ifndef BOOST_SERIALIZATION_DECL_FWD +# define BOOST_SERIALIZATION_DECL_FWD +#endif + // enable automatic library variant selection ------------------------------// #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \ From fd8336c6634443a9498947ae2bfae7a964085dfd Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 3 Sep 2018 10:51:57 +0200 Subject: [PATCH 10/16] Use BOOST_SERIALIZATION_DECL for extended_type_info classes Needed if linking a static boost_serialization lib against a shared object. --- include/boost/archive/detail/archive_serializer_map.hpp | 2 +- include/boost/archive/detail/basic_iarchive.hpp | 3 ++- include/boost/archive/detail/basic_iserializer.hpp | 2 +- include/boost/archive/detail/basic_oarchive.hpp | 3 ++- include/boost/archive/detail/basic_oserializer.hpp | 2 +- include/boost/archive/detail/basic_pointer_iserializer.hpp | 2 +- include/boost/archive/detail/basic_pointer_oserializer.hpp | 2 +- include/boost/archive/detail/basic_serializer_map.hpp | 2 +- include/boost/archive/detail/common_iarchive.hpp | 2 +- include/boost/archive/detail/iserializer.hpp | 2 +- include/boost/archive/detail/oserializer.hpp | 2 +- include/boost/archive/detail/polymorphic_iarchive_route.hpp | 2 +- include/boost/archive/detail/polymorphic_oarchive_route.hpp | 2 +- include/boost/archive/polymorphic_iarchive.hpp | 2 +- include/boost/archive/polymorphic_oarchive.hpp | 2 +- include/boost/serialization/extended_type_info.hpp | 2 +- include/boost/serialization/extended_type_info_no_rtti.hpp | 2 +- include/boost/serialization/extended_type_info_typeid.hpp | 2 +- include/boost/serialization/void_cast.hpp | 2 +- src/basic_serializer_map.cpp | 2 +- 20 files changed, 22 insertions(+), 20 deletions(-) diff --git a/include/boost/archive/detail/archive_serializer_map.hpp b/include/boost/archive/detail/archive_serializer_map.hpp index b7ed1c6517..72d700ae52 100644 --- a/include/boost/archive/detail/archive_serializer_map.hpp +++ b/include/boost/archive/detail/archive_serializer_map.hpp @@ -27,7 +27,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/basic_iarchive.hpp b/include/boost/archive/detail/basic_iarchive.hpp index 4d9bcf2550..f5a8c5a08e 100644 --- a/include/boost/archive/detail/basic_iarchive.hpp +++ b/include/boost/archive/detail/basic_iarchive.hpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -30,7 +31,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/basic_iserializer.hpp b/include/boost/archive/detail/basic_iserializer.hpp index 48da703915..37c5b779ed 100644 --- a/include/boost/archive/detail/basic_iserializer.hpp +++ b/include/boost/archive/detail/basic_iserializer.hpp @@ -32,7 +32,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization // forward declarations diff --git a/include/boost/archive/detail/basic_oarchive.hpp b/include/boost/archive/detail/basic_oarchive.hpp index 9620cdca6e..852202313a 100644 --- a/include/boost/archive/detail/basic_oarchive.hpp +++ b/include/boost/archive/detail/basic_oarchive.hpp @@ -22,13 +22,14 @@ #include #include +#include #include #include #include // must be the last header namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/basic_oserializer.hpp b/include/boost/archive/detail/basic_oserializer.hpp index a051957c22..a7f0210703 100644 --- a/include/boost/archive/detail/basic_oserializer.hpp +++ b/include/boost/archive/detail/basic_oserializer.hpp @@ -33,7 +33,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization // forward declarations diff --git a/include/boost/archive/detail/basic_pointer_iserializer.hpp b/include/boost/archive/detail/basic_pointer_iserializer.hpp index 229545bbcf..1150786b24 100644 --- a/include/boost/archive/detail/basic_pointer_iserializer.hpp +++ b/include/boost/archive/detail/basic_pointer_iserializer.hpp @@ -30,7 +30,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization // forward declarations diff --git a/include/boost/archive/detail/basic_pointer_oserializer.hpp b/include/boost/archive/detail/basic_pointer_oserializer.hpp index ca25c70bde..39d81401db 100644 --- a/include/boost/archive/detail/basic_pointer_oserializer.hpp +++ b/include/boost/archive/detail/basic_pointer_oserializer.hpp @@ -30,7 +30,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/basic_serializer_map.hpp b/include/boost/archive/detail/basic_serializer_map.hpp index bc2903dff6..8aebc81b76 100644 --- a/include/boost/archive/detail/basic_serializer_map.hpp +++ b/include/boost/archive/detail/basic_serializer_map.hpp @@ -26,7 +26,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } namespace archive { diff --git a/include/boost/archive/detail/common_iarchive.hpp b/include/boost/archive/detail/common_iarchive.hpp index 16bbee3ea6..3abcef728a 100644 --- a/include/boost/archive/detail/common_iarchive.hpp +++ b/include/boost/archive/detail/common_iarchive.hpp @@ -31,7 +31,7 @@ namespace boost { namespace archive { namespace detail { -class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; +class BOOST_SERIALIZATION_DECL_FWD extended_type_info; // note: referred to as Curiously Recurring Template Patter (CRTP) template diff --git a/include/boost/archive/detail/iserializer.hpp b/include/boost/archive/detail/iserializer.hpp index 7adb177dc8..e8159da039 100644 --- a/include/boost/archive/detail/iserializer.hpp +++ b/include/boost/archive/detail/iserializer.hpp @@ -96,7 +96,7 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/oserializer.hpp b/include/boost/archive/detail/oserializer.hpp index 4fd3f31a30..408bf61610 100644 --- a/include/boost/archive/detail/oserializer.hpp +++ b/include/boost/archive/detail/oserializer.hpp @@ -76,7 +76,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { diff --git a/include/boost/archive/detail/polymorphic_iarchive_route.hpp b/include/boost/archive/detail/polymorphic_iarchive_route.hpp index c678792f84..72eb4b83e7 100644 --- a/include/boost/archive/detail/polymorphic_iarchive_route.hpp +++ b/include/boost/archive/detail/polymorphic_iarchive_route.hpp @@ -34,7 +34,7 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail{ diff --git a/include/boost/archive/detail/polymorphic_oarchive_route.hpp b/include/boost/archive/detail/polymorphic_oarchive_route.hpp index 97c66b30a0..227772bca4 100644 --- a/include/boost/archive/detail/polymorphic_oarchive_route.hpp +++ b/include/boost/archive/detail/polymorphic_oarchive_route.hpp @@ -34,7 +34,7 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail{ diff --git a/include/boost/archive/polymorphic_iarchive.hpp b/include/boost/archive/polymorphic_iarchive.hpp index 0458229f92..3bc8f68d16 100644 --- a/include/boost/archive/polymorphic_iarchive.hpp +++ b/include/boost/archive/polymorphic_iarchive.hpp @@ -39,7 +39,7 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail { diff --git a/include/boost/archive/polymorphic_oarchive.hpp b/include/boost/archive/polymorphic_oarchive.hpp index ca3f8faf42..790047674a 100644 --- a/include/boost/archive/polymorphic_oarchive.hpp +++ b/include/boost/archive/polymorphic_oarchive.hpp @@ -38,7 +38,7 @@ namespace std{ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } // namespace serialization namespace archive { namespace detail { diff --git a/include/boost/serialization/extended_type_info.hpp b/include/boost/serialization/extended_type_info.hpp index fc9310d50f..c484bf4543 100644 --- a/include/boost/serialization/extended_type_info.hpp +++ b/include/boost/serialization/extended_type_info.hpp @@ -41,7 +41,7 @@ namespace void_cast_detail{ class void_caster; } -class BOOST_SYMBOL_VISIBLE extended_type_info : +class BOOST_SERIALIZATION_DECL extended_type_info : private boost::noncopyable { private: diff --git a/include/boost/serialization/extended_type_info_no_rtti.hpp b/include/boost/serialization/extended_type_info_no_rtti.hpp index 5a38cf4949..82f6174adc 100644 --- a/include/boost/serialization/extended_type_info_no_rtti.hpp +++ b/include/boost/serialization/extended_type_info_no_rtti.hpp @@ -52,7 +52,7 @@ namespace no_rtti_system { // common base class to share type_info_key. This is used to // identify the method used to keep track of the extended type -class BOOST_SYMBOL_VISIBLE extended_type_info_no_rtti_0 : +class BOOST_SERIALIZATION_DECL extended_type_info_no_rtti_0 : public extended_type_info { protected: diff --git a/include/boost/serialization/extended_type_info_typeid.hpp b/include/boost/serialization/extended_type_info_typeid.hpp index f76507bc7b..08aa24287d 100644 --- a/include/boost/serialization/extended_type_info_typeid.hpp +++ b/include/boost/serialization/extended_type_info_typeid.hpp @@ -49,7 +49,7 @@ namespace boost { namespace serialization { namespace typeid_system { -class BOOST_SYMBOL_VISIBLE extended_type_info_typeid_0 : +class BOOST_SERIALIZATION_DECL extended_type_info_typeid_0 : public extended_type_info { virtual const char * get_debug_info() const { diff --git a/include/boost/serialization/void_cast.hpp b/include/boost/serialization/void_cast.hpp index bffb29ad7e..9b7a7517fd 100644 --- a/include/boost/serialization/void_cast.hpp +++ b/include/boost/serialization/void_cast.hpp @@ -40,7 +40,7 @@ namespace boost { namespace serialization { -class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; +class BOOST_SERIALIZATION_DECL_FWD 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. diff --git a/src/basic_serializer_map.cpp b/src/basic_serializer_map.cpp index 5d58bb8730..a092d99f7b 100644 --- a/src/basic_serializer_map.cpp +++ b/src/basic_serializer_map.cpp @@ -28,7 +28,7 @@ namespace boost { namespace serialization { - class BOOST_SYMBOL_VISIBLE_FWD extended_type_info; + class BOOST_SERIALIZATION_DECL_FWD extended_type_info; } namespace archive { namespace detail { From 550e6cb1976146324d80561f77a46f1d3538d720 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 3 Sep 2018 12:23:32 +0200 Subject: [PATCH 11/16] Fix void_caster forward declaration --- include/boost/serialization/extended_type_info.hpp | 2 +- include/boost/serialization/void_cast_fwd.hpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/serialization/extended_type_info.hpp b/include/boost/serialization/extended_type_info.hpp index c484bf4543..25e05eb08a 100644 --- a/include/boost/serialization/extended_type_info.hpp +++ b/include/boost/serialization/extended_type_info.hpp @@ -38,7 +38,7 @@ namespace boost { namespace serialization { namespace void_cast_detail{ - class void_caster; + class BOOST_SYMBOL_VISIBLE_FWD void_caster; } class BOOST_SERIALIZATION_DECL extended_type_info : diff --git a/include/boost/serialization/void_cast_fwd.hpp b/include/boost/serialization/void_cast_fwd.hpp index def61d52bb..d92e6c3418 100644 --- a/include/boost/serialization/void_cast_fwd.hpp +++ b/include/boost/serialization/void_cast_fwd.hpp @@ -19,11 +19,12 @@ #include // NULL #include +#include namespace boost { namespace serialization { namespace void_cast_detail{ -class void_caster; +class BOOST_SYMBOL_VISIBLE_FWD void_caster; } // namespace void_cast_detail template BOOST_DLLEXPORT From 0131cebb9c931360dfebc22411ca4ccf7186943d Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 3 Sep 2018 15:07:09 +0200 Subject: [PATCH 12/16] Remove BOOST_SERIALIZATION_DECL from various extended_type_info* members MSVC doesn't like that. --- include/boost/serialization/extended_type_info.hpp | 14 +++++++------- .../serialization/extended_type_info_no_rtti.hpp | 8 ++++---- .../serialization/extended_type_info_typeid.hpp | 14 +++++++------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/boost/serialization/extended_type_info.hpp b/include/boost/serialization/extended_type_info.hpp index 25e05eb08a..3b3b831fe3 100644 --- a/include/boost/serialization/extended_type_info.hpp +++ b/include/boost/serialization/extended_type_info.hpp @@ -56,29 +56,29 @@ class BOOST_SERIALIZATION_DECL extended_type_info : const char * m_key; protected: - BOOST_SERIALIZATION_DECL void key_unregister() const; - BOOST_SERIALIZATION_DECL void key_register() const; + void key_unregister() const; + void key_register() const; // this class can't be used as is. It's just the // common functionality for all type_info replacement // systems. Hence, make these protected - BOOST_SERIALIZATION_DECL extended_type_info( + extended_type_info( const unsigned int type_info_key, const char * key ); - virtual BOOST_SERIALIZATION_DECL ~extended_type_info(); + virtual ~extended_type_info(); public: const char * get_key() const { return m_key; } virtual const char * get_debug_info() const = 0; - BOOST_SERIALIZATION_DECL bool operator<(const extended_type_info &rhs) const; - BOOST_SERIALIZATION_DECL bool operator==(const extended_type_info &rhs) const; + bool operator<(const extended_type_info &rhs) const; + bool operator==(const extended_type_info &rhs) const; bool operator!=(const extended_type_info &rhs) const { return !(operator==(rhs)); } // note explicit "export" of static function to work around // gcc 4.5 mingw error - static BOOST_SERIALIZATION_DECL const extended_type_info * + static const extended_type_info * find(const char *key); // for plugins virtual void * construct(unsigned int /*count*/ = 0, ...) const = 0; diff --git a/include/boost/serialization/extended_type_info_no_rtti.hpp b/include/boost/serialization/extended_type_info_no_rtti.hpp index 82f6174adc..632d00dec1 100644 --- a/include/boost/serialization/extended_type_info_no_rtti.hpp +++ b/include/boost/serialization/extended_type_info_no_rtti.hpp @@ -56,12 +56,12 @@ class BOOST_SERIALIZATION_DECL extended_type_info_no_rtti_0 : public extended_type_info { protected: - BOOST_SERIALIZATION_DECL extended_type_info_no_rtti_0(const char * key); - BOOST_SERIALIZATION_DECL ~extended_type_info_no_rtti_0(); + extended_type_info_no_rtti_0(const char * key); + ~extended_type_info_no_rtti_0(); public: - virtual BOOST_SERIALIZATION_DECL bool + virtual bool is_less_than(const boost::serialization::extended_type_info &rhs) const ; - virtual BOOST_SERIALIZATION_DECL bool + virtual bool is_equal(const boost::serialization::extended_type_info &rhs) const ; }; diff --git a/include/boost/serialization/extended_type_info_typeid.hpp b/include/boost/serialization/extended_type_info_typeid.hpp index 08aa24287d..60afca4fd2 100644 --- a/include/boost/serialization/extended_type_info_typeid.hpp +++ b/include/boost/serialization/extended_type_info_typeid.hpp @@ -59,16 +59,16 @@ class BOOST_SERIALIZATION_DECL extended_type_info_typeid_0 : } protected: const std::type_info * m_ti; - BOOST_SERIALIZATION_DECL extended_type_info_typeid_0(const char * key); - BOOST_SERIALIZATION_DECL ~extended_type_info_typeid_0(); - BOOST_SERIALIZATION_DECL void type_register(const std::type_info & ti); - BOOST_SERIALIZATION_DECL void type_unregister(); - BOOST_SERIALIZATION_DECL const extended_type_info * + extended_type_info_typeid_0(const char * key); + ~extended_type_info_typeid_0(); + void type_register(const std::type_info & ti); + void type_unregister(); + const extended_type_info * get_extended_type_info(const std::type_info & ti) const; public: - virtual BOOST_SERIALIZATION_DECL bool + virtual bool is_less_than(const extended_type_info &rhs) const; - virtual BOOST_SERIALIZATION_DECL bool + virtual bool is_equal(const extended_type_info &rhs) const; const std::type_info & get_typeid() const { return *m_ti; From 745b6dda06f8d28bae78833b4a0b860edd0fecf8 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 5 Sep 2018 09:22:06 +0200 Subject: [PATCH 13/16] Provide usage-requirements, to ensure clients set BOOST_SERIALIZATION_DYN_LINK=1 --- build/Jamfile.v2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index d7823a5998..62609ade94 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -10,6 +10,8 @@ project boost/serialization : source-location ../src : requirements @include-spirit + : usage-requirements # pass these requirement to dependents (i.e. users) + shared:BOOST_SERIALIZATION_DYN_LINK=1 ; SPIRIT_ROOT = [ modules.peek : SPIRIT_ROOT ] ; From a5716f6ff82b0df6e57a6b85b66542bbaad7e9d9 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Fri, 7 Sep 2018 10:04:38 +0200 Subject: [PATCH 14/16] Fix missing BOOST_SERIALIZATION_DECL on void_caster method --- include/boost/serialization/void_cast.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/serialization/void_cast.hpp b/include/boost/serialization/void_cast.hpp index 9b7a7517fd..6e52cb1ebd 100644 --- a/include/boost/serialization/void_cast.hpp +++ b/include/boost/serialization/void_cast.hpp @@ -122,7 +122,7 @@ class BOOST_SYMBOL_VISIBLE void_caster : // addresses. This is necessary in order for the // void cast operations to work across dll and exe // module boundries. - bool operator<(const void_caster & rhs) const; + BOOST_SERIALIZATION_DECL bool operator<(const void_caster & rhs) const; const void_caster & operator*(){ return *this; From 4f6de059c02f8ef34fc219f08b1da4a6ad33bdbc Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Fri, 7 Sep 2018 13:01:09 +0200 Subject: [PATCH 15/16] Tweak BOOST_SERIALIZATION_IMPORT on Windows --- include/boost/archive/detail/decl.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/boost/archive/detail/decl.hpp b/include/boost/archive/detail/decl.hpp index e9d22b2535..71bf0f70dc 100644 --- a/include/boost/archive/detail/decl.hpp +++ b/include/boost/archive/detail/decl.hpp @@ -27,8 +27,14 @@ #define BOOST_SERIALIZATION_EXPORT BOOST_SYMBOL_EXPORT #if defined(BOOST_SERIALIZATION_VISIBLE) # define BOOST_SERIALIZATION_IMPORT BOOST_SERIALIZATION_VISIBLE -#else +#elif !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32) # define BOOST_SERIALIZATION_IMPORT BOOST_SYMBOL_IMPORT +#else +/* Windows: 'dllimport' is not strictly necessary, a symbol is imported + * if definition was built with 'dllexport'. + * Leaving off dllimport simplifies implementation of custom archives. + */ +# define BOOST_SERIALIZATION_IMPORT #endif #if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)) From 0e86e2a057531c3ffd4c05be81253926a4a72a24 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 7 Nov 2018 16:54:36 +0100 Subject: [PATCH 16/16] DLL-export complete basic_binary_{i,o}primitive classes --- .../boost/archive/basic_binary_iprimitive.hpp | 21 +++++++------------ .../boost/archive/basic_binary_oprimitive.hpp | 19 ++++++----------- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/include/boost/archive/basic_binary_iprimitive.hpp b/include/boost/archive/basic_binary_iprimitive.hpp index 665d3e81e1..3d95e09eb6 100644 --- a/include/boost/archive/basic_binary_iprimitive.hpp +++ b/include/boost/archive/basic_binary_iprimitive.hpp @@ -64,7 +64,7 @@ namespace archive { ///////////////////////////////////////////////////////////////////////////// // class binary_iarchive - read serialized objects from a input binary stream template -class BOOST_SYMBOL_VISIBLE basic_binary_iprimitive { +class BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_binary_iprimitive { #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS friend class load_access; protected: @@ -106,25 +106,18 @@ class BOOST_SYMBOL_VISIBLE basic_binary_iprimitive { BOOST_ASSERT(0 == i || 1 == i); (void)i; // warning suppression for release builds. } - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - load(std::string &s); + void load(std::string &s); #ifndef BOOST_NO_STD_WSTRING - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - load(std::wstring &ws); + void load(std::wstring &ws); #endif - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - load(char * t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - load(wchar_t * t); - - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - init(); - BOOST_ARCHIVE_OR_WARCHIVE_DECL + void load(char * t); + void load(wchar_t * t); + + void init(); basic_binary_iprimitive( std::basic_streambuf & sb, bool no_codecvt ); - BOOST_ARCHIVE_OR_WARCHIVE_DECL ~basic_binary_iprimitive(); public: // we provide an optimized load for all fundamental types diff --git a/include/boost/archive/basic_binary_oprimitive.hpp b/include/boost/archive/basic_binary_oprimitive.hpp index 6dc770c60e..2f820caeff 100644 --- a/include/boost/archive/basic_binary_oprimitive.hpp +++ b/include/boost/archive/basic_binary_oprimitive.hpp @@ -60,7 +60,7 @@ namespace archive { // class basic_binary_oprimitive - binary output of prmitives template -class BOOST_SYMBOL_VISIBLE basic_binary_oprimitive { +class BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_binary_oprimitive { #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS friend class save_access; protected: @@ -100,26 +100,19 @@ class BOOST_SYMBOL_VISIBLE basic_binary_oprimitive { BOOST_ASSERT(0 == static_cast(t) || 1 == static_cast(t)); save_binary(& t, sizeof(t)); } - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save(const std::string &s); + void save(const std::string &s); #ifndef BOOST_NO_STD_WSTRING - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save(const std::wstring &ws); + void save(const std::wstring &ws); #endif - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save(const char * t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - save(const wchar_t * t); + void save(const char * t); + void save(const wchar_t * t); - BOOST_ARCHIVE_OR_WARCHIVE_DECL void - init(); + void init(); - BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_binary_oprimitive( std::basic_streambuf & sb, bool no_codecvt ); - BOOST_ARCHIVE_OR_WARCHIVE_DECL ~basic_binary_oprimitive(); public: