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

Anchor some Clara vtables into the cpp file

Anchoring the vtables does 2 things
1) Fixes some instances of `-Wweak-vtables`
2) Decreases code size and linker pressure

However, there are still some unanchored ones, and thus we have
to keep suppressing `-Wweak-vtables` warning for Clang.
Commit
24559493bfa5ac5f120aacee7bd4a26c9c130863
Author
Martin Hořeňovský ·
Parents
7500ad1ffdbe

Files · Download .tar.gz

Changes

 src/catch2/internal/catch_clara.cpp | 12 +++++++++++-
 src/catch2/internal/catch_clara.hpp | 19 ++++++++++++-------
 2 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/catch2/internal/catch_clara.cpp b/src/catch2/internal/catch_clara.cpp
index 1c03b641..6c7a4c89 100644
--- a/src/catch2/internal/catch_clara.cpp
+++ b/src/catch2/internal/catch_clara.cpp
@@ -111,6 +111,8 @@ namespace Catch {
                 return ParserResult::ok( ParseResultType::Matched );
             }
 
+            size_t ParserBase::cardinality() const { return 1; }
+
             InternalParseResult ParserBase::parse( Args const& args ) const {
                 return parse( args.exeName(), TokenStream( args ) );
             }
@@ -124,7 +126,15 @@ namespace Catch {
                 return ParserResult::ok( ParseResultType::Matched );
             }
 
-        } // namespace Detail
+            ResultBase::~ResultBase() = default;
+
+            bool BoundRef::isContainer() const { return false; }
+
+            bool BoundRef::isFlag() const { return false; }
+
+            bool BoundFlagRefBase::isFlag() const { return true; }
+
+} // namespace Detail
 
         Detail::InternalParseResult Arg::parse(std::string const&,
                                                Detail::TokenStream const& tokens) const {
diff --git a/src/catch2/internal/catch_clara.hpp b/src/catch2/internal/catch_clara.hpp
index e1a8cbce..d166e2cc 100644
--- a/src/catch2/internal/catch_clara.hpp
+++ b/src/catch2/internal/catch_clara.hpp
@@ -132,7 +132,13 @@ namespace Catch {
             class ResultBase {
             protected:
                 ResultBase( ResultType type ): m_type( type ) {}
-                virtual ~ResultBase() = default;
+                virtual ~ResultBase(); // = default;
+
+
+                ResultBase(ResultBase const&) = default;
+                ResultBase& operator=(ResultBase const&) = default;
+                ResultBase(ResultBase&&) = default;
+                ResultBase& operator=(ResultBase&&) = default;
 
                 virtual void enforceOk() const = 0;
 
@@ -295,8 +301,8 @@ namespace Catch {
 
             struct BoundRef : Catch::Detail::NonCopyable {
                 virtual ~BoundRef() = default;
-                virtual auto isContainer() const -> bool { return false; }
-                virtual auto isFlag() const -> bool { return false; }
+                virtual bool isContainer() const;
+                virtual bool isFlag() const;
             };
             struct BoundValueRefBase : BoundRef {
                 virtual auto setValue( std::string const& arg )
@@ -304,7 +310,7 @@ namespace Catch {
             };
             struct BoundFlagRefBase : BoundRef {
                 virtual auto setFlag( bool flag ) -> ParserResult = 0;
-                bool isFlag() const override { return true; }
+                bool isFlag() const override;
             };
 
             template <typename T> struct BoundValueRef : BoundValueRefBase {
@@ -312,8 +318,7 @@ namespace Catch {
 
                 explicit BoundValueRef( T& ref ): m_ref( ref ) {}
 
-                auto setValue( std::string const& arg )
-                    -> ParserResult override {
+                ParserResult setValue( std::string const& arg ) override {
                     return convertInto( arg, m_ref );
                 }
             };
@@ -419,7 +424,7 @@ namespace Catch {
                 virtual auto parse( std::string const& exeName,
                                     TokenStream const& tokens ) const
                     -> InternalParseResult = 0;
-                virtual auto cardinality() const -> size_t { return 1; }
+                virtual size_t cardinality() const;
 
                 InternalParseResult parse( Args const& args ) const;
             };