From 27598f92dbf30455fe05fe206129fade205fc3dc Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Wed, 28 Sep 2016 16:53:43 -0700 Subject: [PATCH 1/4] Configuration option to allow Boost Exception to use std::shared_ptr instead of boost::shared_ptr. --- include/boost/exception/detail/shared_ptr.hpp | 17 +++++++++++++++++ include/boost/exception/get_error_info.hpp | 3 ++- include/boost/exception/info.hpp | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 include/boost/exception/detail/shared_ptr.hpp diff --git a/include/boost/exception/detail/shared_ptr.hpp b/include/boost/exception/detail/shared_ptr.hpp new file mode 100644 index 0000000..51febe8 --- /dev/null +++ b/include/boost/exception/detail/shared_ptr.hpp @@ -0,0 +1,17 @@ +//Copyright (c) 2006-2008 Emil Dotchevski and Reverge Studios, Inc. + +//Distributed under 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) + +#ifndef UUID_837060E885AF11E68DA91D15E31AC075 +#define UUID_837060E885AF11E68DA91D15E31AC075 + +#ifdef BOOST_EXCEPTION_MINI_BOOST +#include +namespace boost { namespace exception_detail { using std::shared_ptr; } } +#else +#include +namespace boost { namespace exception_detail { using boost::shared_ptr; } } +#endif + +#endif diff --git a/include/boost/exception/get_error_info.hpp b/include/boost/exception/get_error_info.hpp index 96be763..51a21ba 100644 --- a/include/boost/exception/get_error_info.hpp +++ b/include/boost/exception/get_error_info.hpp @@ -15,7 +15,8 @@ #include #include #include -#include +#include +#include namespace boost diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp index f955e09..28a8ecf 100644 --- a/include/boost/exception/info.hpp +++ b/include/boost/exception/info.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include From e1378f7aef652e8c88edf5986bad6b6c645bfe2e Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Wed, 26 Oct 2016 11:51:40 -0700 Subject: [PATCH 2/4] Ticket #12553, plus tabs converted to spaces. --- .../exception/detail/error_info_impl.hpp | 4 +- include/boost/exception/info.hpp | 168 +++++++++--------- test/N3757_test.cpp | 2 +- test/error_info_lv_const_test.cpp | 6 +- test/error_info_lv_test.cpp | 6 +- test/error_info_rv_const_test.cpp | 18 +- test/error_info_rv_test.cpp | 12 +- 7 files changed, 108 insertions(+), 108 deletions(-) diff --git a/include/boost/exception/detail/error_info_impl.hpp b/include/boost/exception/detail/error_info_impl.hpp index dbe0afd..ecd086d 100644 --- a/include/boost/exception/detail/error_info_impl.hpp +++ b/include/boost/exception/detail/error_info_impl.hpp @@ -43,7 +43,7 @@ boost error_info: public exception_detail::error_info_base { - public: + public: typedef T value_type; @@ -67,7 +67,7 @@ boost return value_; } - private: + private: error_info & operator=( error_info const & ); #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES error_info & operator=( error_info && x ); diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp index 28a8ecf..4e5778e 100644 --- a/include/boost/exception/info.hpp +++ b/include/boost/exception/info.hpp @@ -47,27 +47,27 @@ boost } #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES - template - inline - error_info:: - error_info( error_info const & x ): - value_(x.value_) - { - } template inline error_info:: - error_info( value_type && value ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(value)))): - value_(std::move(value)) - { - } - template + error_info( error_info const & x ): + value_(x.value_) + { + } + 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( value_type && value ) BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(value_type(std::move(value)))): + value_(std::move(value)) + { + } + 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_)) + { + } #endif template @@ -202,79 +202,79 @@ boost #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template E const & set_info( E const &, error_info && ); - template - class set_info_rv; - template - class - set_info_rv > - { - template - friend E const & set_info( E const &, error_info && ); - template - static - E const & - set( E const & x, error_info && v ) - { - typedef error_info error_info_tag_t; - shared_ptr p( new error_info_tag_t(std::move(v)) ); - exception_detail::error_info_container * c=x.data_.get(); - if( !c ) - x.data_.adopt(c=new exception_detail::error_info_container_impl); - c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t)); - return x; - } - }; - template <> - class - set_info_rv - { - template - friend E const & set_info( E const &, error_info && ); - template - static - E const & - set( E const & x, throw_function && y ) - { - x.throw_function_=y.v_; - return x; - } - }; - template <> - class - set_info_rv - { - template - friend E const & set_info( E const &, error_info && ); - template - static - E const & - set( E const & x, throw_file && y ) - { - x.throw_file_=y.v_; - return x; - } - }; - template <> - class - set_info_rv - { - template - friend E const & set_info( E const &, error_info && ); - template - static - E const & - set( E const & x, throw_line && y ) - { - x.throw_line_=y.v_; - return x; - } - }; + template + struct set_info_rv; + template + class + set_info_rv > + { + template + friend E const & set_info( E const &, error_info && ); + template + static + E const & + set( E const & x, error_info && v ) + { + typedef error_info error_info_tag_t; + shared_ptr p( new error_info_tag_t(std::move(v)) ); + exception_detail::error_info_container * c=x.data_.get(); + if( !c ) + x.data_.adopt(c=new exception_detail::error_info_container_impl); + c->set(p,BOOST_EXCEPTION_STATIC_TYPEID(error_info_tag_t)); + return x; + } + }; + template <> + class + set_info_rv + { + template + friend E const & set_info( E const &, error_info && ); + template + static + E const & + set( E const & x, throw_function && y ) + { + x.throw_function_=y.v_; + return x; + } + }; + template <> + class + set_info_rv + { + template + friend E const & set_info( E const &, error_info && ); + template + static + E const & + set( E const & x, throw_file && y ) + { + x.throw_file_=y.v_; + return x; + } + }; + template <> + class + set_info_rv + { + template + friend E const & set_info( E const &, error_info && ); + template + static + E const & + set( E const & x, throw_line && y ) + { + x.throw_line_=y.v_; + return x; + } + }; template inline E const & set_info( E const & x, error_info && v ) { - return set_info_rv >::template set(x,std::move(v)); + return set_info_rv >::template set(x,std::move(v)); } #endif diff --git a/test/N3757_test.cpp b/test/N3757_test.cpp index caa93ba..9dfcdc6 100644 --- a/test/N3757_test.cpp +++ b/test/N3757_test.cpp @@ -37,7 +37,7 @@ main() throw my_exception(); } catch( - boost::exception & e ) + boost::exception & e ) { e.set(42); e.set("42"); diff --git a/test/error_info_lv_const_test.cpp b/test/error_info_lv_const_test.cpp index c79f97a..f304e6d 100644 --- a/test/error_info_lv_const_test.cpp +++ b/test/error_info_lv_const_test.cpp @@ -7,7 +7,7 @@ template E const & add_info( E const & e, I const & i ) - { - return e << i; - } + { + return e << i; + } #include "error_info_test.hpp" diff --git a/test/error_info_lv_test.cpp b/test/error_info_lv_test.cpp index 994b941..3f3c8f6 100644 --- a/test/error_info_lv_test.cpp +++ b/test/error_info_lv_test.cpp @@ -7,7 +7,7 @@ template E const & add_info( E const & e, I i ) - { - return e << i; - } + { + return e << i; + } #include "error_info_test.hpp" diff --git a/test/error_info_rv_const_test.cpp b/test/error_info_rv_const_test.cpp index 2906061..cd01927 100644 --- a/test/error_info_rv_const_test.cpp +++ b/test/error_info_rv_const_test.cpp @@ -8,21 +8,21 @@ #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES int main() - { - return 0; - } + { + return 0; + } #else template I const rv_const( I i ) - { - return i; - } + { + return i; + } template E const & add_info( E const & e, I i ) - { - return e << rv_const(i); - } + { + return e << rv_const(i); + } #include "error_info_test.hpp" #endif diff --git a/test/error_info_rv_test.cpp b/test/error_info_rv_test.cpp index 433be92..a47f282 100644 --- a/test/error_info_rv_test.cpp +++ b/test/error_info_rv_test.cpp @@ -8,15 +8,15 @@ #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES int main() - { - return 0; - } + { + return 0; + } #else template E const & add_info( E const & e, I i ) - { - return e << std::move(i); - } + { + return e << std::move(i); + } #include "error_info_test.hpp" #endif From 6cf231330acc3f697faf5a61a592c1c7e548018a Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Wed, 26 Oct 2016 12:35:25 -0700 Subject: [PATCH 3/4] Ticket #12059 --- include/boost/exception/errinfo_api_function.hpp | 2 +- include/boost/exception/errinfo_errno.hpp | 2 +- test/error_info_lv_const_test.cpp | 2 +- test/error_info_lv_test.cpp | 2 +- test/error_info_rv_const_test.cpp | 2 +- test/error_info_rv_test.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/boost/exception/errinfo_api_function.hpp b/include/boost/exception/errinfo_api_function.hpp index 481c613..0cbbdb9 100644 --- a/include/boost/exception/errinfo_api_function.hpp +++ b/include/boost/exception/errinfo_api_function.hpp @@ -6,7 +6,7 @@ #ifndef UUID_DDFBB4546C1211DEA4659E9055D89593 #define UUID_DDFBB4546C1211DEA4659E9055D89593 -#include "boost/exception/error_info.hpp" +#include namespace boost diff --git a/include/boost/exception/errinfo_errno.hpp b/include/boost/exception/errinfo_errno.hpp index 657b5f7..de44e17 100644 --- a/include/boost/exception/errinfo_errno.hpp +++ b/include/boost/exception/errinfo_errno.hpp @@ -13,7 +13,7 @@ #pragma warning(disable:4996) #endif -#include "boost/exception/info.hpp" +#include #include #include diff --git a/test/error_info_lv_const_test.cpp b/test/error_info_lv_const_test.cpp index f304e6d..68e57a9 100644 --- a/test/error_info_lv_const_test.cpp +++ b/test/error_info_lv_const_test.cpp @@ -3,7 +3,7 @@ //Distributed under 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) -#include "boost/exception/info.hpp" +#include template E const & add_info( E const & e, I const & i ) diff --git a/test/error_info_lv_test.cpp b/test/error_info_lv_test.cpp index 3f3c8f6..66334b4 100644 --- a/test/error_info_lv_test.cpp +++ b/test/error_info_lv_test.cpp @@ -3,7 +3,7 @@ //Distributed under 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) -#include "boost/exception/info.hpp" +#include template E const & add_info( E const & e, I i ) diff --git a/test/error_info_rv_const_test.cpp b/test/error_info_rv_const_test.cpp index cd01927..23b137f 100644 --- a/test/error_info_rv_const_test.cpp +++ b/test/error_info_rv_const_test.cpp @@ -3,7 +3,7 @@ //Distributed under 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) -#include "boost/exception/info.hpp" +#include #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES int diff --git a/test/error_info_rv_test.cpp b/test/error_info_rv_test.cpp index a47f282..3c8c718 100644 --- a/test/error_info_rv_test.cpp +++ b/test/error_info_rv_test.cpp @@ -3,7 +3,7 @@ //Distributed under 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) -#include "boost/exception/info.hpp" +#include #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES int From 14d3b01c60c6324abe43cd016a0cc221cee4ed00 Mon Sep 17 00:00:00 2001 From: Emil Dotchevski Date: Wed, 2 Nov 2016 23:53:42 -0700 Subject: [PATCH 4/4] Fixing more struct/class discrepancies. --- include/boost/exception/info.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/boost/exception/info.hpp b/include/boost/exception/info.hpp index 4e5778e..f06df42 100644 --- a/include/boost/exception/info.hpp +++ b/include/boost/exception/info.hpp @@ -205,7 +205,7 @@ boost template struct set_info_rv; template - class + struct set_info_rv > { template @@ -225,7 +225,7 @@ boost } }; template <> - class + struct set_info_rv { template @@ -240,7 +240,7 @@ boost } }; template <> - class + struct set_info_rv { template @@ -255,7 +255,7 @@ boost } }; template <> - class + struct set_info_rv { template