diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b8274b1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,185 @@ +name: CI + +on: + pull_request: + push: + branches: + - master + - develop + - feature/** + +env: + UBSAN_OPTIONS: print_stacktrace=1 + +jobs: + posix: + strategy: + fail-fast: false + matrix: + include: + - toolset: gcc-4.7 + cxxstd: "03,11" + os: ubuntu-16.04 + install: g++-4.7 + - toolset: gcc-4.8 + cxxstd: "03,11" + os: ubuntu-16.04 + install: g++-4.8 + - toolset: gcc-4.9 + cxxstd: "03,11" + os: ubuntu-16.04 + install: g++-4.9 + - toolset: gcc-5 + cxxstd: "03,11,14,1z" + os: ubuntu-16.04 + - toolset: gcc-6 + cxxstd: "03,11,14,1z" + os: ubuntu-16.04 + install: g++-6 + - toolset: gcc-7 + cxxstd: "03,11,14,17" + os: ubuntu-18.04 + - toolset: gcc-8 + cxxstd: "03,11,14,17,2a" + os: ubuntu-18.04 + - toolset: gcc-9 + cxxstd: "03,11,14,17,2a" + os: ubuntu-18.04 + - toolset: gcc-10 + cxxstd: "03,11,14,17,2a" + os: ubuntu-18.04 + - toolset: clang + compiler: clang++-3.5 + cxxstd: "03,11,14" + os: ubuntu-16.04 + install: clang-3.5 + - toolset: clang + compiler: clang++-3.6 + cxxstd: "03,11,14" + os: ubuntu-16.04 + install: clang-3.6 + - toolset: clang + compiler: clang++-3.7 + cxxstd: "03,11,14" + os: ubuntu-16.04 + install: clang-3.7 + - toolset: clang + compiler: clang++-3.8 + cxxstd: "03,11,14" + os: ubuntu-16.04 + install: clang-3.8 + - toolset: clang + compiler: clang++-3.9 + cxxstd: "03,11,14" + os: ubuntu-16.04 + install: clang-3.9 + - toolset: clang + compiler: clang++-4.0 + cxxstd: "03,11,14" + os: ubuntu-16.04 + install: clang-4.0 + - toolset: clang + compiler: clang++-5.0 + cxxstd: "03,11,14,1z" + os: ubuntu-16.04 + install: clang-5.0 + - toolset: clang + compiler: clang++-6.0 + cxxstd: "03,11,14,17" + os: ubuntu-18.04 + - toolset: clang + compiler: clang++-7 + cxxstd: "03,11,14,17" + os: ubuntu-18.04 + install: clang-7 + - toolset: clang + compiler: clang++-8 + cxxstd: "03,11,14,17,2a" + os: ubuntu-20.04 + - toolset: clang + compiler: clang++-9 + cxxstd: "03,11,14,17,2a" + os: ubuntu-20.04 + - toolset: clang + compiler: clang++-10 + cxxstd: "03,11,14,17,2a" + os: ubuntu-20.04 + - toolset: clang + cxxstd: "03,11,14,17,2a" + os: macos-10.15 + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v2 + + - name: Install packages + if: matrix.install + run: sudo apt install ${{matrix.install}} + + - name: Setup Boost + run: | + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + cd .. + git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + cp -r $GITHUB_WORKSPACE/* libs/exception + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" exception + ./bootstrap.sh + ./b2 -d0 headers + + - name: Create user-config.jam + if: matrix.compiler + run: | + echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam + + - name: Run tests + run: | + cd ../boost-root + ./b2 -j3 libs/exception/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release exception-handling=on,off rtti=on,off + + windows: + strategy: + fail-fast: false + matrix: + include: + - toolset: msvc-14.1 + cxxstd: "14,17,latest" + addrmd: 32,64 + os: windows-2016 + - toolset: msvc-14.2 + cxxstd: "14,17,latest" + addrmd: 32,64 + os: windows-2019 + - toolset: gcc + cxxstd: "03,11,14,17,2a" + addrmd: 64 + os: windows-2019 + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v2 + + - name: Setup Boost + shell: cmd + run: | + if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% + set BOOST_BRANCH=develop + if "%GITHUB_BASE_REF%" == "master" set BOOST_BRANCH=master + cd .. + git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root + cd boost-root + xcopy /s /e /q %GITHUB_WORKSPACE% libs\exception\ + git submodule update --init tools/boostdep + python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" exception + cmd /c bootstrap + b2 -d0 headers + + - name: Run tests + shell: cmd + run: | + cd ../boost-root + b2 -j3 libs/exception/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release exception-handling=on,off rtti=on,off diff --git a/.gitignore b/.gitignore index 99363e4..cbe87fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.vscode/ipch/* /.vscode/settings.json +.DS_Store diff --git a/include/boost/exception/detail/exception_ptr.hpp b/include/boost/exception/detail/exception_ptr.hpp index 91fb0dc..40c7108 100644 --- a/include/boost/exception/detail/exception_ptr.hpp +++ b/include/boost/exception/detail/exception_ptr.hpp @@ -8,13 +8,12 @@ #define BOOST_EXCEPTION_618474C2DE1511DEB74A388C56D89593 #include -#ifdef BOOST_NO_EXCEPTIONS -#error This header requires exception handling to be enabled. -#endif #include #include #include -#include +#ifndef BOOST_NO_EXCEPTIONS +# include +#endif #include #ifndef BOOST_NO_RTTI #include @@ -42,15 +41,14 @@ namespace boost { class exception_ptr; - BOOST_NORETURN void rethrow_exception( exception_ptr const & ); - exception_ptr current_exception(); + namespace exception_detail { void rethrow_exception_( exception_ptr const & ); } class exception_ptr { typedef boost::shared_ptr impl; impl ptr_; - friend void rethrow_exception( exception_ptr const & ); + friend void exception_detail::rethrow_exception_( exception_ptr const & ); typedef exception_detail::clone_base const * (impl::*unspecified_bool_type)() const; public: exception_ptr() @@ -106,6 +104,7 @@ boost } #endif +#ifndef BOOST_NO_EXCEPTIONS namespace exception_detail { @@ -499,34 +498,46 @@ boost BOOST_ASSERT(ret); return ret; } +#endif // ifndef BOOST_NO_EXCEPTIONS + + namespace + exception_detail + { + inline + void + rethrow_exception_( exception_ptr const & p ) + { + BOOST_ASSERT(p); +#if defined( BOOST_NO_CXX11_HDR_EXCEPTION ) || defined( BOOST_NO_EXCEPTIONS ) + p.ptr_->rethrow(); +#else + try + { + p.ptr_->rethrow(); + } + catch( + std_exception_ptr_wrapper const & wrp) + { + // if an std::exception_ptr was wrapped above then rethrow it + std::rethrow_exception(wrp.p); + } +#endif + } + } BOOST_NORETURN inline void rethrow_exception( exception_ptr const & p ) { - BOOST_ASSERT(p); -#ifndef BOOST_NO_CXX11_HDR_EXCEPTION - try - { - p.ptr_->rethrow(); - } - catch( - exception_detail::std_exception_ptr_wrapper const & wrp) - { - // if an std::exception_ptr was wrapped above then rethrow it - std::rethrow_exception(wrp.p); - } -#else - p.ptr_->rethrow(); -#endif + exception_detail::rethrow_exception_(p); BOOST_ASSERT(0); - #if defined(UNDER_CE) - // some CE platforms don't define ::abort() - exit(-1); - #else - abort(); - #endif +#if defined(UNDER_CE) + // some CE platforms don't define ::abort() + exit(-1); +#else + abort(); +#endif } inline @@ -534,6 +545,9 @@ boost diagnostic_information( exception_ptr const & p, bool verbose=true ) { if( p ) +#ifdef BOOST_NO_EXCEPTIONS + return " due to BOOST_NO_EXCEPTIONS"; +#else try { rethrow_exception(p); @@ -543,6 +557,7 @@ boost { return current_exception_diagnostic_information(verbose); } +#endif return ""; } diff --git a/test/1-throw_exception_test.cpp b/test/1-throw_exception_test.cpp index 5106e86..349f731 100644 --- a/test/1-throw_exception_test.cpp +++ b/test/1-throw_exception_test.cpp @@ -3,11 +3,15 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include -#include - class my_exception: public std::exception { }; int diff --git a/test/2-throw_exception_no_exceptions_test.cpp b/test/2-throw_exception_no_exceptions_test.cpp index 5d70ca1..652b3be 100644 --- a/test/2-throw_exception_no_exceptions_test.cpp +++ b/test/2-throw_exception_no_exceptions_test.cpp @@ -3,7 +3,12 @@ //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) -#define BOOST_NO_EXCEPTIONS +#include + +#if !defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling disabled. +#endif + #include #include diff --git a/test/3-throw_exception_no_integration_test.cpp b/test/3-throw_exception_no_integration_test.cpp index 6fa78f5..b402927 100644 --- a/test/3-throw_exception_no_integration_test.cpp +++ b/test/3-throw_exception_no_integration_test.cpp @@ -4,6 +4,13 @@ //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #define BOOST_EXCEPTION_DISABLE + +#include + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include diff --git a/test/4-throw_exception_no_both_test.cpp b/test/4-throw_exception_no_both_test.cpp index 93708e8..a8c5b4a 100644 --- a/test/4-throw_exception_no_both_test.cpp +++ b/test/4-throw_exception_no_both_test.cpp @@ -3,8 +3,14 @@ //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) -#define BOOST_NO_EXCEPTIONS #define BOOST_EXCEPTION_DISABLE + +#include + +#if !defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling disabled. +#endif + #include #include diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 2b4cad8..5ca7c2e 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -10,7 +10,6 @@ import testing ; project : requirements static - on ; #to_string @@ -23,29 +22,30 @@ compile-fail to_string_fail.cpp ; #exception -run 1-throw_exception_test.cpp ; -run 2-throw_exception_no_exceptions_test.cpp ; -run 3-throw_exception_no_integration_test.cpp ; -run 4-throw_exception_no_both_test.cpp ; -run cloning_test.cpp ; -run copy_exception_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : multi ; -run unknown_exception_test.cpp ; -run exception_test.cpp ; -run enable_error_info_test.cpp helper1.cpp ; -run throw_exception_test.cpp helper2.cpp ; -run errno_test.cpp ; -run error_info_basic_test.cpp ; -run error_info_lv_test.cpp ; -run error_info_lv_const_test.cpp ; -run error_info_rv_test.cpp ; -run error_info_rv_const_test.cpp ; -run diagnostic_information_test.cpp ; +run 1-throw_exception_test.cpp : : : on ; +run 2-throw_exception_no_exceptions_test.cpp : : : off ; +run 3-throw_exception_no_integration_test.cpp : : : on ; +run 4-throw_exception_no_both_test.cpp : : : off ; +run cloning_test.cpp : : : on ; +run copy_exception_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : multi on ; +run copy_exception_no_exceptions_test.cpp : : : off on ; +run unknown_exception_test.cpp : : : on ; +run exception_test.cpp : : : on ; +run enable_error_info_test.cpp helper1.cpp : : : on ; +run throw_exception_test.cpp helper2.cpp : : : on ; +run errno_test.cpp : : : on ; +run error_info_basic_test.cpp : : : on ; +run error_info_lv_test.cpp : : : on ; +run error_info_lv_const_test.cpp : : : on ; +run error_info_rv_test.cpp : : : on ; +run error_info_rv_const_test.cpp : : : on ; +run diagnostic_information_test.cpp : : : on ; run refcount_ptr_test.cpp ; -run current_exception_cast_test.cpp ; +run current_exception_cast_test.cpp : : : on ; run no_exceptions_test.cpp : : : off ; -run errinfos_test.cpp ; -run exception_ptr_test.cpp/BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR ../../thread/src/tss_null.cpp /boost/exception /boost//thread : : : multi : non_intrusive_exception_ptr_test ; -run exception_ptr_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : multi ; +run errinfos_test.cpp : : : on ; +run exception_ptr_test.cpp/BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR ../../thread/src/tss_null.cpp /boost/exception /boost//thread : : : multi on : non_intrusive_exception_ptr_test ; +run exception_ptr_test.cpp ../../thread/src/tss_null.cpp /boost//thread : : : multi on ; compile-fail exception_fail.cpp ; compile-fail throw_exception_fail.cpp ; @@ -71,5 +71,3 @@ compile errinfo_file_name_hpp_test.cpp ; compile errinfo_file_open_mode_hpp_test.cpp ; compile errinfo_nested_exception_hpp_test.cpp ; compile errinfo_type_info_name_hpp_test.cpp ; - -compile bug_11874_test.cpp ; diff --git a/test/bug_11874_test.cpp b/test/bug_11874_test.cpp deleted file mode 100644 index 3d8fd4a..0000000 --- a/test/bug_11874_test.cpp +++ /dev/null @@ -1,10 +0,0 @@ -//Copyright (c) 2006-2017 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) - -#include - -int main() -{ -} diff --git a/test/cloning_test.cpp b/test/cloning_test.cpp index 154751b..527fd8b 100644 --- a/test/cloning_test.cpp +++ b/test/cloning_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include @@ -423,7 +429,9 @@ main() test_std_exception_what(); test_std_exception_what(); test_std_exception_what(); +#if !defined(_GLIBCXX_USE_CXX11_ABI) || !_GLIBCXX_USE_CXX11_ABI test_std_exception_what(); +#endif test_std_exception_what(); test_std_exception(); #ifndef BOOST_NO_TYPEID diff --git a/test/copy_exception_no_exceptions_test.cpp b/test/copy_exception_no_exceptions_test.cpp new file mode 100644 index 0000000..9cac12c --- /dev/null +++ b/test/copy_exception_no_exceptions_test.cpp @@ -0,0 +1,93 @@ +//Copyright (c) 2006-2009 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) + +#define BOOST_NORETURN +#include + +#if !defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling disabled. +#endif + +#include +#include +#include + +typedef boost::error_info answer; + +int exc_count; + +struct +err: + virtual boost::exception, + virtual std::exception + { + err() + { + ++exc_count; + } + + err( err const & ) + { + ++exc_count; + } + + virtual + ~err() BOOST_NOEXCEPT_OR_NOTHROW + { + --exc_count; + } + + private: + + err & operator=( err const & ); + }; + + +namespace + { + bool throw_exception_called; + } + +// It is not valid to return to the caller but we do for testing purposes. +namespace +boost + { + void + throw_exception( std::exception const & e ) + { + throw_exception_called = true; + BOOST_TEST(dynamic_cast(&e)!=0); + int const * ans=boost::get_error_info(e); + BOOST_TEST(ans && *ans==42); + } + + struct source_location; + void + throw_exception( std::exception const & e, boost::source_location const & ) + { + throw_exception_called = true; + BOOST_TEST(dynamic_cast(&e)!=0); + int const * ans=boost::get_error_info(e); + BOOST_TEST(ans && *ans==42); + } + } + +void +simple_test() + { + boost::exception_ptr p = boost::copy_exception(err() << answer(42)); + throw_exception_called = false; + boost::exception_detail::rethrow_exception_(p); + BOOST_TEST(throw_exception_called); + } + +int +main() + { + BOOST_TEST(++exc_count==1); + simple_test(); + BOOST_TEST(!--exc_count); + return boost::report_errors(); + } diff --git a/test/copy_exception_test.cpp b/test/copy_exception_test.cpp index 649ade2..0fb2197 100644 --- a/test/copy_exception_test.cpp +++ b/test/copy_exception_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include @@ -11,6 +17,8 @@ typedef boost::error_info answer; +int const thread_count = 100; + boost::detail::atomic_count exc_count(0); struct @@ -39,20 +47,21 @@ err: err & operator=( err const & ); }; + class future { public: - future (): - ready_ (false) + future(): + ready_(false) { } void set_exception( boost::exception_ptr const & e ) { - boost::unique_lock lck (mux_); + boost::unique_lock lck(mux_); exc_ = e; ready_ = true; cond_.notify_all(); @@ -61,10 +70,10 @@ future void get_exception() const { - boost::unique_lock lck (mux_); - while (! ready_) - cond_.wait (lck); - rethrow_exception (exc_); + boost::unique_lock lck(mux_); + while( !ready_ ) + cond_.wait(lck); + rethrow_exception(exc_); } private: @@ -78,17 +87,17 @@ future void producer( future & f ) { - f.set_exception (boost::copy_exception (err () << answer(42))); + f.set_exception(boost::copy_exception(err() << answer(42))); } void consumer() { future f; - boost::thread thr (boost::bind (&producer, boost::ref (f))); + boost::thread thr(boost::bind(&producer, boost::ref(f))); try { - f.get_exception (); + f.get_exception(); } catch( err & e ) @@ -102,7 +111,7 @@ consumer() void consume() { - for( int i=0; i!=100; ++i ) + for( int i=0; i!=thread_count; ++i ) consumer(); } @@ -110,15 +119,15 @@ void thread_test() { boost::thread_group grp; - for( int i=0; i!=100; ++i ) + for( int i=0; i!=thread_count; ++i ) grp.create_thread(&consume); - grp.join_all (); + grp.join_all(); } void simple_test() { - boost::exception_ptr p = boost::copy_exception(err()); + boost::exception_ptr p = boost::copy_exception(err() << answer(42)); try { rethrow_exception(p); diff --git a/test/current_exception_cast_test.cpp b/test/current_exception_cast_test.cpp index 1f2e6b3..34d10b7 100644 --- a/test/current_exception_cast_test.cpp +++ b/test/current_exception_cast_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include diff --git a/test/diagnostic_information_test.cpp b/test/diagnostic_information_test.cpp index 74d8cd1..1047129 100644 --- a/test/diagnostic_information_test.cpp +++ b/test/diagnostic_information_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include diff --git a/test/enable_error_info_test.cpp b/test/enable_error_info_test.cpp index 351c5f8..468bc06 100644 --- a/test/enable_error_info_test.cpp +++ b/test/enable_error_info_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include "helper1.hpp" #include #include diff --git a/test/errinfos_test.cpp b/test/errinfos_test.cpp index bf3ad5f..9e7aedc 100644 --- a/test/errinfos_test.cpp +++ b/test/errinfos_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include diff --git a/test/errno_test.cpp b/test/errno_test.cpp index 9324d6b..985c566 100644 --- a/test/errno_test.cpp +++ b/test/errno_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include diff --git a/test/error_info_basic_test.cpp b/test/error_info_basic_test.cpp index 488360d..6868200 100644 --- a/test/error_info_basic_test.cpp +++ b/test/error_info_basic_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include diff --git a/test/error_info_test.hpp b/test/error_info_test.hpp index 8648362..6ee2436 100644 --- a/test/error_info_test.hpp +++ b/test/error_info_test.hpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include @@ -146,7 +152,7 @@ throw_catch_add_file_name( char const * name ) { add_info(x,test_5(std::string(name))); throw; - } + } } void diff --git a/test/exception_ptr_test.cpp b/test/exception_ptr_test.cpp index ebcb1d5..3324092 100644 --- a/test/exception_ptr_test.cpp +++ b/test/exception_ptr_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include diff --git a/test/exception_test.cpp b/test/exception_test.cpp index cc6537a..c2df146 100644 --- a/test/exception_test.cpp +++ b/test/exception_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include diff --git a/test/helper1.cpp b/test/helper1.cpp index f25f49f..4abed3e 100644 --- a/test/helper1.cpp +++ b/test/helper1.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include diff --git a/test/helper2.cpp b/test/helper2.cpp index 88809a7..19488af 100644 --- a/test/helper2.cpp +++ b/test/helper2.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include "helper2.hpp" #include diff --git a/test/no_exceptions_test.cpp b/test/no_exceptions_test.cpp index 1e85736..3379ea9 100644 --- a/test/no_exceptions_test.cpp +++ b/test/no_exceptions_test.cpp @@ -3,8 +3,12 @@ //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) -#define BOOST_NO_EXCEPTIONS #include + +#if !defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling disabled. +#endif + #include #include #include diff --git a/test/throw_exception_test.cpp b/test/throw_exception_test.cpp index c6c0eeb..4b99252 100644 --- a/test/throw_exception_test.cpp +++ b/test/throw_exception_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include "helper2.hpp" #include #include @@ -40,7 +46,7 @@ boost_throw_exception_test() int const * line=boost::get_error_info(x); BOOST_TEST( file && *file ); BOOST_TEST( function && *function ); - BOOST_TEST( line && *line==32 ); + BOOST_TEST( line && *line==38 ); } catch( ... ) @@ -61,7 +67,7 @@ boost_throw_exception_test() int const * data=boost::get_error_info(x); BOOST_TEST( file && *file ); BOOST_TEST( function && *function ); - BOOST_TEST( line && *line==52 ); + BOOST_TEST( line && *line==58 ); BOOST_TEST( data && *data==42 ); } catch( diff --git a/test/unknown_exception_test.cpp b/test/unknown_exception_test.cpp index 749052f..bab27c4 100644 --- a/test/unknown_exception_test.cpp +++ b/test/unknown_exception_test.cpp @@ -3,6 +3,12 @@ //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 + +#if defined( BOOST_NO_EXCEPTIONS ) +# error This program requires exception handling. +#endif + #include #include #include