Compare commits

...

50 Commits

Author SHA1 Message Date
0287751675 Make location member of wrapexcept_location non-const, to enable assignment 2022-01-26 17:22:42 +02:00
0bfe1d9261 Remove wrapexcept::location() 2022-01-26 07:17:51 +02:00
6624c33710 Add throw_exception_test6.cpp 2022-01-26 07:11:12 +02:00
7d804d72b8 Move wrapexcept's source location to a non-polymorphic, detail base class; add boost::get_throw_location 2022-01-26 07:10:38 +02:00
f1419ae6de Update throw_from_library_test.cpp 2022-01-26 06:20:27 +02:00
bba0872af3 Update throw_exception_test4.cpp 2022-01-26 06:11:44 +02:00
e13250de6e Update throw_exception_test3.cpp 2022-01-26 06:04:14 +02:00
9304126070 Update throw_exception_test2.cpp 2022-01-26 06:01:58 +02:00
cbff90bdee Rename has_source_location to has_throw_location 2022-01-26 04:09:31 +02:00
5dc7cafd9f Update throw_exception_test4.cpp to not terminate 2022-01-26 03:38:15 +02:00
e1fd6bb1f8 Update wrapexcept to not include boost::exception or clone_base under C++11 2022-01-25 22:04:40 +02:00
8c7b14f68b Update categories in libraries.json 2021-11-07 20:33:59 +02:00
37ad7254d2 Enable syntax hightlighting 2021-10-28 23:18:32 +03:00
f6055628e6 Add msvc-14.3 to ci.yml 2021-10-28 23:18:06 +03:00
65eddbb2f0 Small fix for those using -Wsign-conversion (#21)
* Small fix for those using -Wsign-conversion

* Change I to std::size_t in wrapexcept_add_base

A better fix for -Wsign-conversion
2021-10-11 21:07:06 +03:00
121c1407fd Merge branch 'develop' into feature/bx-rethrow-nx 2021-09-30 22:19:18 +03:00
5eff93e41b Update ci.yml 2021-09-30 22:00:09 +03:00
8787d13e65 Update ci.yml 2021-09-30 21:36:58 +03:00
0a922307ec Update ci.yml 2021-09-30 21:34:37 +03:00
9ca27bddfc Make clone_impl::rethrow use boost::throw_exception when exceptions are disabled 2021-09-30 21:24:13 +03:00
1d555aff4b Fix throw_exception_nx_test2 2021-09-30 21:16:03 +03:00
b432f24664 Update make_exception_ptr_nx tests to use boost::make_exception_ptr 2021-09-30 20:49:40 +03:00
9f6a2e7b89 Disable warning 4530 2021-09-30 20:46:02 +03:00
95e02ea52b Update .github/workflows 2021-04-19 21:30:04 +03:00
834a4f04dc Update .github/workflows 2021-04-19 20:32:32 +03:00
ad30f163ef Add -DBUILD_TESTING=ON to .yml files; it's not default anymore 2021-03-19 04:21:23 +02:00
b1f6a8b25f Fix .travis.yml 2021-03-18 16:22:56 +02:00
264ee74b64 Update .travis.yml 2021-03-18 02:34:31 +02:00
5b675bbc9c Merge pull request #19 from eldiener/develop
[skip ci] Add "cxxstd" json field
2021-01-21 23:51:17 +02:00
9c0a5b810b [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. 2021-01-21 16:23:18 -05:00
5e6223c838 Update ci.yml 2020-12-23 07:09:18 +02:00
f3b43b5679 Define boost::wrapexcept when BOOST_NO_EXCEPTIONS is defined, to enable boost::make_exception_ptr 2020-12-20 02:03:11 +02:00
397bc3d675 Merge branch 'fix-wrapexcept' of https://github.com/palebedev/throw_exception into feature/pr-18 2020-12-19 15:00:54 +02:00
6360fb6f36 Add make_exception_ptr_test2 2020-12-19 15:00:18 +02:00
bd5f6a255f Add make_exception_ptr_test 2020-12-19 14:58:04 +02:00
9f37f214ed Add .github/workflows 2020-12-19 14:13:33 +02:00
3144a406d4 Define boost::wrapexcept even when BOOST_EXCEPTION_DISABLE is defined.
Since Boost.Exception started using boost::wrapexcept in implementation
of boost::exception_ptr, we need to define it even when
BOOST_EXCEPTION_DISABLE is defined, otherwise it won't compile:

$ clang++ -DBOOST_EXCEPTION_DISABLE -w -x c++ \
  /usr/include/boost/exception_ptr.hpp -fsyntax-only
In file included from /usr/include/boost/exception_ptr.hpp:9:
/usr/include/boost/exception/detail/exception_ptr.hpp:87:49: error: use of
undeclared identifier 'wrapexcept'
        return exception_ptr(boost::make_shared<wrapexcept<E> >(cp));
                                                ^
1 error generated.
2020-12-18 01:45:19 +03:00
3d08795778 Update maintainer e-mail 2020-12-12 01:06:36 +02:00
e0e262cc01 Update appveyor.yml 2020-11-14 21:40:29 +02:00
da6f5420fe Remove manual boost_install call from CMakeLists.txt 2020-06-14 19:19:43 +03:00
924eb33335 Merge pull request #16 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74
2020-05-06 16:35:30 +03:00
37f7c5fd30 Add BOOST_OVERRIDE to clone() and rethrow() 2020-04-14 00:41:54 +03:00
a9ea585926 Merge branch 'develop' of https://github.com/eldiener/throw_exception into cppbuilder 2020-04-08 12:53:23 -04:00
548084bd4c Added #pragma clang system_header 2020-04-06 18:15:35 -07:00
237c7a35d6 Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-23 14:35:01 -04:00
3cd085a324 Rename 'release history' to 'revision history' 2020-01-21 03:25:16 +02:00
50a43b9512 Use BOOST_INCLUDE_LIBRARIES=throw_exception in the CMake install test 2020-01-21 00:39:57 +02:00
e452a9ee16 Update .travis.yml 2020-01-09 16:06:37 +02:00
86e09cc261 Use Trusty for clang-3.5 2020-01-02 04:49:08 +02:00
914d5a2ad3 Update Travis to Xenial 2020-01-02 00:18:05 +02:00
26 changed files with 778 additions and 150 deletions

198
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,198 @@
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.8
cxxstd: "03,11"
os: ubuntu-18.04
install: g++-4.8
- toolset: gcc-5
cxxstd: "03,11,14,1z"
os: ubuntu-18.04
install: g++-5
- toolset: gcc-6
cxxstd: "03,11,14,1z"
os: ubuntu-18.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
install: g++-8
- toolset: gcc-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
- toolset: gcc-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: g++-10
- toolset: gcc-11
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: g++-11
- toolset: clang
compiler: clang++-3.9
cxxstd: "03,11,14"
os: ubuntu-18.04
install: clang-3.9
- toolset: clang
compiler: clang++-4.0
cxxstd: "03,11,14"
os: ubuntu-18.04
install: clang-4.0
- toolset: clang
compiler: clang++-5.0
cxxstd: "03,11,14,1z"
os: ubuntu-18.04
install: clang-5.0
- toolset: clang
compiler: clang++-6.0
cxxstd: "03,11,14,17"
os: ubuntu-18.04
install: clang-6.0
- 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"
os: ubuntu-20.04
install: clang-8
- toolset: clang
compiler: clang++-9
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-9
- toolset: clang
compiler: clang++-10
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-10
- toolset: clang
compiler: clang++-11
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-11
- toolset: clang
compiler: clang++-12
cxxstd: "03,11,14,17,2a"
os: ubuntu-20.04
install: clang-12
- 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: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/}
echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH
cd ..
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
./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/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release
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: msvc-14.3
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2022
- 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: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
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\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
- name: Run tests
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release

View File

@ -4,11 +4,7 @@
language: cpp
sudo: false
dist: trusty
python: "2.7"
dist: xenial
branches:
only:
@ -26,10 +22,6 @@ matrix:
- env: BOGUS_JOB=true
include:
- os: linux
compiler: g++
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
- os: linux
compiler: g++-4.4
env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
@ -131,20 +123,18 @@ matrix:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-8
env: UBSAN=1 TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
dist: bionic
compiler: g++-10
env: UBSAN=1 TOOLSET=gcc COMPILER=g++-10 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
addons:
apt:
packages:
- g++-8
- g++-10
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
- os: linux
dist: trusty
compiler: /usr/bin/clang++
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
addons:
@ -153,6 +143,7 @@ matrix:
- clang-3.3
- os: linux
dist: trusty
compiler: /usr/bin/clang++
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
addons:
@ -161,13 +152,13 @@ matrix:
- clang-3.4
- os: linux
dist: trusty
compiler: clang++-3.5
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.5
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
@ -178,7 +169,16 @@ matrix:
apt:
packages:
- clang-3.6
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++-3.7
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-3.7
sources:
- ubuntu-toolchain-r-test
@ -189,7 +189,6 @@ matrix:
apt:
packages:
- clang-3.8
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
@ -200,7 +199,6 @@ matrix:
apt:
packages:
- clang-3.9
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
@ -211,24 +209,22 @@ matrix:
apt:
packages:
- clang-4.0
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-4.0
- os: linux
dist: bionic
compiler: clang++-5.0
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- clang-5.0
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
- os: linux
dist: bionic
compiler: clang++-6.0
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17
addons:
@ -237,9 +233,9 @@ matrix:
- clang-6.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- os: linux
dist: bionic
compiler: clang++-7
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a
addons:
@ -248,9 +244,10 @@ matrix:
- clang-7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-7
- llvm-toolchain-bionic-7
- os: linux
dist: bionic
compiler: clang++-8
env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a
addons:
@ -259,10 +256,10 @@ matrix:
- clang-8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-8
- llvm-toolchain-bionic-8
- os: linux
dist: xenial
dist: bionic
compiler: clang++-9
env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a
addons:
@ -271,29 +268,50 @@ matrix:
- clang-9
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
- sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-9 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- os: linux
compiler: clang++-6.0
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17 UBSAN_OPTIONS=print_stacktrace=1
dist: bionic
compiler: clang++-10
env: TOOLSET=clang COMPILER=clang++-10 CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- clang-6.0
- clang-10
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- os: linux
compiler: clang++-libc++
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
dist: bionic
compiler: clang++-11
env: TOOLSET=clang COMPILER=clang++-11 CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- libc++-dev
- clang-11
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- os: linux
dist: bionic
compiler: clang++-12
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-12 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1
addons:
apt:
packages:
- clang-12
sources:
- ubuntu-toolchain-r-test
- sourceline: 'deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main'
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
- os: linux
dist: trusty
compiler: clang++-libc++
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
addons:
@ -301,15 +319,24 @@ matrix:
packages:
- libc++-dev
- os: linux
dist: bionic
compiler: clang++-libc++
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,17,2a
addons:
apt:
packages:
- libc++-dev
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
env: UBSAN=1 TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
- os: linux
env: CMAKE=1
script:
- mkdir __build__ && cd __build__
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_DEBUG=1 ..
- cmake -DBOOST_ENABLE_CMAKE=1 -DBUILD_TESTING=ON -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=throw_exception ..
- ctest --output-on-failure -R boost_throw_exception
- os: linux
@ -328,8 +355,9 @@ matrix:
- os: linux
env: CMAKE_INSTALL=1
script:
- pip install --user cmake
- mkdir __build__ && cd __build__
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_DEBUG=1 -DBOOST_INCLUDE_LIBRARIES="assert;config;throw_exception" -DCMAKE_INSTALL_PREFIX=~/.local ..
- cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=throw_exception -DCMAKE_INSTALL_PREFIX=~/.local ..
- cmake --build . --target install
- cd ../libs/throw_exception/test/cmake_install_test && mkdir __build__ && cd __build__
- cmake -DCMAKE_INSTALL_PREFIX=~/.local ..

View File

@ -16,13 +16,6 @@ target_link_libraries(boost_throw_exception
Boost::config
)
if(BOOST_SUPERPROJECT_VERSION)
include(BoostInstall)
boost_install(TARGETS boost_throw_exception HEADER_DIRECTORY include/)
endif()
if(BUILD_TESTING)
add_subdirectory(test)

View File

@ -15,17 +15,23 @@ branches:
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0,msvc-14.0
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0
ADDRMD: 32
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-12.0,msvc-14.0
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
CXXSTD: 14,17
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: clang-win
CXXSTD: 14,17
ADDRMD: 64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
TOOLSET: msvc-14.2
CXXSTD: 14,17
CXXSTD: 14,17,latest
ADDRMD: 32,64
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
ADDPATH: C:\cygwin\bin;
TOOLSET: gcc

View File

@ -5,15 +5,15 @@ http://www.boost.org/LICENSE_1_0.txt
////
[#changes]
# Release History
# Revision History
:toc:
:toc-title:
:idprefix:
## Changes in Boost 1.73.0
## Changes in 1.73.0
* Added an overload of `throw_exception` that takes a `boost::source_location`
object.
NOTE: Projects using `BOOST_THROW_EXCEPTION` with exceptions disabled will need
to add a definition of this new overload.

View File

@ -9,6 +9,8 @@ Peter Dimov, Emil Dotchevski
:toc: left
:idprefix:
:docinfo: private-footer
:source-highlighter: rouge
:source-language: c++
:leveloffset: +1

View File

@ -7,6 +7,7 @@
#define BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593
#include <boost/config.hpp>
#include <exception>
#ifdef BOOST_EXCEPTION_MINI_BOOST
#include <memory>
@ -16,13 +17,18 @@ namespace boost { template <class T> class shared_ptr; }
namespace boost { namespace exception_detail { using boost::shared_ptr; } }
#endif
#if defined(__GNUC__) && (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#if !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#if __GNUC__*100+__GNUC_MINOR__>301
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#ifdef __clang__
#pragma clang system_header
#endif
#ifdef _MSC_VER
#pragma warning(push,1)
#pragma warning(disable: 4265)
#endif
#endif
namespace
boost
@ -385,6 +391,9 @@ boost
}
////////////////////////////////////////////////////////////////////////
#if defined(BOOST_NO_EXCEPTIONS)
BOOST_NORETURN void throw_exception(std::exception const & e); // user defined
#endif
namespace
exception_detail
@ -461,7 +470,11 @@ boost
void
rethrow() const
{
#if defined(BOOST_NO_EXCEPTIONS)
boost::throw_exception(*this);
#else
throw*this;
#endif
}
};
}

View File

@ -20,73 +20,39 @@
// http://www.boost.org/libs/throw_exception
//
#include <boost/exception/exception.hpp>
#include <boost/assert/source_location.hpp>
#include <boost/config.hpp>
#include <boost/config/workaround.hpp>
#include <exception>
#include <cstddef>
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) )
#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_BORLANDC ) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x593) )
# define BOOST_EXCEPTION_DISABLE
#endif
namespace boost
{
// All boost exceptions are required to derive from std::exception,
// to ensure compatibility with BOOST_NO_EXCEPTIONS.
inline void throw_exception_assert_compatibility( std::exception const & ) {}
} // namespace boost
#if defined( BOOST_NO_EXCEPTIONS )
namespace boost
{
BOOST_NORETURN void throw_exception( std::exception const & e ); // user defined
BOOST_NORETURN void throw_exception( std::exception const & e, boost::source_location const & loc ); // user defined
} // namespace boost
#elif defined( BOOST_EXCEPTION_DISABLE )
namespace boost
{
template<class E> BOOST_NORETURN void throw_exception( E const & e )
{
throw_exception_assert_compatibility( e );
throw e;
}
template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & )
{
throw_exception_assert_compatibility( e );
throw e;
}
} // namespace boost
#else // !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE )
#include <boost/exception/exception.hpp>
namespace boost
{
// boost::wrapexcept<E>
#endif
namespace detail
{
// wrapexcept_add_base
typedef char (&wrapexcept_s1)[ 1 ];
typedef char (&wrapexcept_s2)[ 2 ];
template<class T> wrapexcept_s1 wrapexcept_is_convertible( T* );
template<class T> wrapexcept_s2 wrapexcept_is_convertible( void* );
template<class E, class B, int I = sizeof( wrapexcept_is_convertible<B>( static_cast< E* >( 0 ) ) ) > struct wrapexcept_add_base;
template<class E, class B, std::size_t I = sizeof( wrapexcept_is_convertible<B>( static_cast< E* >( 0 ) ) ) > struct wrapexcept_add_base;
template<class E, class B> struct wrapexcept_add_base<E, B, 1>
{
@ -98,12 +64,37 @@ template<class E, class B> struct wrapexcept_add_base<E, B, 2>
typedef B type;
};
// wrapexcept_location
struct wrapexcept_location
{
wrapexcept_location() {}
explicit wrapexcept_location( boost::source_location const& loc ): location_( loc ) {}
boost::source_location location_;
};
} // namespace detail
template<class E> struct BOOST_SYMBOL_VISIBLE wrapexcept:
// wrapexcept<E>
#if !defined(BOOST_NO_CXX11_HDR_EXCEPTION)
template<class E, int cxxstd = 11> struct BOOST_SYMBOL_VISIBLE wrapexcept;
#else
template<class E, int cxxstd = 98> struct BOOST_SYMBOL_VISIBLE wrapexcept;
#endif
// C++98 version for backward compatibility
template<class E> struct BOOST_SYMBOL_VISIBLE wrapexcept<E, 98>:
public detail::wrapexcept_add_base<E, boost::exception_detail::clone_base>::type,
public E,
public detail::wrapexcept_add_base<E, boost::exception>::type
public detail::wrapexcept_add_base<E, boost::exception>::type,
public detail::wrapexcept_location
{
private:
@ -131,7 +122,7 @@ public:
copy_from( &e );
}
explicit wrapexcept( E const & e, boost::source_location const & loc ): E( e )
explicit wrapexcept( E const & e, boost::source_location const & loc ): E( e ), detail::wrapexcept_location( loc )
{
copy_from( &e );
@ -140,7 +131,7 @@ public:
set_info( *this, throw_function( loc.function_name() ) );
}
virtual boost::exception_detail::clone_base const * clone() const
virtual boost::exception_detail::clone_base const * clone() const BOOST_OVERRIDE
{
wrapexcept * p = new wrapexcept( *this );
deleter del = { p };
@ -151,30 +142,136 @@ public:
return p;
}
virtual void rethrow() const
virtual void rethrow() const BOOST_OVERRIDE
{
#if defined( BOOST_NO_EXCEPTIONS )
boost::throw_exception( *this );
#else
throw *this;
#endif
}
};
// C++11 version
template<class E> struct BOOST_SYMBOL_VISIBLE wrapexcept<E, 11>:
public E,
public detail::wrapexcept_location
{
private:
void copy_from( void const* )
{
}
void copy_from( boost::exception const* p )
{
static_cast<boost::exception&>( *this ) = *p;
}
template<class T> void set_info_impl( void*, T const& )
{
}
template<class T> void set_info_impl( boost::exception * p, T const& t )
{
exception_detail::set_info( *p, t );
}
public:
explicit wrapexcept( E const & e ): E( e )
{
copy_from( &e );
}
explicit wrapexcept( E const & e, boost::source_location const & loc ): E( e ), detail::wrapexcept_location( loc )
{
copy_from( &e );
set_info_impl( this, throw_file( loc.file_name() ) );
set_info_impl( this, throw_line( loc.line() ) );
set_info_impl( this, throw_function( loc.function_name() ) );
}
};
// All boost exceptions are required to derive from std::exception,
// to ensure compatibility with BOOST_NO_EXCEPTIONS.
inline void throw_exception_assert_compatibility( std::exception const & ) {}
// boost::throw_exception
#if !defined( BOOST_NO_EXCEPTIONS )
#if defined( BOOST_EXCEPTION_DISABLE )
template<class E> BOOST_NORETURN void throw_exception( E const & e )
{
throw_exception_assert_compatibility( e );
throw wrapexcept<E>( e );
throw e;
}
template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & )
{
throw_exception_assert_compatibility( e );
throw e;
}
#elif !defined(BOOST_NO_CXX11_HDR_EXCEPTION)
template<class E> BOOST_NORETURN void throw_exception( E const & e )
{
throw_exception_assert_compatibility( e );
throw e;
}
template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & loc )
{
throw_exception_assert_compatibility( e );
throw wrapexcept<E>( e, loc );
throw wrapexcept<E, 11>( e, loc );
}
#else // C++98
template<class E> BOOST_NORETURN void throw_exception( E const & e )
{
throw_exception_assert_compatibility( e );
throw wrapexcept<E, 98>( e );
}
template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & loc )
{
throw_exception_assert_compatibility( e );
throw wrapexcept<E, 98>( e, loc );
}
#endif // defined( BOOST_EXCEPTION_DISABLE )
#endif // !defined( BOOST_NO_EXCEPTIONS )
// get_throw_location
template<class E> boost::source_location get_throw_location( E const& e )
{
#if defined(BOOST_NO_RTTI)
return boost::source_location();
#else
detail::wrapexcept_location const* p = dynamic_cast< detail::wrapexcept_location const* >( &e );
return p? p->location_: boost::source_location();
#endif
}
} // namespace boost
#endif
// BOOST_THROW_EXCEPTION
#define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x, BOOST_CURRENT_LOCATION)

View File

@ -7,10 +7,12 @@
],
"maintainers": [
"Emil Dotchevski <emil -at- revergestudios.com>",
"Peter Dimov <pdimov -at- pdimov.com>"
"Peter Dimov <pdimov -at- gmail.com>"
],
"description": "A common infrastructure for throwing exceptions from Boost libraries.",
"category": [
"Miscellaneous"
]
"Emulation",
"Error-handling"
],
"cxxstd": "03"
}

View File

@ -27,13 +27,23 @@ run throw_exception_test2.cpp ;
run throw_exception_test3.cpp ;
run throw_exception_test4.cpp ;
run throw_exception_test5.cpp ;
run throw_exception_test6.cpp ;
lib lib1_throw : lib1_throw.cpp : <define>LIB1_SOURCE=1 <link>shared:<define>LIB1_DYN_LINK=1 : : <link>shared:<define>LIB1_DYN_LINK=1 ;
lib lib2_throw : lib2_throw.cpp : <define>LIB2_SOURCE=1 <link>shared:<define>LIB2_DYN_LINK=1 : : <link>shared:<define>LIB2_DYN_LINK=1 ;
lib lib3_throw : lib3_throw.cpp : <define>LIB3_SOURCE=1 <link>shared:<define>LIB3_DYN_LINK=1 : : <link>shared:<define>LIB3_DYN_LINK=1 ;
lib lib4_throw : lib4_throw.cpp : <define>LIB4_SOURCE=1 <link>shared:<define>LIB4_DYN_LINK=1 : : <link>shared:<define>LIB4_DYN_LINK=1 ;
lib lib5_throw : lib5_throw.cpp : <define>LIB5_SOURCE=1 <link>shared:<define>LIB5_DYN_LINK=1 : : <link>shared:<define>LIB5_DYN_LINK=1 ;
run throw_from_library_test.cpp lib1_throw lib2_throw lib3_throw : : : <link>static : throw_from_library_static ;
run throw_from_library_test.cpp lib1_throw lib2_throw lib3_throw : : : <link>shared : throw_from_library_shared ;
run throw_from_library_test.cpp lib1_throw lib2_throw lib3_throw lib4_throw lib5_throw : : : <link>static : throw_from_library_static ;
run throw_from_library_test.cpp lib1_throw lib2_throw lib3_throw lib4_throw lib5_throw : : : <link>shared : throw_from_library_shared ;
run throw_exception_nx_test.cpp : : : <exception-handling>off ;
run throw_exception_nx_test2.cpp : : : <exception-handling>off ;
run throw_exception_nx_test3.cpp : : : <exception-handling>off ;
run make_exception_ptr_test.cpp ;
run make_exception_ptr_test2.cpp ;
run make_exception_ptr_nx_test.cpp : : : <exception-handling>off ;
run make_exception_ptr_nx_test2.cpp : : : <exception-handling>off ;

14
test/lib4_throw.cpp Normal file
View File

@ -0,0 +1,14 @@
// Copyright 2018 Peter Dimov
//
// 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 "lib4_throw.hpp"
#include <boost/throw_exception.hpp>
void lib4::f()
{
boost::throw_exception( lib4::exception() );
}

36
test/lib4_throw.hpp Normal file
View File

@ -0,0 +1,36 @@
#ifndef LIB4_THROW_HPP_INCLUDED
#define LIB4_THROW_HPP_INCLUDED
// Copyright 2018 Peter Dimov
//
// 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/exception.hpp>
#include <boost/config.hpp>
#include <exception>
#if defined(LIB4_DYN_LINK)
# if defined(LIB4_SOURCE)
# define LIB4_DECL BOOST_SYMBOL_EXPORT
# else
# define LIB4_DECL BOOST_SYMBOL_IMPORT
# endif
#else
# define LIB4_DECL
#endif
namespace lib4
{
struct BOOST_SYMBOL_VISIBLE exception: public std::exception, public boost::exception
{
};
LIB4_DECL void f();
} // namespace lib4
#endif // #ifndef LIB4_THROW_HPP_INCLUDED

14
test/lib5_throw.cpp Normal file
View File

@ -0,0 +1,14 @@
// Copyright 2018 Peter Dimov
//
// 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 "lib5_throw.hpp"
#include <boost/throw_exception.hpp>
void lib5::f()
{
BOOST_THROW_EXCEPTION( lib5::exception() );
}

36
test/lib5_throw.hpp Normal file
View File

@ -0,0 +1,36 @@
#ifndef LIB5_THROW_HPP_INCLUDED
#define LIB5_THROW_HPP_INCLUDED
// Copyright 2018 Peter Dimov
//
// 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/exception.hpp>
#include <boost/config.hpp>
#include <exception>
#if defined(LIB5_DYN_LINK)
# if defined(LIB5_SOURCE)
# define LIB5_DECL BOOST_SYMBOL_EXPORT
# else
# define LIB5_DECL BOOST_SYMBOL_IMPORT
# endif
#else
# define LIB5_DECL
#endif
namespace lib5
{
struct BOOST_SYMBOL_VISIBLE exception: public std::exception, public boost::exception
{
};
LIB5_DECL void f();
} // namespace lib5
#endif // #ifndef LIB5_THROW_HPP_INCLUDED

View File

@ -0,0 +1,29 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
# pragma warning(disable: 4577) // noexcept used without /EHsc
# pragma warning(disable: 4530) // C++ exception handler used
#endif
#include <boost/exception_ptr.hpp>
class my_exception: public std::exception {};
int main()
{
boost::make_exception_ptr( my_exception() );
}
namespace boost
{
// shared_ptr needs this
void throw_exception( std::exception const & )
{
std::exit( 1 );
}
} // namespace boost

View File

@ -0,0 +1,31 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
# pragma warning(disable: 4577) // noexcept used without /EHsc
# pragma warning(disable: 4530) // C++ exception handler used
#endif
#define BOOST_EXCEPTION_DISABLE
#include <boost/exception_ptr.hpp>
class my_exception: public std::exception {};
int main()
{
boost::make_exception_ptr( my_exception() );
}
namespace boost
{
// shared_ptr needs this
void throw_exception( std::exception const & )
{
std::exit( 1 );
}
} // namespace boost

View File

@ -0,0 +1,18 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
#endif
#include <boost/exception_ptr.hpp>
#include <boost/core/lightweight_test.hpp>
class my_exception: public std::exception {};
int main()
{
BOOST_TEST_THROWS( boost::rethrow_exception( boost::make_exception_ptr( my_exception() ) ), my_exception );
return boost::report_errors();
}

View File

@ -0,0 +1,20 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
#endif
#define BOOST_EXCEPTION_DISABLE
#include <boost/exception_ptr.hpp>
#include <boost/core/lightweight_test.hpp>
class my_exception: public std::exception {};
int main()
{
BOOST_TEST_THROWS( boost::rethrow_exception( boost::make_exception_ptr( my_exception() ) ), my_exception );
return boost::report_errors();
}

View File

@ -5,6 +5,7 @@
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
# pragma warning(disable: 4577) // noexcept used without /EHsc
# pragma warning(disable: 4530) // C++ exception handler used
#endif
#include <boost/throw_exception.hpp>

View File

@ -5,6 +5,7 @@
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
# pragma warning(disable: 4577) // noexcept used without /EHsc
# pragma warning(disable: 4530) // C++ exception handler used
#endif
#include <boost/throw_exception.hpp>
@ -27,7 +28,7 @@ void throw_exception( std::exception const &, boost::source_location const & loc
int r = 0;
if( std::strcmp( loc.file_name(), __FILE__ ) != 0 ) ++r;
if( loc.line() != 18 ) ++r;
if( loc.line() != 19 ) ++r;
std::exit( r );
}

View File

@ -0,0 +1,18 @@
// Copyright 2020 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
# pragma warning(disable: 4577) // noexcept used without /EHsc
# pragma warning(disable: 4530) // C++ exception handler used
#endif
// Make sure that simple inclusion does not
// require boost::throw_exception to be defined
#include <boost/throw_exception.hpp>
int main()
{
}

View File

@ -26,12 +26,20 @@ class my_exception3: public std::exception, public virtual boost::exception
int main()
{
BOOST_TEST_THROWS( boost::throw_exception( my_exception() ), boost::exception );
BOOST_TEST_THROWS( boost::throw_exception( my_exception() ), my_exception );
BOOST_TEST_THROWS( boost::throw_exception( my_exception2() ), my_exception2 );
BOOST_TEST_THROWS( boost::throw_exception( my_exception2() ), boost::exception );
BOOST_TEST_THROWS( boost::throw_exception( my_exception3() ), my_exception3 );
BOOST_TEST_THROWS( boost::throw_exception( my_exception3() ), boost::exception );
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception() ), boost::exception );
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception() ), my_exception );
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception2() ), my_exception2 );
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception2() ), boost::exception );
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception3() ), my_exception3 );
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception3() ), boost::exception );
return boost::report_errors();

View File

@ -44,7 +44,6 @@ int main()
boost::exception_ptr p = boost::current_exception();
BOOST_TEST_THROWS( boost::rethrow_exception( p ), my_exception );
BOOST_TEST_THROWS( boost::rethrow_exception( p ), boost::exception );
}
try
@ -80,7 +79,6 @@ int main()
boost::exception_ptr p = boost::current_exception();
BOOST_TEST_THROWS( boost::rethrow_exception( p ), my_exception );
BOOST_TEST_THROWS( boost::rethrow_exception( p ), boost::exception );
}
try

View File

@ -9,10 +9,6 @@
#include <boost/exception/get_error_info.hpp>
#include <boost/detail/lightweight_test.hpp>
class my_exception: public std::exception
{
};
class my_exception2: public std::exception, public boost::exception
{
};
@ -25,7 +21,7 @@ int main()
{
try
{
BOOST_THROW_EXCEPTION( my_exception() );
BOOST_THROW_EXCEPTION( my_exception2() );
}
catch( boost::exception const & x )
{
@ -40,7 +36,7 @@ int main()
int const * line = boost::get_error_info<boost::throw_line>( x );
BOOST_TEST( line != 0 );
BOOST_TEST_EQ( *line, 28 );
BOOST_TEST_EQ( *line, 24 );
}
{
@ -50,10 +46,14 @@ int main()
BOOST_TEST_CSTR_EQ( *function, BOOST_CURRENT_FUNCTION );
}
}
catch( ... )
{
BOOST_ERROR( "BOOST_THROW_EXCEPTION( my_exception2() ) didn't throw boost::exception" );
}
try
{
BOOST_THROW_EXCEPTION( my_exception2() );
BOOST_THROW_EXCEPTION( my_exception3() );
}
catch( boost::exception const & x )
{
@ -78,33 +78,9 @@ int main()
BOOST_TEST_CSTR_EQ( *function, BOOST_CURRENT_FUNCTION );
}
}
try
catch( ... )
{
BOOST_THROW_EXCEPTION( my_exception3() );
}
catch( boost::exception const & x )
{
{
char const * const * file = boost::get_error_info<boost::throw_file>( x );
BOOST_TEST( file != 0 );
BOOST_TEST_CSTR_EQ( *file, __FILE__ );
}
{
int const * line = boost::get_error_info<boost::throw_line>( x );
BOOST_TEST( line != 0 );
BOOST_TEST_EQ( *line, 84 );
}
{
char const * const * function = boost::get_error_info<boost::throw_function>( x );
BOOST_TEST( function != 0 );
BOOST_TEST_CSTR_EQ( *function, BOOST_CURRENT_FUNCTION );
}
BOOST_ERROR( "BOOST_THROW_EXCEPTION( my_exception3() ) didn't throw boost::exception" );
}
return boost::report_errors();

View File

@ -0,0 +1,53 @@
// Copyright 2018, 2022 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/throw_exception.hpp>
#include <boost/core/lightweight_test.hpp>
class my_exception: public std::exception
{
};
class my_exception2: public std::exception, public virtual boost::exception
{
};
int main()
{
try
{
BOOST_THROW_EXCEPTION( my_exception() );
}
catch( std::exception const & x )
{
boost::source_location loc = boost::get_throw_location( x );
BOOST_TEST_CSTR_EQ( loc.file_name(), __FILE__ );
BOOST_TEST_EQ( loc.line(), 20 );
BOOST_TEST_CSTR_EQ( loc.function_name(), BOOST_CURRENT_FUNCTION );
}
catch( ... )
{
BOOST_ERROR( "'BOOST_THROW_EXCEPTION( my_exception() )' didn't throw 'std::exception'" );
}
try
{
BOOST_THROW_EXCEPTION( my_exception2() );
}
catch( boost::exception const & x )
{
boost::source_location loc = boost::get_throw_location( x );
BOOST_TEST_CSTR_EQ( loc.file_name(), __FILE__ );
BOOST_TEST_EQ( loc.line(), 37 );
BOOST_TEST_CSTR_EQ( loc.function_name(), BOOST_CURRENT_FUNCTION );
}
catch( ... )
{
BOOST_ERROR( "'BOOST_THROW_EXCEPTION( my_exception2() )' didn't throw 'boost::exception'" );
}
return boost::report_errors();
}

View File

@ -20,6 +20,8 @@
#include "lib1_throw.hpp"
#include "lib2_throw.hpp"
#include "lib3_throw.hpp"
#include "lib4_throw.hpp"
#include "lib5_throw.hpp"
#include <boost/exception/exception.hpp>
#include <boost/exception_ptr.hpp>
#include <boost/exception/get_error_info.hpp>
@ -30,12 +32,14 @@ void test_catch_by_type()
BOOST_TEST_THROWS( lib1::f(), lib1::exception );
BOOST_TEST_THROWS( lib2::f(), lib2::exception );
BOOST_TEST_THROWS( lib3::f(), lib3::exception );
BOOST_TEST_THROWS( lib4::f(), lib4::exception );
BOOST_TEST_THROWS( lib5::f(), lib5::exception );
}
void test_catch_by_exception()
{
BOOST_TEST_THROWS( lib2::f(), boost::exception );
BOOST_TEST_THROWS( lib3::f(), boost::exception );
BOOST_TEST_THROWS( lib4::f(), boost::exception );
BOOST_TEST_THROWS( lib5::f(), boost::exception );
}
void test_exception_ptr()
@ -49,7 +53,6 @@ void test_exception_ptr()
boost::exception_ptr p = boost::current_exception();
BOOST_TEST_THROWS( boost::rethrow_exception( p ), lib2::exception );
BOOST_TEST_THROWS( boost::rethrow_exception( p ), boost::exception );
}
try
@ -61,6 +64,29 @@ void test_exception_ptr()
boost::exception_ptr p = boost::current_exception();
BOOST_TEST_THROWS( boost::rethrow_exception( p ), lib3::exception );
}
try
{
lib4::f();
}
catch( ... )
{
boost::exception_ptr p = boost::current_exception();
BOOST_TEST_THROWS( boost::rethrow_exception( p ), lib4::exception );
BOOST_TEST_THROWS( boost::rethrow_exception( p ), boost::exception );
}
try
{
lib5::f();
}
catch( ... )
{
boost::exception_ptr p = boost::current_exception();
BOOST_TEST_THROWS( boost::rethrow_exception( p ), lib5::exception );
BOOST_TEST_THROWS( boost::rethrow_exception( p ), boost::exception );
}
}
@ -69,7 +95,7 @@ void test_throw_line()
{
try
{
lib3::f();
lib5::f();
}
catch( boost::exception const & x )
{