Skip to content

Commit 644821c

Browse files
committed
v3.9.1
1 parent 03c62cd commit 644821c

File tree

7 files changed

+87
-35
lines changed

7 files changed

+87
-35
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ if(CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
3434
endif()
3535

3636
project(Catch2
37-
VERSION 3.9.0 # CML version placeholder, don't delete
37+
VERSION 3.9.1 # CML version placeholder, don't delete
3838
LANGUAGES CXX
3939
HOMEPAGE_URL "https://github.com/catchorg/Catch2"
4040
DESCRIPTION "A modern, C++-native, unit test framework."

docs/release-notes.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Release notes
44
**Contents**<br>
5+
[3.9.1](#391)<br>
56
[3.9.0](#390)<br>
67
[3.8.1](#381)<br>
78
[3.8.0](#380)<br>
@@ -68,6 +69,19 @@
6869
[Even Older versions](#even-older-versions)<br>
6970

7071

72+
## 3.9.1
73+
74+
### Fixes
75+
* Fixed bad error reporting for multiple nested assertions (#1292)
76+
* Fixed W4702 (unreachable code) in the polyfill for std::unreachable (#3007)
77+
* Fixed decomposition of assertions comparing enum-backed bitfields (#3001)
78+
* Fixed StringMaker specialization for `time_point<system_clock>` with non-default duration type (#2685)
79+
80+
### Improvements
81+
* Exceptions thrown during stringification of decomposed expression no longer fail the assertion (#2980)
82+
* The selection logic for `CATCH_TRAP` prefers `__builtin_debugtrap` on all platforms when Catch2 is compiled with Clang
83+
84+
7185
## 3.9.0
7286

7387
### Improvements

extras/catch_amalgamated.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
// SPDX-License-Identifier: BSL-1.0
88

9-
// Catch v3.9.0
10-
// Generated: 2025-07-24 22:00:25.173359
9+
// Catch v3.9.1
10+
// Generated: 2025-08-09 00:29:21.552225
1111
// ----------------------------------------------------------
1212
// This file is an amalgamation of multiple different files.
1313
// You probably shouldn't edit it directly.
@@ -2026,6 +2026,13 @@ namespace Detail {
20262026
rss << std::setw(2) << static_cast<unsigned>(bytes[i]);
20272027
return rss.str();
20282028
}
2029+
2030+
std::string makeExceptionHappenedString() {
2031+
return "{ stringification failed with an exception: \"" +
2032+
translateActiveException() + "\" }";
2033+
2034+
}
2035+
20292036
} // end Detail namespace
20302037

20312038

@@ -2271,7 +2278,7 @@ namespace Catch {
22712278
}
22722279

22732280
Version const& libraryVersion() {
2274-
static Version version( 3, 9, 0, "", 0 );
2281+
static Version version( 3, 9, 1, "", 0 );
22752282
return version;
22762283
}
22772284

@@ -3981,10 +3988,10 @@ namespace Catch {
39813988
// To avoid having to handle TFE explicitly everywhere, we just
39823989
// rethrow it so that it goes back up the caller.
39833990
catch( TestFailureException& ) {
3984-
std::rethrow_exception(std::current_exception());
3991+
return "{ nested assertion failed }";
39853992
}
39863993
catch( TestSkipException& ) {
3987-
std::rethrow_exception(std::current_exception());
3994+
return "{ nested SKIP() called }";
39883995
}
39893996
catch( std::exception const& ex ) {
39903997
return ex.what();

extras/catch_amalgamated.hpp

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
// SPDX-License-Identifier: BSL-1.0
88

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
1111
// ----------------------------------------------------------
1212
// This file is an amalgamation of multiple different files.
1313
// You probably shouldn't edit it directly.
@@ -958,7 +958,7 @@ namespace Detail {
958958
}
959959

960960
explicit operator bool() const {
961-
return m_ptr;
961+
return m_ptr != nullptr;
962962
}
963963

964964
friend void swap(unique_ptr& lhs, unique_ptr& rhs) {
@@ -2151,9 +2151,7 @@ namespace Catch {
21512151
auto analysis = Detail::analyse(*cfg, samples.data(), samples.data() + samples.size());
21522152
BenchmarkStats<> stats{ CATCH_MOVE(info), CATCH_MOVE(analysis.samples), analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance };
21532153
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 {
21572155
getResultCapture().benchmarkFailed(translateActiveException());
21582156
// We let the exception go further up so that the
21592157
// test case is marked as failed.
@@ -2566,11 +2564,17 @@ namespace Catch {
25662564

25672565
namespace Detail {
25682566

2567+
std::string makeExceptionHappenedString();
2568+
25692569
// This function dispatches all stringification requests inside of Catch.
25702570
// Should be preferably called fully qualified, like ::Catch::Detail::stringify
25712571
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(); }
25742578
}
25752579

25762580
template<typename E>
@@ -3053,17 +3057,19 @@ struct ratio_string<std::milli> {
30533057
template<typename Duration>
30543058
struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {
30553059
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 );
30573063

30583064
#ifdef _MSC_VER
30593065
std::tm timeInfo = {};
3060-
const auto err = gmtime_s(&timeInfo, &converted);
3066+
const auto err = gmtime_s( &timeInfo, &as_time_t );
30613067
if ( err ) {
30623068
return "gmtime from provided timepoint has failed. This "
30633069
"happens e.g. with pre-1970 dates using Microsoft libc";
30643070
}
30653071
#else
3066-
std::tm* timeInfo = std::gmtime(&converted);
3072+
std::tm* timeInfo = std::gmtime( &as_time_t );
30673073
#endif
30683074

30693075
auto const timeStampSize = sizeof("2017-01-16T17:06:45Z");
@@ -5238,10 +5244,11 @@ namespace Detail {
52385244
*
52395245
* 3) If a type has no linkage, we also cannot capture it by reference.
52405246
* 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.
52455252
*
52465253
* 4) To support C++20 and make the SFINAE on our decomposing operators
52475254
* work, the SFINAE has to happen in return type, rather than in
@@ -5293,13 +5300,22 @@ namespace Catch {
52935300
using RemoveCVRef_t = std::remove_cv_t<std::remove_reference_t<T>>;
52945301
}
52955302

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.
53005314
template <typename T>
53015315
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> {};
53035319

53045320
#if defined( CATCH_CONFIG_CPP20_COMPARE_OVERLOADS )
53055321
template <>
@@ -6241,9 +6257,13 @@ namespace Catch {
62416257
__assume( false );
62426258
# elif defined( __GNUC__ )
62436259
__builtin_unreachable();
6260+
# else // vv platform without known optimization hint
6261+
std::terminate();
62446262
# endif
6245-
# endif // ^^ NDEBUG
6263+
# else // ^^ NDEBUG
6264+
// For non-release builds, we prefer termination on bug over UB
62466265
std::terminate();
6266+
# endif //
62476267
}
62486268

62496269
} // namespace Detail
@@ -7447,7 +7467,7 @@ namespace Catch {
74477467

74487468
#define CATCH_VERSION_MAJOR 3
74497469
#define CATCH_VERSION_MINOR 9
7450-
#define CATCH_VERSION_PATCH 0
7470+
#define CATCH_VERSION_PATCH 1
74517471

74527472
#endif // CATCH_VERSION_MACROS_HPP_INCLUDED
74537473

@@ -9500,6 +9520,17 @@ namespace Catch {
95009520
bool isDebuggerActive();
95019521
}
95029522

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
95039534
#ifdef CATCH_PLATFORM_MAC
95049535

95059536
#if defined(__i386__) || defined(__x86_64__)
@@ -9535,15 +9566,15 @@ namespace Catch {
95359566

95369567
#define CATCH_TRAP() raise(SIGTRAP)
95379568
#endif
9538-
#elif defined(_MSC_VER)
9539-
#define CATCH_TRAP() __debugbreak()
95409569
#elif defined(__MINGW32__)
95419570
extern "C" __declspec(dllimport) void __stdcall DebugBreak();
95429571
#define CATCH_TRAP() DebugBreak()
95439572
#endif
9573+
#endif // ^^ CATCH_TRAP is not defined yet, so we define it
9574+
95449575

9545-
#ifndef CATCH_BREAK_INTO_DEBUGGER
9546-
#ifdef CATCH_TRAP
9576+
#if !defined(CATCH_BREAK_INTO_DEBUGGER)
9577+
#if defined(CATCH_TRAP)
95479578
#define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }()
95489579
#else
95499580
#define CATCH_BREAK_INTO_DEBUGGER() []{}()

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
project(
99
'catch2',
1010
'cpp',
11-
version: '3.9.0', # CML version placeholder, don't delete
11+
version: '3.9.1', # CML version placeholder, don't delete
1212
license: 'BSL-1.0',
1313
meson_version: '>=0.54.1',
1414
)

src/catch2/catch_version.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace Catch {
3636
}
3737

3838
Version const& libraryVersion() {
39-
static Version version( 3, 9, 0, "", 0 );
39+
static Version version( 3, 9, 1, "", 0 );
4040
return version;
4141
}
4242

src/catch2/catch_version_macros.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
#define CATCH_VERSION_MAJOR 3
1212
#define CATCH_VERSION_MINOR 9
13-
#define CATCH_VERSION_PATCH 0
13+
#define CATCH_VERSION_PATCH 1
1414

1515
#endif // CATCH_VERSION_MACROS_HPP_INCLUDED

0 commit comments

Comments
 (0)