Compare commits

..

7 Commits

Author SHA1 Message Date
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
7 changed files with 265 additions and 24 deletions

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

@ -0,0 +1,186 @@
name: CI
on:
pull_request:
push:
branches:
- master
- develop
- feature/**
env:
LIBRARY: throw_exception
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/$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: 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\%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

@ -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

@ -49,26 +49,7 @@ BOOST_NORETURN void throw_exception( std::exception const & e, boost::source_loc
} // 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 )
#else // !defined( BOOST_NO_EXCEPTIONS )
#include <boost/exception/exception.hpp>
@ -157,6 +138,31 @@ public:
}
};
} // namespace boost
#if 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_EXCEPTION_DISABLE )
namespace boost
{
// boost::throw_exception
template<class E> BOOST_NORETURN void throw_exception( E const & e )
@ -173,7 +179,9 @@ template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::sourc
} // namespace boost
#endif
#endif // # if defined( BOOST_EXCEPTION_DISABLE )
#endif // # if defined( BOOST_NO_EXCEPTIONS )
// BOOST_THROW_EXCEPTION

View File

@ -7,7 +7,7 @@
],
"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": [

View File

@ -37,3 +37,6 @@ run throw_from_library_test.cpp lib1_throw lib2_throw lib3_throw : : : <link>sha
run throw_exception_nx_test.cpp : : : <exception-handling>off ;
run throw_exception_nx_test2.cpp : : : <exception-handling>off ;
run make_exception_ptr_test.cpp ;
run make_exception_ptr_test2.cpp ;

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();
}