diff --git a/src/catch2/benchmark/detail/catch_benchmark_function.hpp b/src/catch2/benchmark/detail/catch_benchmark_function.hpp index 90b07b76..1f9ae9fb 100644 --- a/src/catch2/benchmark/detail/catch_benchmark_function.hpp +++ b/src/catch2/benchmark/detail/catch_benchmark_function.hpp @@ -41,7 +41,7 @@ namespace Catch { callable& operator=(callable&&) = default; }; template - struct model : public callable { + struct model final : public callable { model(Fun&& fun_) : fun(CATCH_MOVE(fun_)) {} model(Fun const& fun_) : fun(fun_) {} diff --git a/src/catch2/benchmark/detail/catch_run_for_at_least.cpp b/src/catch2/benchmark/detail/catch_run_for_at_least.cpp index 3ebdcc05..82999149 100644 --- a/src/catch2/benchmark/detail/catch_run_for_at_least.cpp +++ b/src/catch2/benchmark/detail/catch_run_for_at_least.cpp @@ -14,7 +14,7 @@ namespace Catch { namespace Benchmark { namespace Detail { - struct optimized_away_error : std::exception { + struct optimized_away_error final : std::exception { const char* what() const noexcept override; }; diff --git a/src/catch2/catch_translate_exception.hpp b/src/catch2/catch_translate_exception.hpp index 4d3bac65..a1f3faa5 100644 --- a/src/catch2/catch_translate_exception.hpp +++ b/src/catch2/catch_translate_exception.hpp @@ -22,7 +22,7 @@ namespace Catch { class ExceptionTranslatorRegistrar { template - class ExceptionTranslator : public IExceptionTranslator { + class ExceptionTranslator final : public IExceptionTranslator { public: constexpr ExceptionTranslator( std::string(*translateFunction)( T const& ) ) diff --git a/src/catch2/internal/catch_decomposer.hpp b/src/catch2/internal/catch_decomposer.hpp index fcc017dd..ff628482 100644 --- a/src/catch2/internal/catch_decomposer.hpp +++ b/src/catch2/internal/catch_decomposer.hpp @@ -193,7 +193,7 @@ namespace Catch { void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ); template - class BinaryExpr : public ITransientExpression { + class BinaryExpr final : public ITransientExpression { LhsT m_lhs; StringRef m_op; RhsT m_rhs; @@ -269,7 +269,7 @@ namespace Catch { }; template - class UnaryExpr : public ITransientExpression { + class UnaryExpr final : public ITransientExpression { LhsT m_lhs; void streamReconstructedExpression( std::ostream &os ) const override { diff --git a/src/catch2/internal/catch_enum_values_registry.hpp b/src/catch2/internal/catch_enum_values_registry.hpp index de994c35..7b5e7a72 100644 --- a/src/catch2/internal/catch_enum_values_registry.hpp +++ b/src/catch2/internal/catch_enum_values_registry.hpp @@ -20,7 +20,7 @@ namespace Catch { Catch::Detail::unique_ptr makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ); - class EnumValuesRegistry : public IMutableEnumValuesRegistry { + class EnumValuesRegistry final : public IMutableEnumValuesRegistry { std::vector> m_enumInfos; diff --git a/src/catch2/internal/catch_exception_translator_registry.hpp b/src/catch2/internal/catch_exception_translator_registry.hpp index 32917d41..d00fdd25 100644 --- a/src/catch2/internal/catch_exception_translator_registry.hpp +++ b/src/catch2/internal/catch_exception_translator_registry.hpp @@ -15,7 +15,7 @@ namespace Catch { - class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { + class ExceptionTranslatorRegistry final : public IExceptionTranslatorRegistry { public: ~ExceptionTranslatorRegistry() override; void registerTranslator( Detail::unique_ptr&& translator ); diff --git a/src/catch2/internal/catch_output_redirect.cpp b/src/catch2/internal/catch_output_redirect.cpp index 245e1376..0ea126a5 100644 --- a/src/catch2/internal/catch_output_redirect.cpp +++ b/src/catch2/internal/catch_output_redirect.cpp @@ -33,7 +33,7 @@ namespace Catch { namespace { //! A no-op implementation, used if no reporter wants output //! redirection. - class NoopRedirect : public OutputRedirect { + class NoopRedirect final : public OutputRedirect { void activateImpl() override {} void deactivateImpl() override {} std::string getStdout() override { return {}; } @@ -70,7 +70,7 @@ namespace Catch { * Redirects the `std::cout`, `std::cerr`, `std::clog` streams, * but does not touch the actual `stdout`/`stderr` file descriptors. */ - class StreamRedirect : public OutputRedirect { + class StreamRedirect final : public OutputRedirect { ReusableStringStream m_redirectedOut, m_redirectedErr; RedirectedStreamNew m_cout, m_cerr, m_clog; @@ -181,7 +181,7 @@ namespace Catch { * Works by replacing the file descriptors numbered 1 and 2 * with an open temporary file. */ - class FileRedirect : public OutputRedirect { + class FileRedirect final : public OutputRedirect { TempFile m_outFile, m_errFile; int m_originalOut = -1; int m_originalErr = -1; diff --git a/src/catch2/internal/catch_singletons.hpp b/src/catch2/internal/catch_singletons.hpp index a28a13da..74dc6bb0 100644 --- a/src/catch2/internal/catch_singletons.hpp +++ b/src/catch2/internal/catch_singletons.hpp @@ -20,7 +20,7 @@ namespace Catch { template - class Singleton : SingletonImplT, public ISingleton { + class Singleton final : SingletonImplT, public ISingleton { static auto getInternal() -> Singleton* { static Singleton* s_instance = nullptr; diff --git a/src/catch2/internal/catch_tag_alias_registry.hpp b/src/catch2/internal/catch_tag_alias_registry.hpp index 64c0f8f3..a359b495 100644 --- a/src/catch2/internal/catch_tag_alias_registry.hpp +++ b/src/catch2/internal/catch_tag_alias_registry.hpp @@ -17,7 +17,7 @@ namespace Catch { struct SourceLineInfo; - class TagAliasRegistry : public ITagAliasRegistry { + class TagAliasRegistry final : public ITagAliasRegistry { public: ~TagAliasRegistry() override; TagAlias const* find( std::string const& alias ) const override; diff --git a/src/catch2/internal/catch_test_case_registry_impl.hpp b/src/catch2/internal/catch_test_case_registry_impl.hpp index fbca89f9..52c16732 100644 --- a/src/catch2/internal/catch_test_case_registry_impl.hpp +++ b/src/catch2/internal/catch_test_case_registry_impl.hpp @@ -28,7 +28,7 @@ namespace Catch { std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); std::vector const& getAllTestCasesSorted( IConfig const& config ); - class TestRegistry : public ITestCaseRegistry { + class TestRegistry final : public ITestCaseRegistry { public: void registerTest( Detail::unique_ptr testInfo, Detail::unique_ptr testInvoker ); diff --git a/src/catch2/matchers/internal/catch_matchers_impl.hpp b/src/catch2/matchers/internal/catch_matchers_impl.hpp index 24a3f8b6..1aa50385 100644 --- a/src/catch2/matchers/internal/catch_matchers_impl.hpp +++ b/src/catch2/matchers/internal/catch_matchers_impl.hpp @@ -29,7 +29,7 @@ namespace Catch { #endif template - class MatchExpr : public ITransientExpression { + class MatchExpr final : public ITransientExpression { ArgT && m_arg; MatcherT const& m_matcher; public: