diff --git a/.travis.yml b/.travis.yml index bcee61d65..95f21b7bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ matrix: fast_finish: true include: - if: repo = arvidn/libtorrent - env: variant=release sonar_scan=1 toolset=gcc + env: variant=release sonar_scan=1 toolset=gcc check_headers=1 - env: variant=debug toolset=gcc lint=1 pylint=1 clang_tidy=1 addons: apt: @@ -59,7 +59,7 @@ before_install: - git submodule update --init --recursive - 'if [[ $crypto == "" ]]; then export crypto=built-in; fi' - - 'if [[ $TRAVIS_OS_NAME == "osx" && ( "$tests" == "1" || "$sim" == 1 || "$examples" == "1" || "$tools" == "1" || "$python" == "1" ) ]]; then + - 'if [[ $TRAVIS_OS_NAME == "osx" && ( "$tests" == "1" || "$sim" == 1 || "$examples" == "1" || "$tools" == "1" || "$python" == "1" || "$check_headers" == "1" ) ]]; then travis_retry brew update > /dev/null && brew install ccache boost-build; fi' - 'if [[ $TRAVIS_OS_NAME == "osx" && "$python" == "1" ]]; then @@ -207,6 +207,10 @@ script: bjam -a -j3 clang_tidy; fi' + - 'if [ "$check_headers" == "1" ]; then + bjam -j3 check-headers crypto=$crypto debug-iterators=on picker-debugging=on asserts=on invariant-checks=full $toolset variant=$variant; + fi' + # if we are building with code coverage, report it as soon as possible # libtorrent is the name of the test suite target - cd test diff --git a/Jamfile b/Jamfile index 73374f034..85540db6f 100644 --- a/Jamfile +++ b/Jamfile @@ -8,6 +8,7 @@ import errors ; import feature : feature ; import package ; import virtual-target ; +import cast ; BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; CXXFLAGS = [ modules.peek : CXXFLAGS ] ; @@ -844,3 +845,20 @@ package.install install : torrent : $(headers) ; + +local header_targets ; +for local target in $(headers) +{ + if ! [ path.basename $(target) ] in windows.hpp win_util.hpp win_crypto_provider.hpp torrent_impl.hpp cppint_import_export.hpp + { + # this cast tells boost build that the header files really *are* cpp files + # otherwise the object rule doesn't know which language to interpret them as + obj header-build/$(target).o : [ cast.cast _ cpp : $(target) ] + : /torrent -fsyntax-only ; + explicit header-build/$(target).o ; + header_targets += $(target) ; + } +} + +alias check-headers : header-build/$(header_targets).o ; +explicit check-headers ; diff --git a/include/libtorrent/aux_/allocating_handler.hpp b/include/libtorrent/aux_/allocating_handler.hpp index d5d386ce0..f2353f724 100644 --- a/include/libtorrent/aux_/allocating_handler.hpp +++ b/include/libtorrent/aux_/allocating_handler.hpp @@ -37,6 +37,8 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/error_code.hpp" #include "libtorrent/aux_/aligned_storage.hpp" +#include "libtorrent/debug.hpp" // for TORRENT_ASSERT + #include namespace libtorrent { namespace aux { diff --git a/include/libtorrent/aux_/dev_random.hpp b/include/libtorrent/aux_/dev_random.hpp index a46f3d6b8..e861b366c 100644 --- a/include/libtorrent/aux_/dev_random.hpp +++ b/include/libtorrent/aux_/dev_random.hpp @@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/span.hpp" +#include "libtorrent/error_code.hpp" // for system_error #include "libtorrent/aux_/throw.hpp" #include diff --git a/include/libtorrent/aux_/has_block.hpp b/include/libtorrent/aux_/has_block.hpp index f06582a9c..6b5709c8e 100644 --- a/include/libtorrent/aux_/has_block.hpp +++ b/include/libtorrent/aux_/has_block.hpp @@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_HAS_BLOCK_HPP_INCLUDED #include "libtorrent/piece_block.hpp" +#include "libtorrent/peer_connection.hpp" // for pending_block namespace libtorrent { namespace aux { diff --git a/include/libtorrent/aux_/instantiate_connection.hpp b/include/libtorrent/aux_/instantiate_connection.hpp index fc2070da4..83826a966 100644 --- a/include/libtorrent/aux_/instantiate_connection.hpp +++ b/include/libtorrent/aux_/instantiate_connection.hpp @@ -34,6 +34,9 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_INSTANTIATE_CONNECTION #include "libtorrent/aux_/export.hpp" +#include "libtorrent/io_service.hpp" +#include "libtorrent/aux_/proxy_settings.hpp" +#include "libtorrent/aux_/socket_type.hpp" namespace libtorrent { diff --git a/include/libtorrent/aux_/lsd.hpp b/include/libtorrent/aux_/lsd.hpp index 5e433bbb8..ecc391aba 100644 --- a/include/libtorrent/aux_/lsd.hpp +++ b/include/libtorrent/aux_/lsd.hpp @@ -34,6 +34,8 @@ POSSIBILITY OF SUCH DAMAGE. #define LIBTORRENT_LSD_HPP #include "libtorrent/config.hpp" +#include "libtorrent/socket.hpp" // for tcp::endpoint +#include "libtorrent/sha1_hash.hpp" namespace libtorrent { namespace aux { struct TORRENT_EXTRA_EXPORT lsd_callback diff --git a/include/libtorrent/aux_/noexcept_movable.hpp b/include/libtorrent/aux_/noexcept_movable.hpp index 4d25c93db..b59e7de59 100644 --- a/include/libtorrent/aux_/noexcept_movable.hpp +++ b/include/libtorrent/aux_/noexcept_movable.hpp @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_NOEXCEPT_MOVABLE_HPP_INCLUDED #include +#include namespace libtorrent { namespace aux { diff --git a/include/libtorrent/aux_/portmap.hpp b/include/libtorrent/aux_/portmap.hpp index 083948c4b..437b3d003 100644 --- a/include/libtorrent/aux_/portmap.hpp +++ b/include/libtorrent/aux_/portmap.hpp @@ -35,6 +35,9 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/portmap.hpp" +#include "libtorrent/address.hpp" +#include "libtorrent/time.hpp" +#include "libtorrent/error_code.hpp" namespace libtorrent { namespace aux { diff --git a/include/libtorrent/aux_/range.hpp b/include/libtorrent/aux_/range.hpp index d9b89bd29..4856ce955 100644 --- a/include/libtorrent/aux_/range.hpp +++ b/include/libtorrent/aux_/range.hpp @@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_RANGE_HPP #define TORRENT_RANGE_HPP +#include "libtorrent/aux_/vector.hpp" + namespace libtorrent { namespace aux { template diff --git a/include/libtorrent/http_tracker_connection.hpp b/include/libtorrent/http_tracker_connection.hpp index eb84aaea1..7fe09a73e 100644 --- a/include/libtorrent/http_tracker_connection.hpp +++ b/include/libtorrent/http_tracker_connection.hpp @@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/config.hpp" #include "libtorrent/peer_id.hpp" #include "libtorrent/error_code.hpp" +#include "libtorrent/tracker_manager.hpp" // for tracker_connection namespace libtorrent { diff --git a/include/libtorrent/kademlia/announce_flags.hpp b/include/libtorrent/kademlia/announce_flags.hpp index dc7df5ac6..71f5e0542 100644 --- a/include/libtorrent/kademlia/announce_flags.hpp +++ b/include/libtorrent/kademlia/announce_flags.hpp @@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef ANNOUNCE_FLAGS_HPP #define ANNOUNCE_FLAGS_HPP +#include + #include "libtorrent/flags.hpp" namespace libtorrent { namespace dht { diff --git a/include/libtorrent/kademlia/observer.hpp b/include/libtorrent/kademlia/observer.hpp index bcfc5ed08..2ae563719 100644 --- a/include/libtorrent/kademlia/observer.hpp +++ b/include/libtorrent/kademlia/observer.hpp @@ -39,6 +39,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include // for udp +#include namespace libtorrent { namespace dht { diff --git a/include/libtorrent/kademlia/types.hpp b/include/libtorrent/kademlia/types.hpp index 6e183f7c9..473a17ed5 100644 --- a/include/libtorrent/kademlia/types.hpp +++ b/include/libtorrent/kademlia/types.hpp @@ -34,6 +34,8 @@ POSSIBILITY OF SUCH DAMAGE. #define LIBTORRENT_TYPES_HPP #include +#include +#include namespace libtorrent { namespace dht { diff --git a/include/libtorrent/linked_list.hpp b/include/libtorrent/linked_list.hpp index fc870424c..f688652ef 100644 --- a/include/libtorrent/linked_list.hpp +++ b/include/libtorrent/linked_list.hpp @@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_LINKED_LIST_HPP #define TORRENT_LINKED_LIST_HPP +#include + #include "libtorrent/assert.hpp" namespace libtorrent { diff --git a/include/libtorrent/peer_class_type_filter.hpp b/include/libtorrent/peer_class_type_filter.hpp index bcf1b92fc..da548e190 100644 --- a/include/libtorrent/peer_class_type_filter.hpp +++ b/include/libtorrent/peer_class_type_filter.hpp @@ -36,6 +36,9 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#include "aux_/export.hpp" +#include "peer_class.hpp" // for peer_class_t + namespace libtorrent { // ``peer_class_type_filter`` is a simple container for rules for adding and subtracting diff --git a/include/libtorrent/pex_flags.hpp b/include/libtorrent/pex_flags.hpp index 03bf4436a..2f32afcce 100644 --- a/include/libtorrent/pex_flags.hpp +++ b/include/libtorrent/pex_flags.hpp @@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_PEX_FLAGS_HPP_INCLUDE #define TORRENT_PEX_FLAGS_HPP_INCLUDE +#include + #include "libtorrent/flags.hpp" namespace libtorrent { diff --git a/include/libtorrent/torrent_flags.hpp b/include/libtorrent/torrent_flags.hpp index 5d0723921..1f9783115 100644 --- a/include/libtorrent/torrent_flags.hpp +++ b/include/libtorrent/torrent_flags.hpp @@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_TORRENT_FLAGS_HPP #define TORRENT_TORRENT_FLAGS_HPP +#include + #include "libtorrent/config.hpp" #include "libtorrent/flags.hpp"