forked from boostorg/throw_exception
Compare commits
44 Commits
exception_
...
boost-1.72
Author | SHA1 | Date | |
---|---|---|---|
43a57d518c | |||
e2e802e508 | |||
5143552817 | |||
1e507924ce | |||
50c34dee24 | |||
37dfb7fe92 | |||
9dfba607d9 | |||
074bc77efb | |||
9d5b953dcf | |||
eafb1c877b | |||
dd7d2a273c | |||
9b99dd5f60 | |||
322d7611af | |||
56dd1c4111 | |||
a732dfad3c | |||
6845ba892d | |||
a17f4bad42 | |||
c807ae9201 | |||
fe0f62bf17 | |||
4714760035 | |||
72564448cf | |||
7e2f1b4ecd | |||
9d43946812 | |||
ca46976908 | |||
2fdcaa3be1 | |||
3fba666bea | |||
376fc078b5 | |||
614cbc4f34 | |||
ee45839a78 | |||
e3b556a978 | |||
8b879067f7 | |||
40e067d7b7 | |||
940df3e051 | |||
4fd6f2aa0e | |||
aec4ca6914 | |||
10f3663798 | |||
f796dd892a | |||
f5022b5ca8 | |||
a0ca8113fd | |||
cce19ef60f | |||
c548923b32 | |||
fc1ca8aef6 | |||
c89a2db112 | |||
f52e2fe315 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/.vscode/ipch/*
|
292
.travis.yml
Normal file
292
.travis.yml
Normal file
@ -0,0 +1,292 @@
|
||||
# Copyright 2016-2018 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
language: cpp
|
||||
|
||||
sudo: false
|
||||
|
||||
dist: trusty
|
||||
|
||||
python: "2.7"
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
- /feature\/.*/
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- BOGUS_JOB=true
|
||||
|
||||
matrix:
|
||||
|
||||
exclude:
|
||||
- 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
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.4
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.6
|
||||
env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.7
|
||||
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.8
|
||||
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-4.9
|
||||
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-4.9
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-5
|
||||
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-5
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-6
|
||||
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-6
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-7
|
||||
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: g++-8
|
||||
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-8
|
||||
sources:
|
||||
- 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
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- g++-8
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
|
||||
|
||||
- os: linux
|
||||
compiler: /usr/bin/clang++
|
||||
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.3
|
||||
|
||||
- os: linux
|
||||
compiler: /usr/bin/clang++
|
||||
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.4
|
||||
|
||||
- os: linux
|
||||
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
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.6
|
||||
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.6
|
||||
- libstdc++-4.9-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.8
|
||||
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.8
|
||||
- libstdc++-4.9-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-3.9
|
||||
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-3.9
|
||||
- libstdc++-4.9-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-4.0
|
||||
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-4.0
|
||||
- libstdc++-4.9-dev
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-4.0
|
||||
|
||||
- os: linux
|
||||
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
|
||||
compiler: clang++-6.0
|
||||
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-6.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-6.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-7
|
||||
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-7
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
|
||||
- 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
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-6.0
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-6.0
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-libc++
|
||||
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libc++-dev
|
||||
|
||||
- os: linux
|
||||
compiler: clang++-libc++
|
||||
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z UBSAN_OPTIONS=print_stacktrace=1
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libc++-dev
|
||||
|
||||
- os: osx
|
||||
compiler: clang++
|
||||
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
|
||||
|
||||
install:
|
||||
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||
- cd ..
|
||||
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
- cd boost-root
|
||||
- git submodule update --init tools/boostdep
|
||||
- cp -r $TRAVIS_BUILD_DIR/* libs/throw_exception
|
||||
- python tools/boostdep/depinst/depinst.py throw_exception
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
|
||||
script:
|
||||
- |-
|
||||
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
|
||||
- ./b2 -j 3 libs/throw_exception/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${UBSAN:+cxxflags=-fsanitize=undefined cxxflags=-fno-sanitize-recover=undefined linkflags=-fsanitize=undefined define=UBSAN=1 debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: always
|
20
CMakeLists.txt
Normal file
20
CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright 2018 Mike Dev
|
||||
# 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
|
||||
|
||||
# Partial (add_subdirectory only) and experimental CMake support
|
||||
# Subject to change; please do not rely on the contents of this file yet
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(BoostThrowException LANGUAGES CXX)
|
||||
|
||||
add_library(boost_throw_exception INTERFACE)
|
||||
add_library(Boost::throw_exception ALIAS boost_throw_exception)
|
||||
|
||||
target_include_directories(boost_throw_exception INTERFACE include)
|
||||
|
||||
target_link_libraries(boost_throw_exception
|
||||
INTERFACE
|
||||
Boost::assert
|
||||
Boost::config
|
||||
)
|
56
appveyor.yml
Normal file
56
appveyor.yml
Normal file
@ -0,0 +1,56 @@
|
||||
# Copyright 2016-2019 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
|
||||
|
||||
version: 1.0.{build}-{branch}
|
||||
|
||||
shallow_clone: true
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
- /feature\/.*/
|
||||
|
||||
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
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
TOOLSET: msvc-14.1
|
||||
CXXSTD: 14,17
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\cygwin\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 03,11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\cygwin64\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 03,11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\mingw\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 03,11,14,1z
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;
|
||||
TOOLSET: gcc
|
||||
CXXSTD: 03,11,14,1z
|
||||
|
||||
install:
|
||||
- set BOOST_BRANCH=develop
|
||||
- if "%APPVEYOR_REPO_BRANCH%" == "master" set BOOST_BRANCH=master
|
||||
- cd ..
|
||||
- git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
- cd boost-root
|
||||
- git submodule update --init tools/boostdep
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\throw_exception\
|
||||
- python tools/boostdep/depinst/depinst.py throw_exception
|
||||
- cmd /c bootstrap
|
||||
- b2 -d0 headers
|
||||
|
||||
build: off
|
||||
|
||||
test_script:
|
||||
- PATH=%ADDPATH%%PATH%
|
||||
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
||||
- b2 -j3 libs/throw_exception/test toolset=%TOOLSET% %CXXSTD%
|
@ -5,21 +5,25 @@
|
||||
|
||||
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||
#define UUID_274DA366004E11DCB1DDFE2E56D89593
|
||||
#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_EXCEPTION_MINI_BOOST
|
||||
#include <memory>
|
||||
namespace boost { namespace exception_detail { using std::shared_ptr; } }
|
||||
#else
|
||||
namespace boost { template <class T> class shared_ptr; };
|
||||
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)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#pragma warning(disable: 4265)
|
||||
#endif
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
@ -140,17 +144,9 @@ boost
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class exception;
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
class
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
exception;
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
@ -170,7 +166,7 @@ boost
|
||||
|
||||
protected:
|
||||
|
||||
~error_info_container() throw()
|
||||
~error_info_container() BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -216,12 +212,8 @@ boost
|
||||
E const & set_info( E const &, throw_line const & );
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
exception
|
||||
{
|
||||
//<N3757>
|
||||
@ -242,7 +234,7 @@ boost
|
||||
#ifdef __HP_aCC
|
||||
//On HP aCC, this protected copy constructor prevents throwing boost::exception.
|
||||
//On all other platforms, the same effect is achieved by the pure virtual destructor.
|
||||
exception( exception const & x ) throw():
|
||||
exception( exception const & x ) BOOST_NOEXCEPT_OR_NOTHROW:
|
||||
data_(x.data_),
|
||||
throw_function_(x.throw_function_),
|
||||
throw_file_(x.throw_file_),
|
||||
@ -251,7 +243,7 @@ boost
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual ~exception() throw()
|
||||
virtual ~exception() BOOST_NOEXCEPT_OR_NOTHROW
|
||||
#ifndef __HP_aCC
|
||||
= 0 //Workaround for HP aCC, =0 incorrectly leads to link errors.
|
||||
#endif
|
||||
@ -293,15 +285,10 @@ boost
|
||||
mutable char const * throw_file_;
|
||||
mutable int throw_line_;
|
||||
};
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
inline
|
||||
exception::
|
||||
~exception() throw()
|
||||
~exception() BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
}
|
||||
|
||||
@ -338,13 +325,9 @@ boost
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
template <class T>
|
||||
struct
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
error_info_injector:
|
||||
public T,
|
||||
public exception
|
||||
@ -355,15 +338,10 @@ boost
|
||||
{
|
||||
}
|
||||
|
||||
~error_info_injector() throw()
|
||||
~error_info_injector() BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
}
|
||||
};
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
struct large_size { char c[256]; };
|
||||
large_size dispatch_boost_exception( exception const * );
|
||||
@ -411,12 +389,8 @@ boost
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
class
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
clone_base
|
||||
{
|
||||
public:
|
||||
@ -425,15 +399,10 @@ boost
|
||||
virtual void rethrow() const = 0;
|
||||
|
||||
virtual
|
||||
~clone_base() throw()
|
||||
~clone_base() BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
}
|
||||
};
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
inline
|
||||
void
|
||||
@ -454,13 +423,9 @@ boost
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility push (default)
|
||||
# endif
|
||||
#endif
|
||||
template <class T>
|
||||
class
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
clone_impl:
|
||||
public T,
|
||||
public virtual clone_base
|
||||
@ -481,7 +446,7 @@ boost
|
||||
copy_boost_exception(this,&x);
|
||||
}
|
||||
|
||||
~clone_impl() throw()
|
||||
~clone_impl() BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
}
|
||||
|
||||
@ -500,11 +465,6 @@ boost
|
||||
}
|
||||
};
|
||||
}
|
||||
#if defined(__GNUC__)
|
||||
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
|
||||
# pragma GCC visibility pop
|
||||
# endif
|
||||
#endif
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
@ -513,6 +473,51 @@ boost
|
||||
{
|
||||
return exception_detail::clone_impl<T>(x);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
wrapexcept:
|
||||
public exception_detail::clone_impl<typename exception_detail::enable_error_info_return_type<T>::type>
|
||||
{
|
||||
typedef exception_detail::clone_impl<typename exception_detail::enable_error_info_return_type<T>::type> base_type;
|
||||
public:
|
||||
explicit
|
||||
wrapexcept( typename exception_detail::enable_error_info_return_type<T>::type const & x ):
|
||||
base_type( x )
|
||||
{
|
||||
}
|
||||
|
||||
~wrapexcept() BOOST_NOEXCEPT_OR_NOTHROW
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
namespace
|
||||
exception_detail
|
||||
{
|
||||
template <class T>
|
||||
struct
|
||||
remove_error_info_injector
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
remove_error_info_injector< error_info_injector<T> >
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
wrapexcept<typename remove_error_info_injector<T>::type>
|
||||
enable_both( T const & x )
|
||||
{
|
||||
return wrapexcept<typename remove_error_info_injector<T>::type>( enable_error_info( x ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
|
@ -1,15 +1,6 @@
|
||||
#ifndef UUID_AA15E74A856F11E08B8D93F24824019B
|
||||
#define UUID_AA15E74A856F11E08B8D93F24824019B
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
@ -29,6 +20,7 @@
|
||||
// http://www.boost.org/libs/utility/throw_exception.html
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <exception>
|
||||
|
||||
@ -51,11 +43,18 @@
|
||||
# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
|
||||
#pragma warning(push,1)
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
|
||||
void throw_exception( std::exception const & e ); // user defined
|
||||
BOOST_NORETURN void throw_exception( std::exception const & e ); // user defined
|
||||
|
||||
#else
|
||||
|
||||
@ -68,7 +67,7 @@ template<class E> BOOST_NORETURN inline void throw_exception( E const & e )
|
||||
throw_exception_assert_compatibility(e);
|
||||
|
||||
#ifndef BOOST_EXCEPTION_DISABLE
|
||||
throw enable_current_exception(enable_error_info(e));
|
||||
throw exception_detail::enable_both( e );
|
||||
#else
|
||||
throw e;
|
||||
#endif
|
||||
|
@ -7,15 +7,20 @@
|
||||
|
||||
import testing ;
|
||||
|
||||
project
|
||||
: requirements
|
||||
<link>static
|
||||
<exception-handling>on
|
||||
;
|
||||
|
||||
run throw_exception_test.cpp ;
|
||||
run throw_exception_no_exceptions_test.cpp ;
|
||||
run throw_exception_no_integration_test.cpp ;
|
||||
run throw_exception_no_both_test.cpp ;
|
||||
|
||||
compile-fail throw_exception_fail.cpp ;
|
||||
|
||||
run throw_exception_test2.cpp ;
|
||||
run throw_exception_test3.cpp ;
|
||||
run throw_exception_test4.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 ;
|
||||
|
||||
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 ;
|
||||
|
13
test/lib1_throw.cpp
Normal file
13
test/lib1_throw.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
// 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 "lib1_throw.hpp"
|
||||
|
||||
void lib1::f()
|
||||
{
|
||||
throw lib1::exception();
|
||||
}
|
35
test/lib1_throw.hpp
Normal file
35
test/lib1_throw.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef LIB1_THROW_HPP_INCLUDED
|
||||
#define LIB1_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/config.hpp>
|
||||
#include <exception>
|
||||
|
||||
#if defined(LIB1_DYN_LINK)
|
||||
# if defined(LIB1_SOURCE)
|
||||
# define LIB1_DECL BOOST_SYMBOL_EXPORT
|
||||
# else
|
||||
# define LIB1_DECL BOOST_SYMBOL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define LIB1_DECL
|
||||
#endif
|
||||
|
||||
namespace lib1
|
||||
{
|
||||
|
||||
struct BOOST_SYMBOL_VISIBLE exception: public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
LIB1_DECL void f();
|
||||
|
||||
} // namespace lib1
|
||||
|
||||
#endif // #ifndef LIB1_THROW_HPP_INCLUDED
|
14
test/lib2_throw.cpp
Normal file
14
test/lib2_throw.cpp
Normal 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 "lib2_throw.hpp"
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
void lib2::f()
|
||||
{
|
||||
boost::throw_exception( lib2::exception() );
|
||||
}
|
35
test/lib2_throw.hpp
Normal file
35
test/lib2_throw.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef LIB2_THROW_HPP_INCLUDED
|
||||
#define LIB2_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/config.hpp>
|
||||
#include <exception>
|
||||
|
||||
#if defined(LIB2_DYN_LINK)
|
||||
# if defined(LIB2_SOURCE)
|
||||
# define LIB2_DECL BOOST_SYMBOL_EXPORT
|
||||
# else
|
||||
# define LIB2_DECL BOOST_SYMBOL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define LIB2_DECL
|
||||
#endif
|
||||
|
||||
namespace lib2
|
||||
{
|
||||
|
||||
struct BOOST_SYMBOL_VISIBLE exception: public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
LIB2_DECL void f();
|
||||
|
||||
} // namespace lib2
|
||||
|
||||
#endif // #ifndef LIB2_THROW_HPP_INCLUDED
|
14
test/lib3_throw.cpp
Normal file
14
test/lib3_throw.cpp
Normal 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 "lib3_throw.hpp"
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
void lib3::f()
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( lib3::exception() );
|
||||
}
|
35
test/lib3_throw.hpp
Normal file
35
test/lib3_throw.hpp
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef LIB3_THROW_HPP_INCLUDED
|
||||
#define LIB3_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/config.hpp>
|
||||
#include <exception>
|
||||
|
||||
#if defined(LIB3_DYN_LINK)
|
||||
# if defined(LIB3_SOURCE)
|
||||
# define LIB3_DECL BOOST_SYMBOL_EXPORT
|
||||
# else
|
||||
# define LIB3_DECL BOOST_SYMBOL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define LIB3_DECL
|
||||
#endif
|
||||
|
||||
namespace lib3
|
||||
{
|
||||
|
||||
struct BOOST_SYMBOL_VISIBLE exception: public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
LIB3_DECL void f();
|
||||
|
||||
} // namespace lib3
|
||||
|
||||
#endif // #ifndef LIB3_THROW_HPP_INCLUDED
|
@ -5,27 +5,24 @@
|
||||
|
||||
#define BOOST_NO_EXCEPTIONS
|
||||
#define BOOST_EXCEPTION_DISABLE
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
class my_exception: public std::exception { };
|
||||
class my_exception: public std::exception {};
|
||||
|
||||
bool called=false;
|
||||
int main()
|
||||
{
|
||||
boost::throw_exception( my_exception() );
|
||||
return 1;
|
||||
}
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
void
|
||||
throw_exception( std::exception const & )
|
||||
{
|
||||
called=true;
|
||||
}
|
||||
}
|
||||
namespace boost
|
||||
{
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
boost::throw_exception(my_exception());
|
||||
BOOST_TEST(called);
|
||||
return boost::report_errors();
|
||||
}
|
||||
void throw_exception( std::exception const & )
|
||||
{
|
||||
std::exit( 0 );
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
@ -4,27 +4,24 @@
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define BOOST_NO_EXCEPTIONS
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
class my_exception: public std::exception { };
|
||||
class my_exception: public std::exception {};
|
||||
|
||||
bool called=false;
|
||||
int main()
|
||||
{
|
||||
boost::throw_exception( my_exception() );
|
||||
return 1;
|
||||
}
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
void
|
||||
throw_exception( std::exception const & )
|
||||
{
|
||||
called=true;
|
||||
}
|
||||
}
|
||||
namespace boost
|
||||
{
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
boost::throw_exception(my_exception());
|
||||
BOOST_TEST(called);
|
||||
return boost::report_errors();
|
||||
}
|
||||
void throw_exception( std::exception const & )
|
||||
{
|
||||
std::exit( 0 );
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
28
test/throw_exception_test2.cpp
Normal file
28
test/throw_exception_test2.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
// 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/throw_exception.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
class my_exception: public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
class my_exception2: public std::exception, public boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_THROWS( boost::throw_exception( my_exception() ), boost::exception );
|
||||
BOOST_TEST_THROWS( boost::throw_exception( my_exception2() ), boost::exception );
|
||||
|
||||
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception() ), boost::exception );
|
||||
BOOST_TEST_THROWS( BOOST_THROW_EXCEPTION( my_exception2() ), boost::exception );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
71
test/throw_exception_test3.cpp
Normal file
71
test/throw_exception_test3.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
// 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/throw_exception.hpp>
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
class my_exception: public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
class my_exception2: public std::exception, public boost::exception
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::throw_exception( my_exception() );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
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
|
||||
{
|
||||
boost::throw_exception( my_exception2() );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
|
||||
BOOST_TEST_THROWS( boost::rethrow_exception( p ), my_exception2 );
|
||||
BOOST_TEST_THROWS( boost::rethrow_exception( p ), boost::exception );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( my_exception() );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
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
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( my_exception2() );
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
|
||||
BOOST_TEST_THROWS( boost::rethrow_exception( p ), my_exception2 );
|
||||
BOOST_TEST_THROWS( boost::rethrow_exception( p ), boost::exception );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
47
test/throw_exception_test4.cpp
Normal file
47
test/throw_exception_test4.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
// 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/throw_exception.hpp>
|
||||
#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
|
||||
{
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
try
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( my_exception() );
|
||||
}
|
||||
catch( boost::exception const & x )
|
||||
{
|
||||
int const * line = boost::get_error_info<boost::throw_line>( x );
|
||||
|
||||
BOOST_TEST( line != 0 );
|
||||
BOOST_TEST_EQ( *line, 24 );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( my_exception2() );
|
||||
}
|
||||
catch( boost::exception const & x )
|
||||
{
|
||||
int const * line = boost::get_error_info<boost::throw_line>( x );
|
||||
|
||||
BOOST_TEST( line != 0 );
|
||||
BOOST_TEST_EQ( *line, 36 );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
79
test/throw_from_library_test.cpp
Normal file
79
test/throw_from_library_test.cpp
Normal file
@ -0,0 +1,79 @@
|
||||
// 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 "lib1_throw.hpp"
|
||||
#include "lib2_throw.hpp"
|
||||
#include "lib3_throw.hpp"
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/exception_ptr.hpp>
|
||||
#include <boost/exception/get_error_info.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
void test_catch_by_exception()
|
||||
{
|
||||
BOOST_TEST_THROWS( lib2::f(), boost::exception );
|
||||
BOOST_TEST_THROWS( lib3::f(), boost::exception );
|
||||
}
|
||||
|
||||
void test_exception_ptr()
|
||||
{
|
||||
try
|
||||
{
|
||||
lib2::f();
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
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
|
||||
{
|
||||
lib3::f();
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
boost::exception_ptr p = boost::current_exception();
|
||||
|
||||
BOOST_TEST_THROWS( boost::rethrow_exception( p ), lib3::exception );
|
||||
BOOST_TEST_THROWS( boost::rethrow_exception( p ), boost::exception );
|
||||
}
|
||||
}
|
||||
|
||||
void test_throw_line()
|
||||
{
|
||||
try
|
||||
{
|
||||
lib3::f();
|
||||
}
|
||||
catch( boost::exception const & x )
|
||||
{
|
||||
int const * line = boost::get_error_info<boost::throw_line>( x );
|
||||
|
||||
BOOST_TEST( line != 0 );
|
||||
BOOST_TEST_EQ( *line, 13 );
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_catch_by_type();
|
||||
test_catch_by_exception();
|
||||
test_exception_ptr();
|
||||
test_throw_line();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
Reference in New Issue
Block a user