From 74539aa7c6c695b9f8e13d80ac796aace303c391 Mon Sep 17 00:00:00 2001 From: Morwenn Date: Sun, 5 Jun 2022 19:14:52 +0200 Subject: [PATCH 1/3] GCC5 compat: work around inherited constructor issues Don't use inherited constructors, forward manually instead. This basically reverts 61f803126d3cff2195d700d11d07c6578f416b23. I believe that GCC5 does not implement P0136, a C++17 change that made inherited constructors actually usable and was backported as a DR all the way to C++11. --- src/catch2/reporters/catch_reporter_automake.hpp | 6 +++++- src/catch2/reporters/catch_reporter_cumulative_base.hpp | 6 +++++- src/catch2/reporters/catch_reporter_streaming_base.hpp | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/catch2/reporters/catch_reporter_automake.hpp b/src/catch2/reporters/catch_reporter_automake.hpp index cd85e6bfcc..68ca3dbd5e 100644 --- a/src/catch2/reporters/catch_reporter_automake.hpp +++ b/src/catch2/reporters/catch_reporter_automake.hpp @@ -8,7 +8,9 @@ #ifndef CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED #define CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED +#include #include +#include #include @@ -16,7 +18,9 @@ namespace Catch { class AutomakeReporter final : public StreamingReporterBase { public: - using StreamingReporterBase::StreamingReporterBase; + AutomakeReporter(ReporterConfig&& _config): + StreamingReporterBase(CATCH_MOVE(_config)) + {} ~AutomakeReporter() override; static std::string getDescription() { diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.hpp b/src/catch2/reporters/catch_reporter_cumulative_base.hpp index 742eaac979..fd22daa859 100644 --- a/src/catch2/reporters/catch_reporter_cumulative_base.hpp +++ b/src/catch2/reporters/catch_reporter_cumulative_base.hpp @@ -8,7 +8,9 @@ #ifndef CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED #define CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED +#include #include +#include #include #include @@ -88,7 +90,9 @@ namespace Catch { using TestCaseNode = Node; using TestRunNode = Node; - using ReporterBase::ReporterBase; + CumulativeReporterBase(ReporterConfig&& _config): + ReporterBase(CATCH_MOVE(_config)) + {} ~CumulativeReporterBase() override; void benchmarkPreparing( StringRef ) override {} diff --git a/src/catch2/reporters/catch_reporter_streaming_base.hpp b/src/catch2/reporters/catch_reporter_streaming_base.hpp index 5088bd0b77..76886c363e 100644 --- a/src/catch2/reporters/catch_reporter_streaming_base.hpp +++ b/src/catch2/reporters/catch_reporter_streaming_base.hpp @@ -8,7 +8,9 @@ #ifndef CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED #define CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED +#include #include +#include #include @@ -16,7 +18,9 @@ namespace Catch { class StreamingReporterBase : public ReporterBase { public: - using ReporterBase::ReporterBase; + StreamingReporterBase(ReporterConfig&& _config): + ReporterBase(CATCH_MOVE(_config)) + {} ~StreamingReporterBase() override; void benchmarkPreparing( StringRef ) override {} From 4ec8b2affc28bb59bcc5aa58d9aa193cfdaf76c0 Mon Sep 17 00:00:00 2001 From: Morwenn Date: Sun, 5 Jun 2022 19:44:03 +0200 Subject: [PATCH 2/3] GCC5 compat: bypass std::pair construction issue --- src/catch2/internal/catch_reporter_spec_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/catch2/internal/catch_reporter_spec_parser.cpp b/src/catch2/internal/catch_reporter_spec_parser.cpp index 28b2088ac4..30ee191c59 100644 --- a/src/catch2/internal/catch_reporter_spec_parser.cpp +++ b/src/catch2/internal/catch_reporter_spec_parser.cpp @@ -126,7 +126,7 @@ namespace Catch { return {}; } - auto ret = kvPairs.emplace( kv.key, kv.value ); + auto ret = kvPairs.emplace( std::string(kv.key), std::string(kv.value) ); if ( !ret.second ) { // Duplicated key. We might want to handle this differently, // e.g. by overwriting the existing value? From 0ed85c60e1292d532b167ab11c8add01a33949c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Tue, 7 Jun 2022 18:40:48 +0200 Subject: [PATCH 3/3] Apply suggestions from code review --- src/catch2/reporters/catch_reporter_automake.hpp | 2 ++ src/catch2/reporters/catch_reporter_cumulative_base.hpp | 2 ++ src/catch2/reporters/catch_reporter_streaming_base.hpp | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/catch2/reporters/catch_reporter_automake.hpp b/src/catch2/reporters/catch_reporter_automake.hpp index 68ca3dbd5e..bf18fddf7d 100644 --- a/src/catch2/reporters/catch_reporter_automake.hpp +++ b/src/catch2/reporters/catch_reporter_automake.hpp @@ -18,6 +18,8 @@ namespace Catch { class AutomakeReporter final : public StreamingReporterBase { public: + // GCC5 compat: we cannot use inherited constructor, because it + // doesn't implement backport of P0136 AutomakeReporter(ReporterConfig&& _config): StreamingReporterBase(CATCH_MOVE(_config)) {} diff --git a/src/catch2/reporters/catch_reporter_cumulative_base.hpp b/src/catch2/reporters/catch_reporter_cumulative_base.hpp index fd22daa859..c4dcdae036 100644 --- a/src/catch2/reporters/catch_reporter_cumulative_base.hpp +++ b/src/catch2/reporters/catch_reporter_cumulative_base.hpp @@ -90,6 +90,8 @@ namespace Catch { using TestCaseNode = Node; using TestRunNode = Node; + // GCC5 compat: we cannot use inherited constructor, because it + // doesn't implement backport of P0136 CumulativeReporterBase(ReporterConfig&& _config): ReporterBase(CATCH_MOVE(_config)) {} diff --git a/src/catch2/reporters/catch_reporter_streaming_base.hpp b/src/catch2/reporters/catch_reporter_streaming_base.hpp index 76886c363e..76788d8d5c 100644 --- a/src/catch2/reporters/catch_reporter_streaming_base.hpp +++ b/src/catch2/reporters/catch_reporter_streaming_base.hpp @@ -18,6 +18,8 @@ namespace Catch { class StreamingReporterBase : public ReporterBase { public: + // GCC5 compat: we cannot use inherited constructor, because it + // doesn't implement backport of P0136 StreamingReporterBase(ReporterConfig&& _config): ReporterBase(CATCH_MOVE(_config)) {}