From 6d1c2c434b0bea16e292085a6177d17f9092e5f6 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Tue, 3 Jan 2017 10:42:30 -0800 Subject: [PATCH 1/5] Adding c++0x to gcc command line --- .travis.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 243c569..9cefc35 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,31 +45,28 @@ matrix: include: - os: linux - env: TOOLSET=gcc COMPILER=g++ + env: TOOLSET=gcc COMPILER=g++ CXXSTD=c++0x - os: linux - env: TOOLSET=gcc COMPILER=g++-4.9 + env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++0x - os: linux - env: TOOLSET=gcc COMPILER=g++-5 + env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=c++0x - os: linux - env: TOOLSET=gcc COMPILER=g++-6 + env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=c++0x - os: linux - env: TOOLSET=gcc COMPILER=g++-6 + env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=c++0x - os: linux - env: TOOLSET=clang COMPILER=clang++-3.6 + env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=c++0x - os: linux - env: TOOLSET=clang COMPILER=clang++-3.7 - - - os: linux - env: TOOLSET=clang COMPILER=clang++-3.8 + env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=c++0x - os: osx - env: TOOLSET=clang COMPILER=clang++ + env: TOOLSET=clang COMPILER=clang++ CXXSTD=c++0x install: - cd .. @@ -86,7 +83,7 @@ install: script: - |- - echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam + echo "using $TOOLSET : : $COMPILER : -std=$CXXSTD ;" > ~/user-config.jam - ./b2 libs/exception/test toolset=$TOOLSET notifications: From 406d3c87f7f95d1fbca3e27e6cd2b7e0f5d355a8 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Tue, 3 Jan 2017 12:17:27 -0800 Subject: [PATCH 2/5] Maybe fixing 11874 --- include/boost/exception/detail/error_info_impl.hpp | 12 ++++++------ include/boost/exception/info.hpp | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/boost/exception/detail/error_info_impl.hpp b/include/boost/exception/detail/error_info_impl.hpp index ecd086d..ed593be 100644 --- a/include/boost/exception/detail/error_info_impl.hpp +++ b/include/boost/exception/detail/error_info_impl.hpp @@ -47,24 +47,24 @@ boost typedef T value_type; - error_info( value_type const & value ); + error_info( value_type const & v ); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES error_info( error_info const & ); - error_info( value_type && value ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(value)))); - error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.value_)))); + error_info( value_type && v ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(v)))); + error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.v_)))); #endif ~error_info() throw(); value_type const & value() const { - return value_; + return v_; } value_type & value() { - return value_; + return v_; } private: @@ -75,7 +75,7 @@ boost std::string name_value_string() const; - value_type value_; + value_type v_; }; } diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp index f06df42..5b7c17b 100644 --- a/include/boost/exception/info.hpp +++ b/include/boost/exception/info.hpp @@ -41,8 +41,8 @@ boost template inline error_info:: - error_info( value_type const & value ): - value_(value) + error_info( value_type const & v ): + v_(v) { } @@ -51,21 +51,21 @@ boost inline error_info:: error_info( error_info const & x ): - value_(x.value_) + v_(x.v_) { } template inline error_info:: - error_info( value_type && value ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(value)))): - value_(std::move(value)) + error_info( value_type && v ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(v)))): + v_(std::move(v)) { } template inline error_info:: - error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.value_)))): - value_(std::move(x.value_)) + error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.v_)))): + v_(std::move(x.v_)) { } #endif From 972667f52e9a79536f10bed5032f1a5afc294238 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Tue, 3 Jan 2017 14:35:11 -0800 Subject: [PATCH 3/5] Tweaks to try to defeat g++4.6.3 --- .../exception/detail/error_info_impl.hpp | 31 +++++++++------ include/boost/exception/info.hpp | 39 ------------------- test/error_info_basic_test.cpp | 20 +++++----- 3 files changed, 29 insertions(+), 61 deletions(-) diff --git a/include/boost/exception/detail/error_info_impl.hpp b/include/boost/exception/detail/error_info_impl.hpp index ed593be..479ef54 100644 --- a/include/boost/exception/detail/error_info_impl.hpp +++ b/include/boost/exception/detail/error_info_impl.hpp @@ -44,37 +44,44 @@ boost public exception_detail::error_info_base { public: - typedef T value_type; - - error_info( value_type const & v ); + error_info( value_type const & v ): + v_(v) + { + } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - error_info( error_info const & ); - error_info( value_type && v ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(v)))); - error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.v_)))); + error_info( error_info const & x ): + v_(x.v_) + { + } + error_info( value_type && v ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(v)))): + v_(std::move(v)) + { + } + error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.v_)))): + v_(std::move(x.v_)) + { + } #endif - ~error_info() throw(); - + ~error_info() throw() + { + } value_type const & value() const { return v_; } - value_type & value() { return v_; } - private: error_info & operator=( error_info const & ); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES error_info & operator=( error_info && x ); #endif - std::string name_value_string() const; - value_type v_; }; } diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp index 5b7c17b..71abe53 100644 --- a/include/boost/exception/info.hpp +++ b/include/boost/exception/info.hpp @@ -38,45 +38,6 @@ boost return '[' + error_info_name(x) + "] = " + to_string_stub(x.value()) + '\n'; } - template - inline - error_info:: - error_info( value_type const & v ): - v_(v) - { - } - -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template - inline - error_info:: - error_info( error_info const & x ): - v_(x.v_) - { - } - template - inline - error_info:: - error_info( value_type && v ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(v)))): - v_(std::move(v)) - { - } - template - inline - error_info:: - error_info( error_info && x ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(x.v_)))): - v_(std::move(x.v_)) - { - } -#endif - - template - inline - error_info:: - ~error_info() throw() - { - } - template inline std::string diff --git a/test/error_info_basic_test.cpp b/test/error_info_basic_test.cpp index 021eabc..aa8d6a7 100644 --- a/test/error_info_basic_test.cpp +++ b/test/error_info_basic_test.cpp @@ -16,14 +16,14 @@ typedef boost::error_info error_info_str int main() - { - try - { - throw my_exception() << error_info_string("doh"); - } - catch( my_exception & e ) - { - BOOST_TEST(boost::get_error_info(e) && !strcmp(boost::get_error_info(e)->c_str(),"doh")); - } + { + try + { + throw my_exception() << error_info_string("doh"); + } + catch( my_exception & e ) + { + BOOST_TEST(boost::get_error_info(e) && !strcmp(boost::get_error_info(e)->c_str(),"doh")); + } return 0; - } + } From d39ba0008800b58b888ddfa28de8f479f99bf963 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Tue, 3 Jan 2017 15:05:12 -0800 Subject: [PATCH 4/5] Added more g++ versions to .travis.yml --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 9cefc35..507b9eb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,8 @@ env: addons: apt: packages: + - g++-4.7 + - g++-4.8 - g++-4.9 - g++-5 - g++-6 @@ -47,6 +49,12 @@ matrix: - os: linux env: TOOLSET=gcc COMPILER=g++ CXXSTD=c++0x + - os: linux + env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=c++0x + + - os: linux + env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=c++0x + - os: linux env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=c++0x From e8877d4837e53df97d38158a875edf850a01d61a Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Tue, 3 Jan 2017 15:25:52 -0800 Subject: [PATCH 5/5] Workaround for 11874 --- include/boost/exception/detail/error_info_impl.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/boost/exception/detail/error_info_impl.hpp b/include/boost/exception/detail/error_info_impl.hpp index 479ef54..6fc542c 100644 --- a/include/boost/exception/detail/error_info_impl.hpp +++ b/include/boost/exception/detail/error_info_impl.hpp @@ -49,6 +49,7 @@ boost v_(v) { } +#if (__GNUC__*100+__GNUC_MINOR__!=406) //workaround for g++ bug #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES error_info( error_info const & x ): v_(x.v_) @@ -62,6 +63,7 @@ boost v_(std::move(x.v_)) { } +#endif #endif ~error_info() throw() {