forked from boostorg/throw_exception
Compare commits
4 Commits
feature/pr
...
boost-1.76
Author | SHA1 | Date | |
---|---|---|---|
5b675bbc9c | |||
9c0a5b810b | |||
5e6223c838 | |||
f3b43b5679 |
19
.github/workflows/ci.yml
vendored
19
.github/workflows/ci.yml
vendored
@ -9,7 +9,6 @@ on:
|
||||
- feature/**
|
||||
|
||||
env:
|
||||
LIBRARY: throw_exception
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
|
||||
jobs:
|
||||
@ -120,8 +119,17 @@ jobs:
|
||||
|
||||
- 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
|
||||
@ -167,9 +175,16 @@ jobs:
|
||||
- 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
|
||||
if "%GITHUB_BASE_REF%" == "master" set BOOST_BRANCH=master
|
||||
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
|
||||
|
@ -20,6 +20,7 @@
|
||||
// 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>
|
||||
@ -32,29 +33,12 @@
|
||||
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
|
||||
|
||||
#else // !defined( BOOST_NO_EXCEPTIONS )
|
||||
|
||||
#include <boost/exception/exception.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#endif
|
||||
|
||||
// boost::wrapexcept<E>
|
||||
|
||||
@ -134,17 +118,29 @@ public:
|
||||
|
||||
virtual void rethrow() const BOOST_OVERRIDE
|
||||
{
|
||||
#if defined( BOOST_NO_EXCEPTIONS )
|
||||
|
||||
boost::throw_exception( *this );
|
||||
|
||||
#else
|
||||
|
||||
throw *this;
|
||||
|
||||
#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 & ) {}
|
||||
|
||||
// boost::throw_exception
|
||||
|
||||
#if !defined( BOOST_NO_EXCEPTIONS )
|
||||
|
||||
#if defined( BOOST_EXCEPTION_DISABLE )
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class E> BOOST_NORETURN void throw_exception( E const & e )
|
||||
{
|
||||
throw_exception_assert_compatibility( e );
|
||||
@ -157,13 +153,7 @@ template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::sourc
|
||||
throw e;
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#else // !defined( BOOST_EXCEPTION_DISABLE )
|
||||
|
||||
namespace boost
|
||||
{
|
||||
// boost::throw_exception
|
||||
#else // defined( BOOST_EXCEPTION_DISABLE )
|
||||
|
||||
template<class E> BOOST_NORETURN void throw_exception( E const & e )
|
||||
{
|
||||
@ -177,12 +167,12 @@ template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::sourc
|
||||
throw wrapexcept<E>( e, loc );
|
||||
}
|
||||
|
||||
#endif // defined( BOOST_EXCEPTION_DISABLE )
|
||||
|
||||
#endif // !defined( BOOST_NO_EXCEPTIONS )
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // # if defined( BOOST_EXCEPTION_DISABLE )
|
||||
|
||||
#endif // # if defined( BOOST_NO_EXCEPTIONS )
|
||||
|
||||
// BOOST_THROW_EXCEPTION
|
||||
|
||||
#define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x, BOOST_CURRENT_LOCATION)
|
||||
|
@ -12,5 +12,6 @@
|
||||
"description": "A common infrastructure for throwing exceptions from Boost libraries.",
|
||||
"category": [
|
||||
"Miscellaneous"
|
||||
]
|
||||
],
|
||||
"cxxstd": "03"
|
||||
}
|
||||
|
@ -37,6 +37,10 @@ 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 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 ;
|
||||
|
40
test/make_exception_ptr_nx_test.cpp
Normal file
40
test/make_exception_ptr_nx_test.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
// 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
|
||||
#endif
|
||||
|
||||
//#include <boost/exception_ptr.hpp>
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
typedef boost::shared_ptr<boost::exception_detail::clone_base const> exception_ptr;
|
||||
|
||||
template<class E> exception_ptr make_exception_ptr( E const& e )
|
||||
{
|
||||
return boost::make_shared< boost::wrapexcept<E> >( e );
|
||||
}
|
||||
|
||||
class my_exception: public std::exception {};
|
||||
|
||||
int main()
|
||||
{
|
||||
::make_exception_ptr( my_exception() );
|
||||
}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// shared_ptr needs this
|
||||
void throw_exception( std::exception const & )
|
||||
{
|
||||
std::exit( 1 );
|
||||
}
|
||||
|
||||
} // namespace boost
|
42
test/make_exception_ptr_nx_test2.cpp
Normal file
42
test/make_exception_ptr_nx_test2.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
// 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
|
||||
#endif
|
||||
|
||||
#define BOOST_EXCEPTION_DISABLE
|
||||
|
||||
//#include <boost/exception_ptr.hpp>
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
typedef boost::shared_ptr<boost::exception_detail::clone_base const> exception_ptr;
|
||||
|
||||
template<class E> exception_ptr make_exception_ptr( E const& e )
|
||||
{
|
||||
return boost::make_shared< boost::wrapexcept<E> >( e );
|
||||
}
|
||||
|
||||
class my_exception: public std::exception {};
|
||||
|
||||
int main()
|
||||
{
|
||||
::make_exception_ptr( my_exception() );
|
||||
}
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// shared_ptr needs this
|
||||
void throw_exception( std::exception const & )
|
||||
{
|
||||
std::exit( 1 );
|
||||
}
|
||||
|
||||
} // namespace boost
|
17
test/throw_exception_nx_test3.cpp
Normal file
17
test/throw_exception_nx_test3.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
// 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
|
||||
#endif
|
||||
|
||||
// Make sure that simple inclusion does not
|
||||
// require boost::throw_exception to be defined
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user