|
6 | 6 |
|
7 | 7 | // SPDX-License-Identifier: BSL-1.0 |
8 | 8 |
|
9 | | -// Catch v3.9.0 |
10 | | -// Generated: 2025-07-24 22:00:24.654688 |
| 9 | +// Catch v3.9.1 |
| 10 | +// Generated: 2025-08-09 00:29:20.303175 |
11 | 11 | // ---------------------------------------------------------- |
12 | 12 | // This file is an amalgamation of multiple different files. |
13 | 13 | // You probably shouldn't edit it directly. |
@@ -958,7 +958,7 @@ namespace Detail { |
958 | 958 | } |
959 | 959 |
|
960 | 960 | explicit operator bool() const { |
961 | | - return m_ptr; |
| 961 | + return m_ptr != nullptr; |
962 | 962 | } |
963 | 963 |
|
964 | 964 | friend void swap(unique_ptr& lhs, unique_ptr& rhs) { |
@@ -2151,9 +2151,7 @@ namespace Catch { |
2151 | 2151 | auto analysis = Detail::analyse(*cfg, samples.data(), samples.data() + samples.size()); |
2152 | 2152 | BenchmarkStats<> stats{ CATCH_MOVE(info), CATCH_MOVE(analysis.samples), analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance }; |
2153 | 2153 | getResultCapture().benchmarkEnded(stats); |
2154 | | - } CATCH_CATCH_ANON (TestFailureException const&) { |
2155 | | - getResultCapture().benchmarkFailed("Benchmark failed due to failed assertion"_sr); |
2156 | | - } CATCH_CATCH_ALL{ |
| 2154 | + } CATCH_CATCH_ALL { |
2157 | 2155 | getResultCapture().benchmarkFailed(translateActiveException()); |
2158 | 2156 | // We let the exception go further up so that the |
2159 | 2157 | // test case is marked as failed. |
@@ -2566,11 +2564,17 @@ namespace Catch { |
2566 | 2564 |
|
2567 | 2565 | namespace Detail { |
2568 | 2566 |
|
| 2567 | + std::string makeExceptionHappenedString(); |
| 2568 | + |
2569 | 2569 | // This function dispatches all stringification requests inside of Catch. |
2570 | 2570 | // Should be preferably called fully qualified, like ::Catch::Detail::stringify |
2571 | 2571 | template <typename T> |
2572 | | - std::string stringify(const T& e) { |
2573 | | - return ::Catch::StringMaker<std::remove_cv_t<std::remove_reference_t<T>>>::convert(e); |
| 2572 | + std::string stringify( const T& e ) { |
| 2573 | + CATCH_TRY { |
| 2574 | + return ::Catch::StringMaker< |
| 2575 | + std::remove_cv_t<std::remove_reference_t<T>>>::convert( e ); |
| 2576 | + } |
| 2577 | + CATCH_CATCH_ALL { return makeExceptionHappenedString(); } |
2574 | 2578 | } |
2575 | 2579 |
|
2576 | 2580 | template<typename E> |
@@ -3053,17 +3057,19 @@ struct ratio_string<std::milli> { |
3053 | 3057 | template<typename Duration> |
3054 | 3058 | struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> { |
3055 | 3059 | static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) { |
3056 | | - auto converted = std::chrono::system_clock::to_time_t(time_point); |
| 3060 | + const auto systemish = std::chrono::time_point_cast< |
| 3061 | + std::chrono::system_clock::duration>( time_point ); |
| 3062 | + const auto as_time_t = std::chrono::system_clock::to_time_t( systemish ); |
3057 | 3063 |
|
3058 | 3064 | #ifdef _MSC_VER |
3059 | 3065 | std::tm timeInfo = {}; |
3060 | | - const auto err = gmtime_s(&timeInfo, &converted); |
| 3066 | + const auto err = gmtime_s( &timeInfo, &as_time_t ); |
3061 | 3067 | if ( err ) { |
3062 | 3068 | return "gmtime from provided timepoint has failed. This " |
3063 | 3069 | "happens e.g. with pre-1970 dates using Microsoft libc"; |
3064 | 3070 | } |
3065 | 3071 | #else |
3066 | | - std::tm* timeInfo = std::gmtime(&converted); |
| 3072 | + std::tm* timeInfo = std::gmtime( &as_time_t ); |
3067 | 3073 | #endif |
3068 | 3074 |
|
3069 | 3075 | auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); |
@@ -5238,10 +5244,11 @@ namespace Detail { |
5238 | 5244 | * |
5239 | 5245 | * 3) If a type has no linkage, we also cannot capture it by reference. |
5240 | 5246 | * The solution is once again to capture them by value. We handle |
5241 | | - * the common cases by using `std::is_arithmetic` as the default |
5242 | | - * for `Catch::capture_by_value`, but that is only a some-effort |
5243 | | - * heuristic. But as with 2), users can specialize `capture_by_value` |
5244 | | - * for their own types as needed. |
| 5247 | + * the common cases by using `std::is_arithmetic` and `std::is_enum` |
| 5248 | + * as the default for `Catch::capture_by_value`, but that is only a |
| 5249 | + * some-effort heuristic. These combine to capture all possible bitfield |
| 5250 | + * bases, and also some trait-like types. As with 2), users can |
| 5251 | + * specialize `capture_by_value` for their own types as needed. |
5245 | 5252 | * |
5246 | 5253 | * 4) To support C++20 and make the SFINAE on our decomposing operators |
5247 | 5254 | * work, the SFINAE has to happen in return type, rather than in |
@@ -5293,13 +5300,22 @@ namespace Catch { |
5293 | 5300 | using RemoveCVRef_t = std::remove_cv_t<std::remove_reference_t<T>>; |
5294 | 5301 | } |
5295 | 5302 |
|
5296 | | - // Note: There is nothing that stops us from extending this, |
5297 | | - // e.g. to `std::is_scalar`, but the more encompassing |
5298 | | - // traits are usually also more expensive. For now we |
5299 | | - // keep this as it used to be and it can be changed later. |
| 5303 | + // Note: This is about as much as we can currently reasonably support. |
| 5304 | + // In an ideal world, we could capture by value small trivially |
| 5305 | + // copyable types, but the actual `std::is_trivially_copyable` |
| 5306 | + // trait is a huge mess with standard-violating results on |
| 5307 | + // GCC and Clang, which are unlikely to be fixed soon due to ABI |
| 5308 | + // concerns. |
| 5309 | + // `std::is_scalar` also causes issues due to the `is_pointer` |
| 5310 | + // component, which causes ambiguity issues with (references-to) |
| 5311 | + // function pointer. If those are resolved, we still need to |
| 5312 | + // disambiguate the overload set for arrays, through explicit |
| 5313 | + // overload for references to sized arrays. |
5300 | 5314 | template <typename T> |
5301 | 5315 | struct capture_by_value |
5302 | | - : std::integral_constant<bool, std::is_arithmetic<T>{}> {}; |
| 5316 | + : std::integral_constant<bool, |
| 5317 | + std::is_arithmetic<T>::value || |
| 5318 | + std::is_enum<T>::value> {}; |
5303 | 5319 |
|
5304 | 5320 | #if defined( CATCH_CONFIG_CPP20_COMPARE_OVERLOADS ) |
5305 | 5321 | template <> |
@@ -6241,9 +6257,13 @@ namespace Catch { |
6241 | 6257 | __assume( false ); |
6242 | 6258 | # elif defined( __GNUC__ ) |
6243 | 6259 | __builtin_unreachable(); |
| 6260 | +# else // vv platform without known optimization hint |
| 6261 | + std::terminate(); |
6244 | 6262 | # endif |
6245 | | -# endif // ^^ NDEBUG |
| 6263 | +# else // ^^ NDEBUG |
| 6264 | + // For non-release builds, we prefer termination on bug over UB |
6246 | 6265 | std::terminate(); |
| 6266 | +# endif // |
6247 | 6267 | } |
6248 | 6268 |
|
6249 | 6269 | } // namespace Detail |
@@ -7447,7 +7467,7 @@ namespace Catch { |
7447 | 7467 |
|
7448 | 7468 | #define CATCH_VERSION_MAJOR 3 |
7449 | 7469 | #define CATCH_VERSION_MINOR 9 |
7450 | | -#define CATCH_VERSION_PATCH 0 |
| 7470 | +#define CATCH_VERSION_PATCH 1 |
7451 | 7471 |
|
7452 | 7472 | #endif // CATCH_VERSION_MACROS_HPP_INCLUDED |
7453 | 7473 |
|
@@ -9500,6 +9520,17 @@ namespace Catch { |
9500 | 9520 | bool isDebuggerActive(); |
9501 | 9521 | } |
9502 | 9522 |
|
| 9523 | +#if !defined( CATCH_TRAP ) && defined( __clang__ ) && defined( __has_builtin ) |
| 9524 | +# if __has_builtin( __builtin_debugtrap ) |
| 9525 | +# define CATCH_TRAP() __builtin_debugtrap() |
| 9526 | +# endif |
| 9527 | +#endif |
| 9528 | + |
| 9529 | +#if !defined( CATCH_TRAP ) && defined( _MSC_VER ) |
| 9530 | +# define CATCH_TRAP() __debugbreak() |
| 9531 | +#endif |
| 9532 | + |
| 9533 | +#if !defined(CATCH_TRAP) // If we couldn't use compiler-specific impl from above, we get into platform-specific options |
9503 | 9534 | #ifdef CATCH_PLATFORM_MAC |
9504 | 9535 |
|
9505 | 9536 | #if defined(__i386__) || defined(__x86_64__) |
@@ -9535,15 +9566,15 @@ namespace Catch { |
9535 | 9566 |
|
9536 | 9567 | #define CATCH_TRAP() raise(SIGTRAP) |
9537 | 9568 | #endif |
9538 | | -#elif defined(_MSC_VER) |
9539 | | - #define CATCH_TRAP() __debugbreak() |
9540 | 9569 | #elif defined(__MINGW32__) |
9541 | 9570 | extern "C" __declspec(dllimport) void __stdcall DebugBreak(); |
9542 | 9571 | #define CATCH_TRAP() DebugBreak() |
9543 | 9572 | #endif |
| 9573 | +#endif // ^^ CATCH_TRAP is not defined yet, so we define it |
| 9574 | + |
9544 | 9575 |
|
9545 | | -#ifndef CATCH_BREAK_INTO_DEBUGGER |
9546 | | - #ifdef CATCH_TRAP |
| 9576 | +#if !defined(CATCH_BREAK_INTO_DEBUGGER) |
| 9577 | + #if defined(CATCH_TRAP) |
9547 | 9578 | #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() |
9548 | 9579 | #else |
9549 | 9580 | #define CATCH_BREAK_INTO_DEBUGGER() []{}() |
|
0 commit comments