From 15bac1e9b58dd00b14f08ef7a73d0efafc273985 Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Sun, 19 Jun 2016 02:32:12 -0400 Subject: [PATCH] config.h cleanup (#834) config.hpp and .travis.yml cleanup --- .travis.yml | 81 +++++++++++----------- CMakeLists.txt | 2 - Jamfile | 3 +- include/libtorrent/config.hpp | 13 ---- include/libtorrent/torrent.hpp | 2 +- include/libtorrent/web_peer_connection.hpp | 2 +- src/cpuid.cpp | 4 -- src/instantiate_connection.cpp | 2 - src/time.cpp | 11 --- 9 files changed, 44 insertions(+), 76 deletions(-) diff --git a/.travis.yml b/.travis.yml index 40d4e9af4..9ff149fad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,20 @@ language: cpp -os: - - linux - - osx - -env: - - variant=test_release coverage=1 docs=1 - - variant=test_debug sim=1 - - variant=test_barebones - - analyze=1 +matrix: + include: + - env: variant=test_release coverage=1 + - env: variant=test_debug sim=1 + - env: variant=test_barebones + - env: analyze=1 + - os: osx + osx_image: xcode6.4 + env: variant=test_release docs=1 + - os: osx + osx_image: xcode6.4 + env: variant=test_debug + - os: osx + osx_image: xcode6.4 + env: variant=test_barebones git: submodules: false @@ -43,7 +49,7 @@ before_install: - git submodule update --init --recursive - 'if [[ $TRAVIS_OS_NAME == "osx" && "$variant" != "" ]]; then brew update > /dev/null && brew install --quiet ccache boost-build boost-python; fi' - - 'if [[ $TRAVIS_OS_NAME == "osx" && "$docs" = "1" ]]; then + - 'if [ "$docs" = "1" ]; then brew install --quiet https://raw.githubusercontent.com/catap/homebrew/docutils/Library/Formula/docutils.rb; mkdir -p /Users/travis/Library/Python/2.7/lib/python/site-packages; echo ''import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")'' >> /Users/travis/Library/Python/2.7/lib/python/site-packages/homebrew.pth; @@ -57,7 +63,7 @@ before_install: - if [ $TRAVIS_OS_NAME == "osx" ]; then export toolset="darwin"; export sim="0"; fi - if [ $TRAVIS_OS_NAME == "osx" ]; then export target="osx-tests"; fi - if [ $TRAVIS_OS_NAME == "linux" ]; then export toolset="gcc"; fi - - if [[ $TRAVIS_OS_NAME == "linux" && "$coverage" == "1" ]]; then + - if [ "$coverage" == "1" ]; then export toolset=gcc-coverage; pip install --user codecov; fi @@ -78,13 +84,13 @@ install: - 'echo "using darwin : : ccache clang++ : -std=c11 -std=c++11 -Wno-deprecated-declarations ;" >> ~/user-config.jam' - 'echo "using python : 2.7 ;" >> ~/user-config.jam' - 'if [[ "$variant" != "" ]]; then ccache -V && ccache --show-stats && ccache --zero-stats; fi' - - if [[ "$docs" == "1" && $TRAVIS_OS_NAME == "osx" ]]; then rst2html.py --version; fi + - if [ "$docs" == "1" ]; then rst2html.py --version; fi script: - cd docs - - 'if [[ "$docs" == "1" && $TRAVIS_OS_NAME == "osx" ]]; then + - 'if [ "$docs" == "1" ]; then make RST2HTML=rst2html.py; fi' - cd .. @@ -94,7 +100,7 @@ script: - cd test - 'if [ "$variant" != "" ]; then bjam -j3 warnings-as-errors=on variant=$variant -l900 $toolset $target && - if [[ $TRAVIS_OS_NAME == "linux" && "$coverage" == "1" ]]; then + if [ "$coverage" == "1" ]; then codecov --root .. --gcov-exec gcov-5; fi; fi' @@ -135,32 +141,27 @@ script: # run cppcheck if enabled - 'if [[ "$analyze" == "1" ]]; then - if [[ $TRAVIS_OS_NAME == "linux" ]]; then - cppcheck --version && - find src test examples tools -type f | grep ".*\.cpp$" >cppcheck.files && - find simulation -type f -depth -2 | grep ".*\.cpp$" >>cppcheck.files && - cppcheck -DTORRENT_USE_IPV6="1" -DTORRENT_USE_I2P="1" - -DTORRENT_USE_OPENSSL="1" -DTORRENT_USE_INVARIANT_CHECKS="1" - -DTORRENT_EXPENSIVE_INVARIANT_CHECKS="1" -DTORRENT_USE_ASSERTS="1" - -UTORRENT_DISABLE_MUTABLE_TORRENTS -UTORRENT_DISABLE_LOGGING - -UTORRENT_DEBUG_BUFFERS -UTORRENT_EXPORT_EXTRA - --suppress=preprocessorErrorDirective - --suppress=noConstructor - --suppress=syntaxError - --enable=style - --template "{file}({line}): {severity} ({id}): {message}" - --inline-suppr --force --std=c++11 -j2 -I include -I /usr/local/include - --file-list=cppcheck.files 2> cppcheck.txt; - if [ -s cppcheck.txt ]; then - echo " ======= CPPCHECK ERRORS ====="; - cat cppcheck.txt; - exit 1; - fi; - fi; - if [[ $TRAVIS_OS_NAME == "osx" ]]; then - echo "nothing here yet"; - fi; - fi' + cppcheck --version && + find src test examples tools -type f | grep ".*\.cpp$" >cppcheck.files && + find simulation -type f -depth -2 | grep ".*\.cpp$" >>cppcheck.files && + cppcheck -DTORRENT_USE_IPV6="1" -DTORRENT_USE_I2P="1" + -DTORRENT_USE_OPENSSL="1" -DTORRENT_USE_INVARIANT_CHECKS="1" + -DTORRENT_EXPENSIVE_INVARIANT_CHECKS="1" -DTORRENT_USE_ASSERTS="1" + -UTORRENT_DISABLE_MUTABLE_TORRENTS -UTORRENT_DISABLE_LOGGING + -UTORRENT_DEBUG_BUFFERS -UTORRENT_EXPORT_EXTRA + --suppress=preprocessorErrorDirective + --suppress=noConstructor + --suppress=syntaxError + --enable=style + --template "{file}({line}): {severity} ({id}): {message}" + --inline-suppr --force --std=c++11 -j2 -I include -I /usr/local/include + --file-list=cppcheck.files 2> cppcheck.txt; + if [ -s cppcheck.txt ]; then + echo " ======= CPPCHECK ERRORS ====="; + cat cppcheck.txt; + exit 1; + fi; + fi' - 'if [[ "$variant" != "" ]]; then ccache --show-stats; fi' diff --git a/CMakeLists.txt b/CMakeLists.txt index f2bc1e869..82ae981f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -275,8 +275,6 @@ endif() include_directories(${Boost_INCLUDE_DIRS}) target_link_libraries(torrent-rasterbar ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) -# this works around a bug in asio in boost-1.39 -add_definitions(-DBOOST_ASIO_HASH_MAP_BUCKETS=1021 ) add_definitions(-DBOOST_ASIO_HAS_STD_CHRONO=1 ) if (WIN32) diff --git a/Jamfile b/Jamfile index eecd7040c..ab0eac3d1 100644 --- a/Jamfile +++ b/Jamfile @@ -491,6 +491,7 @@ variant test_release : release : production on full shared off on on multi + off ; variant test_debug : debug : openssl on on @@ -703,8 +704,6 @@ local usage-requirements = BOOST_ASIO_ENABLE_CANCELIO # make sure asio uses std::chrono BOOST_ASIO_HAS_STD_CHRONO -# this works around a bug in asio in boost-1.39 - BOOST_ASIO_HASH_MAP_BUCKETS=1021 @linking # these compiler settings just makes the compiler standard conforming msvc:/Zc:wchar_t diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index b1fd0e320..013654397 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -79,10 +79,6 @@ POSSIBILITY OF SUCH DAMAGE. # define TORRENT_DEPRECATED __attribute__ ((deprecated)) # endif -# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8) -# define TORRENT_NO_ATOMIC_DURATION 1 -# endif - // ======= SUNPRO ========= #elif defined __SUNPRO_CC @@ -93,9 +89,6 @@ POSSIBILITY OF SUCH DAMAGE. #elif defined BOOST_MSVC -#pragma warning(disable: 4258) -#pragma warning(disable: 4251) - // class X needs to have dll-interface to be used by clients of class Y #pragma warning(disable:4251) @@ -439,12 +432,6 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_NO_FPU 0 #endif -// defined to 1 if the compiler does not support putting -// std::chrono::time_point in a std::atomic (which it's supposed to) -#ifndef TORRENT_NO_ATOMIC_DURATION -#define TORRENT_NO_ATOMIC_DURATION 0 -#endif - #ifndef TORRENT_USE_IOSTREAM #ifndef BOOST_NO_IOSTREAM #define TORRENT_USE_IOSTREAM 1 diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 8a10c41d0..2944bb971 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -361,7 +361,7 @@ namespace libtorrent void set_share_mode(bool s); bool share_mode() const { return m_share_mode; } - // TOOD: make graceful pause also finish all sending blocks + // TODO: make graceful pause also finish all sending blocks // before disconnecting bool graceful_pause() const { return m_graceful_pause_mode; } diff --git a/include/libtorrent/web_peer_connection.hpp b/include/libtorrent/web_peer_connection.hpp index eb5a5e306..6f98e8c8e 100644 --- a/include/libtorrent/web_peer_connection.hpp +++ b/include/libtorrent/web_peer_connection.hpp @@ -69,7 +69,7 @@ namespace libtorrent public: // this is the constructor where the we are the active part. - // The peer_conenction should handshake and verify that the + // The peer_connection should handshake and verify that the // other end has the correct id web_peer_connection(peer_connection_args const& pack , web_seed_t& web); diff --git a/src/cpuid.cpp b/src/cpuid.cpp index 2ea70eed3..999703e6e 100644 --- a/src/cpuid.cpp +++ b/src/cpuid.cpp @@ -31,8 +31,6 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "libtorrent/config.hpp" -#include - #include "libtorrent/aux_/cpuid.hpp" #if defined _MSC_VER && TORRENT_HAS_SSE @@ -89,5 +87,3 @@ namespace libtorrent { namespace aux bool sse42_support = supports_sse42(); bool mmx_support = supports_mmx(); } } - - diff --git a/src/instantiate_connection.cpp b/src/instantiate_connection.cpp index 3f19bef38..9dee799d6 100644 --- a/src/instantiate_connection.cpp +++ b/src/instantiate_connection.cpp @@ -35,8 +35,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/socket_type.hpp" #include "libtorrent/utp_socket_manager.hpp" #include "libtorrent/instantiate_connection.hpp" -#include -#include namespace libtorrent { diff --git a/src/time.cpp b/src/time.cpp index c233df0e0..64e180cec 100644 --- a/src/time.cpp +++ b/src/time.cpp @@ -30,7 +30,6 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include "libtorrent/time.hpp" #include "libtorrent/aux_/time.hpp" #include @@ -39,20 +38,10 @@ namespace libtorrent { namespace aux // used to cache the current time regularly (update_time_now() is called by // the session_impl main thread). This is cheaper than a system call and can // be used where more accurate time is not necessary -#if !TORRENT_NO_ATOMIC_DURATION namespace { std::atomic g_current_time(clock_type::now()); } time_point time_now() { return aux::g_current_time.load(); } void update_time_now() { g_current_time.store(clock_type::now()); } -#else - // work-around for not being able to put time_point in std::atomic - namespace { - std::atomic g_current_time(clock_type::now().time_since_epoch().count()); - } - time_point time_now() { return time_point(clock_type::duration(aux::g_current_time.load())); } - void update_time_now() { g_current_time.store(clock_type::now().time_since_epoch().count()); } -#endif } } -