Compare commits

..

15 Commits

21 changed files with 257 additions and 50 deletions

View File

@ -4,11 +4,7 @@
language: cpp
sudo: false
dist: trusty
python: "2.7"
dist: xenial
branches:
only:
@ -131,12 +127,12 @@ 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
compiler: g++-9
env: UBSAN=1 TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1 LINKFLAGS=-fuse-ld=gold
addons:
apt:
packages:
- g++-8
- g++-9
sources:
- ubuntu-toolchain-r-test
@ -145,6 +141,7 @@ matrix:
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 +150,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 +159,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 +176,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 +196,6 @@ matrix:
apt:
packages:
- clang-3.8
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
@ -200,7 +206,6 @@ matrix:
apt:
packages:
- clang-3.9
- libstdc++-4.9-dev
sources:
- ubuntu-toolchain-r-test
@ -211,10 +216,8 @@ matrix:
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
@ -223,10 +226,8 @@ matrix:
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
@ -237,7 +238,6 @@ matrix:
- clang-6.0
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- os: linux
compiler: clang++-7
@ -248,7 +248,7 @@ matrix:
- clang-7
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-7
- llvm-toolchain-xenial-7
- os: linux
compiler: clang++-8
@ -259,10 +259,9 @@ matrix:
- clang-8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-8
- llvm-toolchain-xenial-8
- os: linux
dist: xenial
compiler: clang++-9
env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a
addons:
@ -275,17 +274,18 @@ matrix:
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
compiler: clang++-8
env: UBSAN=1 TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a UBSAN_OPTIONS=print_stacktrace=1
addons:
apt:
packages:
- clang-6.0
- clang-8
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
- llvm-toolchain-xenial-8
- os: linux
dist: trusty
compiler: clang++-libc++
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
addons:
@ -294,6 +294,7 @@ matrix:
- libc++-dev
- 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:
@ -305,6 +306,41 @@ matrix:
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
- os: osx
compiler: clang++
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_VERBOSE=1 -DBOOST_INCLUDE_LIBRARIES=throw_exception ..
- ctest --output-on-failure -R boost_throw_exception
- os: linux
env: CMAKE_SUBDIR=1
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- git clone -b $BOOST_BRANCH https://github.com/boostorg/assert.git ../assert
- git clone -b $BOOST_BRANCH https://github.com/boostorg/config.git ../config
- git clone -b $BOOST_BRANCH https://github.com/boostorg/core.git ../core
script:
- cd test/cmake_subdir_test && mkdir __build__ && cd __build__
- cmake ..
- cmake --build .
- cmake --build . --target check
- os: linux
env: CMAKE_INSTALL=1
script:
- mkdir __build__ && cd __build__
- 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 ..
- cmake --build .
- cmake --build . --target check
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..

View File

@ -1,12 +1,9 @@
# Copyright 2018 Mike Dev
# Copyright 2019 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
# 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)
cmake_minimum_required(VERSION 3.5...3.16)
project(boost_throw_exception VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
add_library(boost_throw_exception INTERFACE)
add_library(Boost::throw_exception ALIAS boost_throw_exception)
@ -14,7 +11,20 @@ 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
INTERFACE
Boost::assert
Boost::config
)
if(BOOST_SUPERPROJECT_VERSION)
include(BoostInstall)
boost_install(TARGETS boost_throw_exception HEADER_DIRECTORY include/)
endif()
if(BUILD_TESTING)
add_subdirectory(test)
endif()

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

@ -3,8 +3,8 @@
//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)
#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593
#define UUID_274DA366004E11DCB1DDFE2E56D89593
#ifndef BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593
#define BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593
#include <boost/config.hpp>
@ -478,4 +478,5 @@ boost
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif
#endif // #ifndef BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593

View File

@ -1,5 +1,5 @@
#ifndef UUID_AA15E74A856F11E08B8D93F24824019B
#define UUID_AA15E74A856F11E08B8D93F24824019B
#ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED
#define BOOST_THROW_EXCEPTION_HPP_INCLUDED
// MS compatible compilers support #pragma once
@ -179,4 +179,4 @@ template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::sourc
#define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x, BOOST_CURRENT_LOCATION)
#endif // #ifndef UUID_AA15E74A856F11E08B8D93F24824019B
#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED

17
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,17 @@
# Copyright 2018, 2019 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(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::throw_exception Boost::core Boost::exception)
endif()
#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_exception_nx_test.cpp : : : <exception-handling>off ;
#run throw_exception_nx_test2.cpp : : : <exception-handling>off ;

View File

@ -1,18 +1,27 @@
# Boost Exception Library test Jamfile
# Boost ThrowException Library test Jamfile
#
# Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
# Copyright 2019 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)
import testing ;
project : requirements
<warnings>extra
<toolset>msvc:<warnings-as-errors>on
<toolset>clang:<warnings-as-errors>on
<toolset>gcc:<warnings-as-errors>on
<toolset>gcc:<cxxflags>-Wshadow ;
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 ;
compile-fail throw_exception_fail.cpp
: <warnings-as-errors>off ;
run throw_exception_test2.cpp ;
run throw_exception_test3.cpp ;

View File

@ -0,0 +1,17 @@
# 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
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_install_test LANGUAGES CXX)
find_package(boost_throw_exception REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main Boost::throw_exception)
enable_testing()
add_test(NAME main COMMAND main)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -0,0 +1,19 @@
// Copyright 2019 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 <stdexcept>
int main()
{
try
{
boost::throw_exception( std::runtime_error( "" ) );
return 1;
}
catch( std::runtime_error const& )
{
return 0;
}
}

View File

@ -0,0 +1,19 @@
# 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
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_subdir_test LANGUAGES CXX)
add_subdirectory(../../../assert boostorg/assert)
add_subdirectory(../../../config boostorg/config)
add_subdirectory(../../../throw_exception boostorg/throw_exception)
add_executable(main main.cpp)
target_link_libraries(main Boost::throw_exception)
enable_testing()
add_test(NAME main COMMAND main)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -0,0 +1,19 @@
// Copyright 2019 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 <stdexcept>
int main()
{
try
{
boost::throw_exception( std::runtime_error( "" ) );
return 1;
}
catch( std::runtime_error const& )
{
return 0;
}
}

View File

@ -9,6 +9,10 @@
#include <boost/throw_exception.hpp>
#include <cstdlib>
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
#endif
class my_exception: public std::exception {};
int main()

View File

@ -8,6 +8,10 @@
#include <boost/throw_exception.hpp>
#include <cstdlib>
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
#endif
class my_exception: public std::exception {};
int main()

View File

@ -5,7 +5,11 @@
#define BOOST_EXCEPTION_DISABLE
#include <boost/throw_exception.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/core/lightweight_test.hpp>
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
#endif
class my_exception: public std::exception { };

View File

@ -2,6 +2,11 @@
// 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/throw_exception.hpp>
#include <cstdlib>

View File

@ -2,6 +2,11 @@
// 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/throw_exception.hpp>
#include <cstdlib>
#include <cstring>
@ -22,7 +27,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() != 13 ) ++r;
if( loc.line() != 18 ) ++r;
std::exit( r );
}

View File

@ -4,10 +4,13 @@
//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>
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp>
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
#endif
class my_exception: public std::exception { };
int

View File

@ -6,7 +6,11 @@
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/throw_exception.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/core/lightweight_test.hpp>
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
#endif
class my_exception: public std::exception
{

View File

@ -5,9 +5,21 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
#endif
#if defined(__clang__)
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wunknown-warning-option"
# pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"
# pragma clang diagnostic ignored "-Wdelete-non-abstract-non-virtual-dtor"
# pragma clang diagnostic ignored "-Wunused-parameter"
#endif
#include <boost/throw_exception.hpp>
#include <boost/exception_ptr.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <boost/core/lightweight_test.hpp>
class my_exception: public std::exception
{

View File

@ -5,6 +5,13 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#if defined(__clang__)
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wunknown-warning-option"
# pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"
# pragma clang diagnostic ignored "-Wdelete-non-abstract-non-virtual-dtor"
#endif
#include <boost/throw_exception.hpp>
#include <boost/exception/get_error_info.hpp>
#include <boost/exception/info.hpp>

View File

@ -5,6 +5,18 @@
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
#if defined(_MSC_VER)
# pragma warning(disable: 4702) // unreachable code
#endif
#if defined(__clang__)
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wunknown-warning-option"
# pragma clang diagnostic ignored "-Wpotentially-evaluated-expression"
# pragma clang diagnostic ignored "-Wdelete-non-abstract-non-virtual-dtor"
# pragma clang diagnostic ignored "-Wunused-parameter"
#endif
#include "lib1_throw.hpp"
#include "lib2_throw.hpp"
#include "lib3_throw.hpp"