From 33117ce5b29f324bcd1a6864ff8355928abfe77c Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 3 Jul 2016 11:42:57 -0400 Subject: [PATCH] extend link compatibility check to export-extra configurations (#876) extend link compatibility check to export-extra configurations --- Jamfile | 16 ++++++---------- include/libtorrent/aux_/session_settings.hpp | 2 +- include/libtorrent/build_config.hpp | 13 ++++++++++++- include/libtorrent/debug.hpp | 2 +- include/libtorrent/settings_pack.hpp | 2 +- include/libtorrent/tailqueue.hpp | 2 +- simulation/Jamfile | 3 ++- test/Jamfile | 5 +++-- 8 files changed, 27 insertions(+), 18 deletions(-) diff --git a/Jamfile b/Jamfile index 4c40ba9ce..1a574161b 100644 --- a/Jamfile +++ b/Jamfile @@ -308,15 +308,6 @@ rule building ( properties * ) { local result ; - if shared in $(properties) && on in $(properties) - { - # export some internal libtorrent functions - # in order to me able to unit test them. - # this is off by default to keep the export - # symbol table reasonably small - result += TORRENT_EXPORT_EXTRA ; - } - if msvc in $(properties) { # allow larger .obj files (with more sections) @@ -503,6 +494,11 @@ feature.compose on : TORRENT_PROFILE_CALLS=1 ; # controls whether or not to export some internal # libtorrent functions. Used for unit testing feature export-extra : off on : composite propagated ; +# export some internal libtorrent functions +# in order to me able to unit test them. +# this is off by default to keep the export +# symbol table reasonably small +feature.compose on : TORRENT_EXPORT_EXTRA ; # this is a trick to get filename paths to targets to become shorter @@ -741,7 +737,6 @@ local usage-requirements = # disable bogus deprecation warnings on msvc8 msvc:_SCL_SECURE_NO_DEPRECATE msvc:_CRT_SECURE_NO_DEPRECATE - off:TORRENT_DISABLE_LOGGING $(CXXFLAGS) $(LDFLAGS) @@ -781,6 +776,7 @@ lib torrent : # usage requirements $(usage-requirements) shared:TORRENT_LINKING_SHARED + ; headers = [ path.glob-tree include/libtorrent : *.hpp ] ; diff --git a/include/libtorrent/aux_/session_settings.hpp b/include/libtorrent/aux_/session_settings.hpp index b4bd77d4d..fd9ce855e 100644 --- a/include/libtorrent/aux_/session_settings.hpp +++ b/include/libtorrent/aux_/session_settings.hpp @@ -51,7 +51,7 @@ namespace libtorrent { namespace aux struct TORRENT_EXTRA_EXPORT session_settings { - friend void libtorrent::save_settings_to_dict( + friend TORRENT_EXTRA_EXPORT void libtorrent::save_settings_to_dict( aux::session_settings const& s, entry::dictionary_type& sett); void set_str(int name, std::string const& value) diff --git a/include/libtorrent/build_config.hpp b/include/libtorrent/build_config.hpp index aade5e247..47b208581 100644 --- a/include/libtorrent/build_config.hpp +++ b/include/libtorrent/build_config.hpp @@ -53,9 +53,20 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_CFG_DEPR deprecated_ #endif +#if defined TORRENT_EXPORT_EXTRA +#if TORRENT_USE_ASSERTS +#define TORRENT_CFG_ASSERTS asserts_ +#else +#define TORRENT_CFG_ASSERTS noasserts_ +#endif +#else +#define TORRENT_CFG_ASSERTS +#endif + #define TORRENT_CFG \ BOOST_PP_CAT(TORRENT_CFG_IPV6, \ - TORRENT_CFG_DEPR) + BOOST_PP_CAT(TORRENT_CFG_DEPR, \ + TORRENT_CFG_ASSERTS)) #define TORRENT_CFG_STRING BOOST_PP_STRINGIZE(TORRENT_CFG) diff --git a/include/libtorrent/debug.hpp b/include/libtorrent/debug.hpp index 5de8bdc95..68dbffc96 100644 --- a/include/libtorrent/debug.hpp +++ b/include/libtorrent/debug.hpp @@ -176,7 +176,7 @@ namespace libtorrent namespace libtorrent { #if TORRENT_USE_ASSERTS - struct single_threaded + struct TORRENT_EXTRA_EXPORT single_threaded { single_threaded(): m_id() {} ~single_threaded() { m_id = std::thread::id(); } diff --git a/include/libtorrent/settings_pack.hpp b/include/libtorrent/settings_pack.hpp index 159a641e7..f15d74820 100644 --- a/include/libtorrent/settings_pack.hpp +++ b/include/libtorrent/settings_pack.hpp @@ -83,7 +83,7 @@ namespace libtorrent // struct TORRENT_EXPORT settings_pack { - friend void apply_pack(settings_pack const* pack, aux::session_settings& sett, aux::session_impl* ses); + friend TORRENT_EXTRA_EXPORT void apply_pack(settings_pack const* pack, aux::session_settings& sett, aux::session_impl* ses); void set_str(int name, std::string val); void set_int(int name, int val); diff --git a/include/libtorrent/tailqueue.hpp b/include/libtorrent/tailqueue.hpp index a493cf32b..9ecefa0c2 100644 --- a/include/libtorrent/tailqueue.hpp +++ b/include/libtorrent/tailqueue.hpp @@ -69,7 +69,7 @@ namespace libtorrent template //#error boost::enable_if< is_base > > - struct TORRENT_EXTRA_EXPORT tailqueue + struct tailqueue { tailqueue(): m_first(nullptr), m_last(nullptr), m_size(0) {} diff --git a/simulation/Jamfile b/simulation/Jamfile index a1699de9b..c3036a051 100644 --- a/simulation/Jamfile +++ b/simulation/Jamfile @@ -9,7 +9,8 @@ use-project /libsimulator : libsimulator ; project : requirements on - /torrent//torrent/on + on + /torrent//torrent /libtorrent_test//libtorrent_test setup_swarm.cpp setup_dht.cpp diff --git a/test/Jamfile b/test/Jamfile index 766cf0942..071e072d3 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -44,12 +44,12 @@ rule link_libtorrent ( properties * ) if shared in $(properties) { result += - /torrent//torrent/shared/shared/on ; + /torrent//torrent/shared/shared ; } else { result += - /torrent//torrent/static/static/on ; + /torrent//torrent/static/static ; } return $(result) ; } @@ -102,6 +102,7 @@ project # disable warning C4275: non DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' msvc:/wd4275 msvc:_SCL_SECURE_NO_WARNINGS + on : default-build multi on