Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:02:49

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 
0009 /** \file
0010  * Wrapper for UNCAUGHT_EXCEPTIONS configuration option
0011  *
0012  * For some functionality, Catch2 requires to know whether there is
0013  * an active exception. Because `std::uncaught_exception` is deprecated
0014  * in C++17, we want to use `std::uncaught_exceptions` if possible.
0015  */
0016 
0017 #ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
0018 #define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
0019 
0020 #include <catch2/catch_user_config.hpp>
0021 
0022 #if defined(_MSC_VER)
0023 #  if _MSC_VER >= 1900 // Visual Studio 2015 or newer
0024 #    define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
0025 #  endif
0026 #endif
0027 
0028 
0029 #include <exception>
0030 
0031 #if defined(__cpp_lib_uncaught_exceptions) \
0032     && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
0033 
0034 #  define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
0035 #endif // __cpp_lib_uncaught_exceptions
0036 
0037 
0038 #if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \
0039     && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \
0040     && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
0041 
0042 #  define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
0043 #endif
0044 
0045 
0046 #endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED