Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Explicitly default smfs when relevant to avoid Wdeprecated-copy-dtor

Commit
03ef6b9f9af9c78f83607a90980a2b90118d501d
Author
Martin Hořeňovský ·
Parents
579dcd1a7663

Files · Download .tar.gz

Changes

 src/catch2/benchmark/catch_chronometer.hpp               |  4 ++++
 src/catch2/benchmark/detail/catch_benchmark_function.hpp |  4 ++++
 src/catch2/generators/catch_generators.hpp               |  4 ++++
 .../generators/internal/catch_generators_combined_tu.cpp |  4 ++--
 .../interfaces/catch_interfaces_generatortracker.hpp     | 16 +++++++++++-----
 src/catch2/internal/catch_decomposer.hpp                 |  6 +++++-
 src/catch2/matchers/catch_matchers.hpp                   |  5 +++++
 src/catch2/matchers/catch_matchers_templated.hpp         |  7 +++++++
 tests/SelfTest/UsageTests/Matchers.tests.cpp             |  4 ++--
 9 files changed, 44 insertions(+), 10 deletions(-)

diff --git a/src/catch2/benchmark/catch_chronometer.hpp b/src/catch2/benchmark/catch_chronometer.hpp
index 12dcee00..2c8705be 100644
--- a/src/catch2/benchmark/catch_chronometer.hpp
+++ b/src/catch2/benchmark/catch_chronometer.hpp
@@ -23,6 +23,10 @@ namespace Catch {
                 virtual void start() = 0;
                 virtual void finish() = 0;
                 virtual ~ChronometerConcept(); // = default;
+
+                ChronometerConcept() = default;
+                ChronometerConcept(ChronometerConcept const&) = default;
+                ChronometerConcept& operator=(ChronometerConcept const&) = default;
             };
             template <typename Clock>
             struct ChronometerModel final : public ChronometerConcept {
diff --git a/src/catch2/benchmark/detail/catch_benchmark_function.hpp b/src/catch2/benchmark/detail/catch_benchmark_function.hpp
index 5e86a154..03ef22a7 100644
--- a/src/catch2/benchmark/detail/catch_benchmark_function.hpp
+++ b/src/catch2/benchmark/detail/catch_benchmark_function.hpp
@@ -42,6 +42,10 @@ namespace Catch {
                     virtual void call(Chronometer meter) const = 0;
                     virtual callable* clone() const = 0;
                     virtual ~callable(); // = default;
+
+                    callable() = default;
+                    callable(callable const&) = default;
+                    callable& operator=(callable const&) = default;
                 };
                 template <typename Fun>
                 struct model : public callable {
diff --git a/src/catch2/generators/catch_generators.hpp b/src/catch2/generators/catch_generators.hpp
index b3db082b..e8c2a8fd 100644
--- a/src/catch2/generators/catch_generators.hpp
+++ b/src/catch2/generators/catch_generators.hpp
@@ -30,6 +30,10 @@ namespace Detail {
     template<typename T>
     struct IGenerator : GeneratorUntypedBase {
         ~IGenerator() override = default;
+        IGenerator() = default;
+        IGenerator(IGenerator const&) = default;
+        IGenerator& operator=(IGenerator const&) = default;
+
 
         // Returns the current element of the generator
         //
diff --git a/src/catch2/generators/internal/catch_generators_combined_tu.cpp b/src/catch2/generators/internal/catch_generators_combined_tu.cpp
index 84cf3707..f8b6ca4c 100644
--- a/src/catch2/generators/internal/catch_generators_combined_tu.cpp
+++ b/src/catch2/generators/internal/catch_generators_combined_tu.cpp
@@ -36,7 +36,7 @@ namespace Catch {
 
 namespace Catch {
 
-IGeneratorTracker::~IGeneratorTracker() {}
+    IGeneratorTracker::~IGeneratorTracker() = default;
 
 namespace Generators {
 
@@ -48,7 +48,7 @@ namespace Detail {
     }
 } // end namespace Detail
 
-    GeneratorUntypedBase::~GeneratorUntypedBase() {}
+    GeneratorUntypedBase::~GeneratorUntypedBase() = default;
 
     auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
         return getResultCapture().acquireGeneratorTracker( lineInfo );
diff --git a/src/catch2/interfaces/catch_interfaces_generatortracker.hpp b/src/catch2/interfaces/catch_interfaces_generatortracker.hpp
index c1b1391f..fa08be0c 100644
--- a/src/catch2/interfaces/catch_interfaces_generatortracker.hpp
+++ b/src/catch2/interfaces/catch_interfaces_generatortracker.hpp
@@ -16,11 +16,17 @@ namespace Catch {
         class GeneratorUntypedBase {
         public:
             GeneratorUntypedBase() = default;
-            virtual ~GeneratorUntypedBase();
+            // Generation of copy ops is deprecated (and Clang will complain)
+            // if there is a user destructor defined
+            GeneratorUntypedBase(GeneratorUntypedBase const&) = default;
+            GeneratorUntypedBase& operator=(GeneratorUntypedBase const&) = default;
+
+            virtual ~GeneratorUntypedBase(); // = default;
+
             // Attempts to move the generator to the next element
-             //
-             // Returns true iff the move succeeded (and a valid element
-             // can be retrieved).
+            //
+            // Returns true iff the move succeeded (and a valid element
+            // can be retrieved).
             virtual bool next() = 0;
         };
         using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>;
@@ -28,7 +34,7 @@ namespace Catch {
     } // namespace Generators
 
     struct IGeneratorTracker {
-        virtual ~IGeneratorTracker();
+        virtual ~IGeneratorTracker(); // = default;
         virtual auto hasGenerator() const -> bool = 0;
         virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;
         virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;
diff --git a/src/catch2/internal/catch_decomposer.hpp b/src/catch2/internal/catch_decomposer.hpp
index dc1c2d6b..94995bd2 100644
--- a/src/catch2/internal/catch_decomposer.hpp
+++ b/src/catch2/internal/catch_decomposer.hpp
@@ -43,9 +43,13 @@ namespace Catch {
             m_result( result )
         {}
 
+        ITransientExpression() = default;
+        ITransientExpression(ITransientExpression const&) = default;
+        ITransientExpression& operator=(ITransientExpression const&) = default;
+
         // We don't actually need a virtual destructor, but many static analysers
         // complain if it's not here :-(
-        virtual ~ITransientExpression();
+        virtual ~ITransientExpression(); // = default;
 
         bool m_isBinaryExpression;
         bool m_result;
diff --git a/src/catch2/matchers/catch_matchers.hpp b/src/catch2/matchers/catch_matchers.hpp
index 3d16bc56..0d093e0c 100644
--- a/src/catch2/matchers/catch_matchers.hpp
+++ b/src/catch2/matchers/catch_matchers.hpp
@@ -17,8 +17,13 @@ namespace Matchers {
     class MatcherUntypedBase {
     public:
         MatcherUntypedBase() = default;
+
         MatcherUntypedBase(MatcherUntypedBase const&) = default;
+        MatcherUntypedBase(MatcherUntypedBase&&) = default;
+
         MatcherUntypedBase& operator = (MatcherUntypedBase const&) = delete;
+        MatcherUntypedBase& operator = (MatcherUntypedBase&&) = delete;
+
         std::string toString() const;
 
     protected:
diff --git a/src/catch2/matchers/catch_matchers_templated.hpp b/src/catch2/matchers/catch_matchers_templated.hpp
index 34bef90e..89c85fcc 100644
--- a/src/catch2/matchers/catch_matchers_templated.hpp
+++ b/src/catch2/matchers/catch_matchers_templated.hpp
@@ -18,7 +18,14 @@
 namespace Catch {
 namespace Matchers {
     struct MatcherGenericBase : MatcherUntypedBase {
+        MatcherGenericBase() = default;
         virtual ~MatcherGenericBase(); // = default;
+
+        MatcherGenericBase(MatcherGenericBase&) = default;
+        MatcherGenericBase(MatcherGenericBase&&) = default;
+
+        MatcherGenericBase& operator=(MatcherGenericBase const&) = delete;
+        MatcherGenericBase& operator=(MatcherGenericBase&&) = delete;
     };
 
 
diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp
index 4736b563..f8c9ed1d 100644
--- a/tests/SelfTest/UsageTests/Matchers.tests.cpp
+++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp
@@ -893,11 +893,11 @@ namespace { namespace MatchersTests {
     struct ThrowOnCopyOrMoveMatcher : Catch::Matchers::MatcherGenericBase {
         ThrowOnCopyOrMoveMatcher() = default;
         [[noreturn]]
-        ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher const&) {
+        ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher const&): Catch::Matchers::MatcherGenericBase() {
             throw MatcherWasMovedOrCopied();
         }
         [[noreturn]]
-        ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher &&) {
+        ThrowOnCopyOrMoveMatcher(ThrowOnCopyOrMoveMatcher &&): Catch::Matchers::MatcherGenericBase() {
             throw MatcherWasMovedOrCopied();
         }
         ThrowOnCopyOrMoveMatcher& operator=(ThrowOnCopyOrMoveMatcher const&) {