1 2 // Copyright Catch2 Authors 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // https://www.boost.org/LICENSE_1_0.txt) 6 7 // SPDX-License-Identifier: BSL-1.0 8 9 /** \file 10 * Wrapper for UNCAUGHT_EXCEPTIONS configuration option 11 * 12 * For some functionality, Catch2 requires to know whether there is 13 * an active exception. Because `std::uncaught_exception` is deprecated 14 * in C++17, we want to use `std::uncaught_exceptions` if possible. 15 */ 16 17 #ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP 18 #define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP 19 20 #if defined(_MSC_VER) 21 # if _MSC_VER >= 1900 // Visual Studio 2015 or newer 22 # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS 23 # endif 24 #endif 25 26 27 #include <exception> 28 29 #if defined(__cpp_lib_uncaught_exceptions) \ 30 && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) 31 32 # define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS 33 #endif // __cpp_lib_uncaught_exceptions 34 35 36 #if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \ 37 && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \ 38 && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) 39 40 # define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS 41 #endif 42 43 44 #endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP 45