Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2026-04-02 22:58:33 +0200
committerMartin Hořeňovský2026-04-03 10:19:05 +0200
commit9f1b48a94fdc7a54aa87fc9bd26d6b1b3f560d4c (patch)
tree1b855cdbffa4268957d8e8d7dffb5ff9df77e455 /src
parentf4e83daa184595cee80a8d37f145cb5d6b9b21ba (diff)
downloadcatch3-9f1b48a94fdc7a54aa87fc9bd26d6b1b3f560d4c.tar.gz
Inline SKIP/FAIL in RunContext to fix build failure with prefixed macros
Closes #3087
Diffstat (limited to 'src')
-rw-r--r--src/catch2/internal/catch_run_context.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp
index 93bcdf66..fd4b7a38 100644
--- a/src/catch2/internal/catch_run_context.cpp
+++ b/src/catch2/internal/catch_run_context.cpp
@@ -60,9 +60,14 @@ namespace Catch {
// can be, so the tracker has to throw for a wrong
// filter to stop the execution flow.
if (filter.type == PathFilter::For::Section) {
- // TBD: Explicit SKIP, or new exception that says
- // "don't continue", but doesn't show in totals?
- SKIP();
+ // We want the semantics of `SKIP()`, but we inline it
+ // to avoid issues with conditionally prefixed macros
+ INTERNAL_CATCH_MSG(
+ "SKIP",
+ Catch::ResultWas::ExplicitSkip,
+ Catch::ResultDisposition::Normal,
+ "" );
+ Catch::Detail::Unreachable();
}
// '*' is the wildcard for "all elements in generator"
// used for filtering sections below the generator, but
@@ -519,8 +524,12 @@ namespace Catch {
// TBD: Do we want to avoid the warning if the generator is filtered?
if ( m_config->warnAboutInfiniteGenerators() &&
!generator->isFinite() ) {
- // TBD: Would it be better to expand this macro inline?
- FAIL( "GENERATE() would run infinitely" );
+ // We want the semantics of `FAIL()`, but we inline it
+ // to avoid issues with conditionally prefixed macros
+ INTERNAL_CATCH_MSG( "FAIL",
+ Catch::ResultWas::ExplicitFailure,
+ Catch::ResultDisposition::Normal,
+ "GENERATE() would run infinitely" );
}
auto nameAndLoc = TestCaseTracking::NameAndLocation( static_cast<std::string>( generatorName ), lineInfo );