From 6179728c0a1c3f36cbb451e7a305182c9a044e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hana=20Dusi=CC=81kova=CC=81?= Date: Sat, 17 Jan 2026 14:11:02 +0100 Subject: [PATCH 1/2] Silence warning -Wconversion in GCC 15.2 --- src/catch2/reporters/catch_reporter_helpers.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/catch2/reporters/catch_reporter_helpers.cpp b/src/catch2/reporters/catch_reporter_helpers.cpp index c710ac43ce..59a3a19fe6 100644 --- a/src/catch2/reporters/catch_reporter_helpers.cpp +++ b/src/catch2/reporters/catch_reporter_helpers.cpp @@ -205,7 +205,8 @@ namespace Catch { for ( auto const& tagCount : tags ) { ReusableStringStream rss; - rss << " " << std::setw( maxTagCountLen ) << tagCount.count << " "; + rss << " " << std::setw( static_cast( maxTagCountLen ) ) + << tagCount.count << " "; auto str = rss.str(); auto wrapper = TextFlow::Column( tagCount.all() ) .initialIndent( 0 ) From 4f2d75d34cf69b3ae1fe66d548e3734482663882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hana=20Dusi=CC=81kova=CC=81?= Date: Sat, 17 Jan 2026 15:05:16 +0100 Subject: [PATCH 2/2] Silence warning -Wsign-conversion in Clang 21.1.8 --- src/catch2/catch_timer.cpp | 5 ++++- src/catch2/internal/catch_run_context.cpp | 2 +- src/catch2/internal/catch_test_case_info_hasher.cpp | 6 +++--- src/catch2/reporters/catch_reporter_console.cpp | 3 ++- src/catch2/reporters/catch_reporter_multi.cpp | 4 +++- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/catch2/catch_timer.cpp b/src/catch2/catch_timer.cpp index efdd8b7d0c..da2270f531 100644 --- a/src/catch2/catch_timer.cpp +++ b/src/catch2/catch_timer.cpp @@ -13,7 +13,10 @@ namespace Catch { namespace { static auto getCurrentNanosecondsSinceEpoch() -> uint64_t { - return std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); + return static_cast( + std::chrono::duration_cast( + std::chrono::steady_clock::now().time_since_epoch() ) + .count() ); } } // end unnamed namespace diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index 5e5f95a4bb..d97e0bdce5 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -278,7 +278,7 @@ namespace Catch { m_config(_config), m_reporter(CATCH_MOVE(reporter)), m_outputRedirect( makeOutputRedirect( m_reporter->getPreferences().shouldRedirectStdOut ) ), - m_abortAfterXFailedAssertions( m_config->abortAfter() ), + m_abortAfterXFailedAssertions( static_cast(m_config->abortAfter()) ), m_reportAssertionStarting( m_reporter->getPreferences().shouldReportAllAssertionStarts ), m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ), m_shouldDebugBreak( m_config->shouldDebugBreak() ) diff --git a/src/catch2/internal/catch_test_case_info_hasher.cpp b/src/catch2/internal/catch_test_case_info_hasher.cpp index e1731ebe8b..9bc284eafb 100644 --- a/src/catch2/internal/catch_test_case_info_hasher.cpp +++ b/src/catch2/internal/catch_test_case_info_hasher.cpp @@ -17,16 +17,16 @@ namespace Catch { const hash_t prime = 1099511628211u; hash_t hash = 14695981039346656037u; for ( const char c : t.name ) { - hash ^= c; + hash ^= static_cast( c ); hash *= prime; } for ( const char c : t.className ) { - hash ^= c; + hash ^= static_cast( c ); hash *= prime; } for ( const Tag& tag : t.tags ) { for ( const char c : tag.original ) { - hash ^= c; + hash ^= static_cast( c ); hash *= prime; } } diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp index acb4ae8e72..23e4748610 100644 --- a/src/catch2/reporters/catch_reporter_console.cpp +++ b/src/catch2/reporters/catch_reporter_console.cpp @@ -354,7 +354,8 @@ class TablePrinter { } tp.m_currentColumn++; - auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; + auto colInfo = + tp.m_columnInfos[static_cast( tp.m_currentColumn )]; auto padding = (strSize + 1 < colInfo.width) ? std::string(colInfo.width - (strSize + 1), ' ') : std::string(); diff --git a/src/catch2/reporters/catch_reporter_multi.cpp b/src/catch2/reporters/catch_reporter_multi.cpp index 6bf9bcbd53..b93a847c82 100644 --- a/src/catch2/reporters/catch_reporter_multi.cpp +++ b/src/catch2/reporters/catch_reporter_multi.cpp @@ -25,7 +25,9 @@ namespace Catch { void MultiReporter::addListener( IEventListenerPtr&& listener ) { updatePreferences(*listener); - m_reporterLikes.insert(m_reporterLikes.begin() + m_insertedListeners, CATCH_MOVE(listener) ); + m_reporterLikes.insert( m_reporterLikes.begin() + + static_cast( m_insertedListeners ), + CATCH_MOVE( listener ) ); ++m_insertedListeners; }