diff --git a/CMakeLists.txt b/CMakeLists.txt index 92a9d5f9..c8a17f18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,16 +85,9 @@ CheckFileList(TEST_SOURCES ${SELF_TEST_DIR}) set(SURROGATE_SOURCES ${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp ${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp - ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_capture.cpp - ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_config.cpp - ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_exception.cpp - ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_registry_hub.cpp ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp - ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_runner.cpp - ${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_testcase.cpp ${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp ${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp - ${SELF_TEST_DIR}/SurrogateCpps/catch_streambuf.cpp ${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp ${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp ${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp @@ -162,7 +155,7 @@ set(INTERNAL_HEADERS ${HEADER_DIR}/internal/catch_random_number_generator.h ${HEADER_DIR}/internal/catch_reenable_warnings.h ${HEADER_DIR}/internal/catch_reporter_registrars.hpp - ${HEADER_DIR}/internal/catch_reporter_registry.hpp + ${HEADER_DIR}/internal/catch_reporter_registry.h ${HEADER_DIR}/internal/catch_result_type.h ${HEADER_DIR}/internal/catch_run_context.h ${HEADER_DIR}/internal/catch_benchmark.h @@ -210,6 +203,12 @@ set(IMPL_SOURCES ${HEADER_DIR}/internal/catch_errno_guard.cpp ${HEADER_DIR}/internal/catch_exception_translator_registry.cpp ${HEADER_DIR}/internal/catch_fatal_condition.cpp + ${HEADER_DIR}/internal/catch_interfaces_capture.cpp + ${HEADER_DIR}/internal/catch_interfaces_config.cpp + ${HEADER_DIR}/internal/catch_interfaces_exception.cpp + ${HEADER_DIR}/internal/catch_interfaces_registry_hub.cpp + ${HEADER_DIR}/internal/catch_interfaces_runner.cpp + ${HEADER_DIR}/internal/catch_interfaces_testcase.cpp ${HEADER_DIR}/internal/catch_list.cpp ${HEADER_DIR}/internal/catch_leak_detector.cpp ${HEADER_DIR}/internal/catch_matchers.cpp @@ -218,6 +217,7 @@ set(IMPL_SOURCES ${HEADER_DIR}/internal/catch_registry_hub.cpp ${HEADER_DIR}/internal/catch_interfaces_reporter.cpp ${HEADER_DIR}/internal/catch_random_number_generator.cpp + ${HEADER_DIR}/internal/catch_reporter_registry.cpp ${HEADER_DIR}/internal/catch_result_type.cpp ${HEADER_DIR}/internal/catch_run_context.cpp ${HEADER_DIR}/internal/catch_section.cpp @@ -225,6 +225,7 @@ set(IMPL_SOURCES ${HEADER_DIR}/internal/catch_session.cpp ${HEADER_DIR}/internal/catch_startup_exception_registry.cpp ${HEADER_DIR}/internal/catch_stream.cpp + ${HEADER_DIR}/internal/catch_streambuf.cpp ${HEADER_DIR}/internal/catch_stringref.cpp ${HEADER_DIR}/internal/catch_string_manip.cpp ${HEADER_DIR}/internal/catch_tag_alias.cpp @@ -298,8 +299,13 @@ if (NOT NO_SELFTEST) # Add desired warnings if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" ) - target_compile_options( SelfTest PRIVATE -Wall -Wextra ) - target_compile_options( Benchmark PRIVATE -Wall -Wextra ) + target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code ) + target_compile_options( Benchmark PRIVATE -Wall -Wextra -Wunreachable-code ) + endif() + # Clang specific warning go here + if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) + # Actually keep these + target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn ) endif() if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX ) diff --git a/include/internal/catch_assertionresult.cpp b/include/internal/catch_assertionresult.cpp index ea416856..7a3a2e08 100644 --- a/include/internal/catch_assertionresult.cpp +++ b/include/internal/catch_assertionresult.cpp @@ -10,8 +10,8 @@ namespace Catch { AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression): - resultType(_resultType), - lazyExpression(_lazyExpression) {} + lazyExpression(_lazyExpression), + resultType(_resultType) {} std::string AssertionResultData::reconstructExpression() const { diff --git a/include/internal/catch_assertionresult.h b/include/internal/catch_assertionresult.h index 6a4b61f1..fa8e09f2 100644 --- a/include/internal/catch_assertionresult.h +++ b/include/internal/catch_assertionresult.h @@ -23,13 +23,12 @@ namespace Catch { AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression ); - ResultWas::OfType resultType; std::string message; - + mutable std::string reconstructedExpression; LazyExpression lazyExpression; + ResultWas::OfType resultType; std::string reconstructExpression() const; - mutable std::string reconstructedExpression; }; class AssertionResult { diff --git a/include/internal/catch_clara.h b/include/internal/catch_clara.h index abe7626b..bdf70250 100644 --- a/include/internal/catch_clara.h +++ b/include/internal/catch_clara.h @@ -16,9 +16,18 @@ #endif #define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1 +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#pragma clang diagnostic ignored "-Wexit-time-destructors" +#pragma clang diagnostic ignored "-Wshadow" +#endif #include "../external/clara.hpp" +#ifdef __clang__ +#pragma clang diagnostic pop +#endif // Restore Clara's value for console width, if present #ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH diff --git a/include/internal/catch_common.cpp b/include/internal/catch_common.cpp index 9c18b543..0f2f6eb4 100644 --- a/include/internal/catch_common.cpp +++ b/include/internal/catch_common.cpp @@ -46,4 +46,7 @@ namespace Catch { return std::string(); } + NonCopyable::NonCopyable() = default; + NonCopyable::~NonCopyable() = default; + } diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index 5e22825d..617a9343 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -36,8 +36,8 @@ namespace Catch { NonCopyable& operator = ( NonCopyable && ) = delete; protected: - NonCopyable() = default; - virtual ~NonCopyable() = default; + NonCopyable(); + virtual ~NonCopyable(); }; struct SourceLineInfo { diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h index 3bd40461..18cf9e01 100644 --- a/include/internal/catch_compiler_capabilities.h +++ b/include/internal/catch_compiler_capabilities.h @@ -35,11 +35,11 @@ #ifdef __clang__ - -# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ _Pragma( "clang diagnostic push" ) \ - _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) -# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \ + _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ + _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") +# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ _Pragma( "clang diagnostic pop" ) # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ @@ -111,9 +111,9 @@ # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS # define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS #endif -#if !defined(CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS) -# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS -# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS +#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS #endif diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index 23e1d1ed..fcaa0500 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -62,7 +62,6 @@ namespace Catch { class Config : public IConfig { - virtual void dummy(); public: Config() = default; diff --git a/include/internal/catch_console_colour.cpp b/include/internal/catch_console_colour.cpp index e33b8828..13290544 100644 --- a/include/internal/catch_console_colour.cpp +++ b/include/internal/catch_console_colour.cpp @@ -6,6 +6,13 @@ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + + #include "catch_console_colour.h" #include "catch_enforce.h" #include "catch_errno_guard.h" @@ -202,3 +209,8 @@ namespace Catch { } } // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + diff --git a/include/internal/catch_context.cpp b/include/internal/catch_context.cpp index 3d406dda..c917a1d4 100644 --- a/include/internal/catch_context.cpp +++ b/include/internal/catch_context.cpp @@ -24,6 +24,8 @@ namespace Catch { return m_config; } + virtual ~Context() override; + public: // IMutableContext virtual void setResultCapture( IResultCapture* resultCapture ) override { m_resultCapture = resultCapture; @@ -59,4 +61,7 @@ namespace Catch { delete currentContext; currentContext = nullptr; } + IContext::~IContext() = default; + IMutableContext::~IMutableContext() = default; + Context::~Context() = default; } diff --git a/include/internal/catch_context.h b/include/internal/catch_context.h index 5569eb71..c88236a9 100644 --- a/include/internal/catch_context.h +++ b/include/internal/catch_context.h @@ -20,7 +20,7 @@ namespace Catch { struct IContext { - virtual ~IContext() = default; + virtual ~IContext(); virtual IResultCapture* getResultCapture() = 0; virtual IRunner* getRunner() = 0; @@ -29,7 +29,7 @@ namespace Catch { struct IMutableContext : IContext { - virtual ~IMutableContext() = default; + virtual ~IMutableContext(); virtual void setResultCapture( IResultCapture* resultCapture ) = 0; virtual void setRunner( IRunner* runner ) = 0; virtual void setConfig( IConfigPtr const& config ) = 0; diff --git a/include/internal/catch_decomposer.cpp b/include/internal/catch_decomposer.cpp index f8b282dc..8c19629b 100644 --- a/include/internal/catch_decomposer.cpp +++ b/include/internal/catch_decomposer.cpp @@ -11,6 +11,8 @@ namespace Catch { + ITransientExpression::~ITransientExpression() = default; + void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { if( lhs.size() + rhs.size() < 40 && lhs.find('\n') == std::string::npos && diff --git a/include/internal/catch_decomposer.h b/include/internal/catch_decomposer.h index 5d4bb0d1..786a052e 100644 --- a/include/internal/catch_decomposer.h +++ b/include/internal/catch_decomposer.h @@ -30,7 +30,7 @@ namespace Catch { // We don't actually need a virtual destructore, but many static analysers // complain if it's not here :-( - virtual ~ITransientExpression() = default; + virtual ~ITransientExpression(); }; void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ); @@ -79,24 +79,24 @@ namespace Catch { template auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return lhs == rhs; }; template - auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); }; + auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } template - auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast( rhs ); }; + auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } template - auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; }; + auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } template - auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; }; + auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } template auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return lhs != rhs; }; template - auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); }; + auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } template - auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast( rhs ); }; + auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } template - auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; }; + auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } template - auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; }; + auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } template @@ -162,8 +162,4 @@ namespace Catch { } // end namespace Catch -#ifdef _MSC_VER -#pragma warning(pop) -#endif - #endif // TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED diff --git a/include/internal/catch_fatal_condition.cpp b/include/internal/catch_fatal_condition.cpp index be1c333e..39b63455 100644 --- a/include/internal/catch_fatal_condition.cpp +++ b/include/internal/catch_fatal_condition.cpp @@ -35,7 +35,7 @@ namespace Catch { // There is no 1-1 mapping between signals and windows exceptions. // Windows can easily distinguish between SO and SigSegV, // but SigInt, SigTerm, etc are handled differently. - SignalDefs signalDefs[] = { + static SignalDefs signalDefs[] = { { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" }, { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" }, { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" }, @@ -107,7 +107,7 @@ namespace Catch { int id; const char* name; }; - SignalDefs signalDefs[] = { + static SignalDefs signalDefs[] = { { SIGINT, "SIGINT - Terminal interrupt signal" }, { SIGILL, "SIGILL - Illegal instruction signal" }, { SIGFPE, "SIGFPE - Floating point error signal" }, diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp index ae512ce1..0b29a39f 100644 --- a/include/internal/catch_impl.hpp +++ b/include/internal/catch_impl.hpp @@ -8,39 +8,22 @@ #ifndef TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED #define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED -// Collect all the implementation files together here -// These are the equivalent of what would usually be cpp files - #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wweak-vtables" #endif - -#include "internal/catch_leak_detector.h" - +// Keep these here for external reporters #include "catch_test_spec.h" #include "catch_test_case_tracker.h" +#include "catch_leak_detector.h" + // Cpp files will be included in the single-header file here // ~*~* CATCH_CPP_STITCH_PLACE *~*~ namespace Catch { LeakDetector leakDetector; - - // These are all here to avoid warnings about not having any out of line - // virtual methods - IResultCapture::~IResultCapture() {} - ITestInvoker::~ITestInvoker() {} - ITestCaseRegistry::~ITestCaseRegistry() {} - IRegistryHub::~IRegistryHub() {} - IMutableRegistryHub::~IMutableRegistryHub() {} - IExceptionTranslator::~IExceptionTranslator() {} - IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() {} - IRunner::~IRunner() {} - IConfig::~IConfig() {} - - void Config::dummy() {} } #ifdef __clang__ diff --git a/include/internal/catch_interfaces_capture.cpp b/include/internal/catch_interfaces_capture.cpp new file mode 100644 index 00000000..3c090bfe --- /dev/null +++ b/include/internal/catch_interfaces_capture.cpp @@ -0,0 +1,5 @@ +#include "catch_interfaces_capture.h" + +namespace Catch { + IResultCapture::~IResultCapture() = default; +} diff --git a/include/internal/catch_interfaces_config.cpp b/include/internal/catch_interfaces_config.cpp new file mode 100644 index 00000000..b6f5daa2 --- /dev/null +++ b/include/internal/catch_interfaces_config.cpp @@ -0,0 +1,5 @@ +#include "internal/catch_interfaces_config.h" + +namespace Catch { + IConfig::~IConfig() = default; +} diff --git a/include/internal/catch_interfaces_exception.cpp b/include/internal/catch_interfaces_exception.cpp new file mode 100644 index 00000000..8494a2cc --- /dev/null +++ b/include/internal/catch_interfaces_exception.cpp @@ -0,0 +1,6 @@ +#include "internal/catch_interfaces_exception.h" + +namespace Catch { + IExceptionTranslator::~IExceptionTranslator() = default; + IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; +} diff --git a/include/internal/catch_interfaces_registry_hub.cpp b/include/internal/catch_interfaces_registry_hub.cpp new file mode 100644 index 00000000..bd5b8082 --- /dev/null +++ b/include/internal/catch_interfaces_registry_hub.cpp @@ -0,0 +1,6 @@ +#include "internal/catch_interfaces_registry_hub.h" + +namespace Catch { + IRegistryHub::~IRegistryHub() = default; + IMutableRegistryHub::~IMutableRegistryHub() = default; +} diff --git a/include/internal/catch_interfaces_reporter.cpp b/include/internal/catch_interfaces_reporter.cpp index c7b2e861..06e409ae 100644 --- a/include/internal/catch_interfaces_reporter.cpp +++ b/include/internal/catch_interfaces_reporter.cpp @@ -50,6 +50,8 @@ namespace Catch { } } + AssertionStats::~AssertionStats() = default; + SectionStats::SectionStats( SectionInfo const& _sectionInfo, Counts const& _assertions, double _durationInSeconds, @@ -60,6 +62,8 @@ namespace Catch { missingAssertions( _missingAssertions ) {} + SectionStats::~SectionStats() = default; + TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo, Totals const& _totals, @@ -73,6 +77,8 @@ namespace Catch { aborting( _aborting ) {} + TestCaseStats::~TestCaseStats() = default; + TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo, Totals const& _totals, @@ -87,6 +93,8 @@ namespace Catch { aborting( false ) {} + TestGroupStats::~TestGroupStats() = default; + TestRunStats::TestRunStats( TestRunInfo const& _runInfo, Totals const& _totals, bool _aborting ) @@ -95,9 +103,14 @@ namespace Catch { aborting( _aborting ) {} + TestRunStats::~TestRunStats() = default; + bool IStreamingReporter::isMulti() const { return false; } + IReporterFactory::~IReporterFactory() = default; + IReporterRegistry::~IReporterRegistry() = default; + void addReporter( IStreamingReporterPtr& existingReporter, IStreamingReporterPtr&& additionalReporter ) { if( !existingReporter ) { diff --git a/include/internal/catch_interfaces_reporter.h b/include/internal/catch_interfaces_reporter.h index d4fb9dbf..43beca68 100644 --- a/include/internal/catch_interfaces_reporter.h +++ b/include/internal/catch_interfaces_reporter.h @@ -80,7 +80,7 @@ namespace Catch { AssertionStats( AssertionStats && ) = default; AssertionStats& operator = ( AssertionStats const& ) = default; AssertionStats& operator = ( AssertionStats && ) = default; - virtual ~AssertionStats() = default; + virtual ~AssertionStats(); AssertionResult assertionResult; std::vector infoMessages; @@ -96,7 +96,7 @@ namespace Catch { SectionStats( SectionStats && ) = default; SectionStats& operator = ( SectionStats const& ) = default; SectionStats& operator = ( SectionStats && ) = default; - virtual ~SectionStats() = default; + virtual ~SectionStats(); SectionInfo sectionInfo; Counts assertions; @@ -115,7 +115,7 @@ namespace Catch { TestCaseStats( TestCaseStats && ) = default; TestCaseStats& operator = ( TestCaseStats const& ) = default; TestCaseStats& operator = ( TestCaseStats && ) = default; - virtual ~TestCaseStats() = default; + virtual ~TestCaseStats(); TestCaseInfo testInfo; Totals totals; @@ -134,7 +134,7 @@ namespace Catch { TestGroupStats( TestGroupStats && ) = default; TestGroupStats& operator = ( TestGroupStats const& ) = default; TestGroupStats& operator = ( TestGroupStats && ) = default; - virtual ~TestGroupStats() = default; + virtual ~TestGroupStats(); GroupInfo groupInfo; Totals totals; @@ -150,7 +150,7 @@ namespace Catch { TestRunStats( TestRunStats && ) = default; TestRunStats& operator = ( TestRunStats const& ) = default; TestRunStats& operator = ( TestRunStats && ) = default; - virtual ~TestRunStats() = default; + virtual ~TestRunStats(); TestRunInfo runInfo; Totals totals; @@ -206,7 +206,7 @@ namespace Catch { using IStreamingReporterPtr = std::unique_ptr; struct IReporterFactory { - virtual ~IReporterFactory() = default; + virtual ~IReporterFactory(); virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0; virtual std::string getDescription() const = 0; }; @@ -216,7 +216,7 @@ namespace Catch { using FactoryMap = std::map; using Listeners = std::vector; - virtual ~IReporterRegistry() = default; + virtual ~IReporterRegistry(); virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0; virtual FactoryMap const& getFactories() const = 0; virtual Listeners const& getListeners() const = 0; diff --git a/include/internal/catch_interfaces_runner.cpp b/include/internal/catch_interfaces_runner.cpp new file mode 100644 index 00000000..2b052eb8 --- /dev/null +++ b/include/internal/catch_interfaces_runner.cpp @@ -0,0 +1,5 @@ +#include "internal/catch_interfaces_runner.h" + +namespace Catch { + IRunner::~IRunner() = default; +} diff --git a/include/internal/catch_interfaces_testcase.cpp b/include/internal/catch_interfaces_testcase.cpp new file mode 100644 index 00000000..35c3db08 --- /dev/null +++ b/include/internal/catch_interfaces_testcase.cpp @@ -0,0 +1,6 @@ +#include "internal/catch_interfaces_testcase.h" + +namespace Catch { + ITestInvoker::~ITestInvoker() = default; + ITestCaseRegistry::~ITestCaseRegistry() = default; +} diff --git a/include/internal/catch_matchers.cpp b/include/internal/catch_matchers.cpp index 8621114b..32104a11 100644 --- a/include/internal/catch_matchers.cpp +++ b/include/internal/catch_matchers.cpp @@ -17,6 +17,8 @@ namespace Matchers { return m_cachedToString; } + MatcherUntypedBase::~MatcherUntypedBase() = default; + } // namespace Impl } // namespace Matchers diff --git a/include/internal/catch_matchers.h b/include/internal/catch_matchers.h index 91923831..8c15d425 100644 --- a/include/internal/catch_matchers.h +++ b/include/internal/catch_matchers.h @@ -29,7 +29,7 @@ namespace Matchers { std::string toString() const; protected: - virtual ~MatcherUntypedBase() = default; + virtual ~MatcherUntypedBase(); virtual std::string describe() const = 0; mutable std::string m_cachedToString; }; diff --git a/include/internal/catch_message.h b/include/internal/catch_message.h index 553882b7..c90d30d3 100644 --- a/include/internal/catch_message.h +++ b/include/internal/catch_message.h @@ -21,9 +21,9 @@ namespace Catch { ResultWas::OfType _type ); std::string macroName; + std::string message; SourceLineInfo lineInfo; ResultWas::OfType type; - std::string message; unsigned int sequence; bool operator == ( MessageInfo const& other ) const; diff --git a/include/internal/catch_registry_hub.cpp b/include/internal/catch_registry_hub.cpp index 74d92ec0..ab5ad361 100644 --- a/include/internal/catch_registry_hub.cpp +++ b/include/internal/catch_registry_hub.cpp @@ -10,7 +10,7 @@ #include "catch_context.h" #include "catch_test_case_registry_impl.h" -#include "catch_reporter_registry.hpp" +#include "catch_reporter_registry.h" #include "catch_exception_translator_registry.h" #include "catch_tag_alias_registry.h" #include "catch_startup_exception_registry.h" @@ -23,8 +23,7 @@ namespace Catch { private NonCopyable { public: // IRegistryHub - RegistryHub() { - } + RegistryHub() = default; IReporterRegistry const& getReporterRegistry() const override { return m_reporterRegistry; } diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp index 6d30a833..ce88fa34 100644 --- a/include/internal/catch_reporter_registrars.hpp +++ b/include/internal/catch_reporter_registrars.hpp @@ -58,11 +58,14 @@ namespace Catch { #if !defined(CATCH_CONFIG_DISABLE) #define CATCH_REGISTER_REPORTER( name, reporterType ) \ - namespace{ Catch::ReporterRegistrar catch_internal_RegistrarFor##reporterType( name ); } + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ReporterRegistrar catch_internal_RegistrarFor##reporterType( name ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS #define CATCH_REGISTER_LISTENER( listenerType ) \ - namespace{ Catch::ListenerRegistrar catch_internal_RegistrarFor##listenerType; } - + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ListenerRegistrar catch_internal_RegistrarFor##listenerType; } \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS #else // CATCH_CONFIG_DISABLE #define CATCH_REGISTER_REPORTER(name, reporterType) diff --git a/include/internal/catch_reporter_registry.cpp b/include/internal/catch_reporter_registry.cpp new file mode 100644 index 00000000..f017e059 --- /dev/null +++ b/include/internal/catch_reporter_registry.cpp @@ -0,0 +1,34 @@ +/* + * Created by Martin on 31/08/2017. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#include "catch_reporter_registry.h" + +namespace Catch { + + ReporterRegistry::~ReporterRegistry() = default; + + IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const { + auto it = m_factories.find( name ); + if( it == m_factories.end() ) + return nullptr; + return it->second->create( ReporterConfig( config ) ); + } + + void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { + m_factories.emplace(name, factory); + } + void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) { + m_listeners.push_back( factory ); + } + + IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { + return m_factories; + } + IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { + return m_listeners; + } + +} diff --git a/include/internal/catch_reporter_registry.h b/include/internal/catch_reporter_registry.h new file mode 100644 index 00000000..916e9247 --- /dev/null +++ b/include/internal/catch_reporter_registry.h @@ -0,0 +1,37 @@ +/* + * Created by Phil on 29/10/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED +#define TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED + +#include "catch_interfaces_reporter.h" + +#include + +namespace Catch { + + class ReporterRegistry : public IReporterRegistry { + + public: + + ~ReporterRegistry() override; + + IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override; + + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ); + void registerListener( IReporterFactoryPtr const& factory ); + + FactoryMap const& getFactories() const override; + Listeners const& getListeners() const override; + + private: + FactoryMap m_factories; + Listeners m_listeners; + }; +} + +#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_H_INCLUDED diff --git a/include/internal/catch_reporter_registry.hpp b/include/internal/catch_reporter_registry.hpp deleted file mode 100644 index c3bf3b61..00000000 --- a/include/internal/catch_reporter_registry.hpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Created by Phil on 29/10/2010. - * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. - * - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - */ -#ifndef TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED -#define TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED - -#include "catch_interfaces_reporter.h" - -#include - -namespace Catch { - - class ReporterRegistry : public IReporterRegistry { - - public: - - ~ReporterRegistry() override {} - - IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override { - auto it = m_factories.find( name ); - if( it == m_factories.end() ) - return nullptr; - return it->second->create( ReporterConfig( config ) ); - } - - void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { - m_factories.emplace(name, factory); - } - void registerListener( IReporterFactoryPtr const& factory ) { - m_listeners.push_back( factory ); - } - - FactoryMap const& getFactories() const override { - return m_factories; - } - Listeners const& getListeners() const override { - return m_listeners; - } - - private: - FactoryMap m_factories; - Listeners m_listeners; - }; -} - -#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRY_HPP_INCLUDED diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp index 13054862..60f133a0 100644 --- a/include/internal/catch_run_context.cpp +++ b/include/internal/catch_run_context.cpp @@ -329,4 +329,4 @@ namespace Catch { else CATCH_INTERNAL_ERROR("No result capture instance"); } -} \ No newline at end of file +} diff --git a/include/internal/catch_stream.cpp b/include/internal/catch_stream.cpp index 4278317d..14a89bac 100644 --- a/include/internal/catch_stream.cpp +++ b/include/internal/catch_stream.cpp @@ -57,6 +57,8 @@ namespace Catch { /////////////////////////////////////////////////////////////////////////// + Catch::IStream::~IStream() = default; + FileStream::FileStream( std::string const& filename ) { m_ofs.open( filename.c_str() ); CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" ); diff --git a/include/internal/catch_stream.h b/include/internal/catch_stream.h index 1ab59ca3..41780b98 100644 --- a/include/internal/catch_stream.h +++ b/include/internal/catch_stream.h @@ -24,7 +24,7 @@ namespace Catch { struct IStream { - virtual ~IStream() = default; + virtual ~IStream(); virtual std::ostream& stream() const = 0; }; diff --git a/include/internal/catch_streambuf.cpp b/include/internal/catch_streambuf.cpp new file mode 100644 index 00000000..608917fb --- /dev/null +++ b/include/internal/catch_streambuf.cpp @@ -0,0 +1,12 @@ +/* + * Created by Martin on 31/08/2017. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch_streambuf.h" + +namespace Catch { + StreamBufBase::~StreamBufBase() = default; +} diff --git a/include/internal/catch_streambuf.h b/include/internal/catch_streambuf.h index 7fd17e40..18b94ccb 100644 --- a/include/internal/catch_streambuf.h +++ b/include/internal/catch_streambuf.h @@ -8,15 +8,13 @@ #ifndef TWOBLUECUBES_CATCH_STREAMBUF_H_INCLUDED #define TWOBLUECUBES_CATCH_STREAMBUF_H_INCLUDED -#include "catch_compiler_capabilities.h" - #include namespace Catch { class StreamBufBase : public std::streambuf { public: - virtual ~StreamBufBase() = default; + virtual ~StreamBufBase(); }; } diff --git a/include/internal/catch_stringref.cpp b/include/internal/catch_stringref.cpp index e22b6c94..059f1c6f 100644 --- a/include/internal/catch_stringref.cpp +++ b/include/internal/catch_stringref.cpp @@ -5,12 +5,20 @@ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + #include "catch_stringref.h" #include #include #include + + namespace Catch { auto getEmptyStringRef() -> StringRef { @@ -160,3 +168,7 @@ namespace Catch { } } // namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif diff --git a/include/internal/catch_test_case_tracker.cpp b/include/internal/catch_test_case_tracker.cpp index fb3f8d44..bcb7793f 100644 --- a/include/internal/catch_test_case_tracker.cpp +++ b/include/internal/catch_test_case_tracker.cpp @@ -14,7 +14,10 @@ #include #include -CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif namespace Catch { namespace TestCaseTracking { @@ -25,6 +28,8 @@ namespace TestCaseTracking { {} + ITracker::~ITracker() = default; + TrackerContext& TrackerContext::instance() { static TrackerContext s_instance; @@ -276,4 +281,6 @@ using TestCaseTracking::IndexTracker; } // namespace Catch -CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS +#if defined(__clang__) +# pragma clang diagnostic pop +#endif diff --git a/include/internal/catch_test_case_tracker.h b/include/internal/catch_test_case_tracker.h index c9738252..a4b0440a 100644 --- a/include/internal/catch_test_case_tracker.h +++ b/include/internal/catch_test_case_tracker.h @@ -15,8 +15,6 @@ #include #include -CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS - namespace Catch { namespace TestCaseTracking { @@ -32,7 +30,7 @@ namespace TestCaseTracking { using ITrackerPtr = std::shared_ptr; struct ITracker { - virtual ~ITracker() = default; + virtual ~ITracker(); // static queries virtual NameAndLocation const& nameAndLocation() const = 0; @@ -182,6 +180,4 @@ using TestCaseTracking::IndexTracker; } // namespace Catch -CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS - #endif // TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED diff --git a/include/internal/catch_test_registry.cpp b/include/internal/catch_test_registry.cpp index b1c07f2d..ec50e92c 100644 --- a/include/internal/catch_test_registry.cpp +++ b/include/internal/catch_test_registry.cpp @@ -32,4 +32,6 @@ namespace Catch { getMutableRegistryHub().registerStartupException(); } } + + AutoReg::~AutoReg() = default; } diff --git a/include/internal/catch_test_registry.h b/include/internal/catch_test_registry.h index 19f08c2a..afba1dbc 100644 --- a/include/internal/catch_test_registry.h +++ b/include/internal/catch_test_registry.h @@ -42,7 +42,7 @@ struct NameAndTags { struct AutoReg : NonCopyable { AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept; - ~AutoReg() = default; + ~AutoReg(); }; } // end namespace Catch @@ -63,38 +63,38 @@ struct AutoReg : NonCopyable { /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ static void TestName(); \ - CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ - CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ static void TestName() #define INTERNAL_CATCH_TESTCASE( ... ) \ INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ - CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ - CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ - CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ \ struct TestName : ClassName{ \ void test(); \ }; \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ } \ - CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ void TestName::test() #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ - CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, "", Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ - CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS #endif // TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED diff --git a/include/internal/catch_test_spec.cpp b/include/internal/catch_test_spec.cpp index a1055c20..d9c149d5 100644 --- a/include/internal/catch_test_spec.cpp +++ b/include/internal/catch_test_spec.cpp @@ -15,6 +15,11 @@ namespace Catch { + TestSpec::Pattern::~Pattern() = default; + TestSpec::NamePattern::~NamePattern() = default; + TestSpec::TagPattern::~TagPattern() = default; + TestSpec::ExcludedPattern::~ExcludedPattern() = default; + TestSpec::NamePattern::NamePattern( std::string const& name ) : m_wildcardPattern( toLower( name ), CaseSensitive::No ) {} diff --git a/include/internal/catch_test_spec.h b/include/internal/catch_test_spec.h index e9ef3a31..baf8b019 100644 --- a/include/internal/catch_test_spec.h +++ b/include/internal/catch_test_spec.h @@ -24,7 +24,7 @@ namespace Catch { class TestSpec { struct Pattern { - virtual ~Pattern() = default; + virtual ~Pattern(); virtual bool matches( TestCaseInfo const& testCase ) const = 0; }; using PatternPtr = std::shared_ptr; @@ -32,7 +32,7 @@ namespace Catch { class NamePattern : public Pattern { public: NamePattern( std::string const& name ); - virtual ~NamePattern() = default; + virtual ~NamePattern(); virtual bool matches( TestCaseInfo const& testCase ) const override; private: WildcardPattern m_wildcardPattern; @@ -41,7 +41,7 @@ namespace Catch { class TagPattern : public Pattern { public: TagPattern( std::string const& tag ); - virtual ~TagPattern() = default; + virtual ~TagPattern(); virtual bool matches( TestCaseInfo const& testCase ) const override; private: std::string m_tag; @@ -50,7 +50,7 @@ namespace Catch { class ExcludedPattern : public Pattern { public: ExcludedPattern( PatternPtr const& underlyingPattern ); - virtual ~ExcludedPattern() = default; + virtual ~ExcludedPattern(); virtual bool matches( TestCaseInfo const& testCase ) const override; private: PatternPtr m_underlyingPattern; diff --git a/include/internal/catch_tostring.cpp b/include/internal/catch_tostring.cpp index 56aefa63..1b47178d 100644 --- a/include/internal/catch_tostring.cpp +++ b/include/internal/catch_tostring.cpp @@ -6,6 +6,13 @@ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + + #include "catch_tostring.h" #include "catch_interfaces_config.h" #include "catch_context.h" @@ -211,3 +218,8 @@ std::string StringMaker::convert(double value) { } // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + diff --git a/include/internal/catch_tostring.h b/include/internal/catch_tostring.h index 2caa96de..b5d31397 100644 --- a/include/internal/catch_tostring.h +++ b/include/internal/catch_tostring.h @@ -22,9 +22,10 @@ #ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable:4180) // qualifier applied to function type has no meaning +#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless #endif + // We need a dummy global operator<< so we can bring it into Catch namespace later struct Catch_global_namespace_dummy; std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); diff --git a/include/reporters/catch_reporter_tap.hpp b/include/reporters/catch_reporter_tap.hpp index 47661598..dbcad5ee 100644 --- a/include/reporters/catch_reporter_tap.hpp +++ b/include/reporters/catch_reporter_tap.hpp @@ -64,13 +64,13 @@ namespace Catch { public: AssertionPrinter& operator= ( AssertionPrinter const& ) = delete; AssertionPrinter( AssertionPrinter const& ) = delete; - AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, size_t counter ) + AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, size_t _counter ) : stream( _stream ) , result( _stats.assertionResult ) , messages( _stats.infoMessages ) , itMessage( _stats.infoMessages.begin() ) , printInfoMessages( true ) - , counter(counter) + , counter(_counter) {} void print() { diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index b18370b6..9b2defd5 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1003,6 +1003,6 @@ with expansion: "{?}" == "1" =============================================================================== -test cases: 177 | 126 passed | 47 failed | 4 failed as expected +test cases: 176 | 125 passed | 47 failed | 4 failed as expected assertions: 878 | 761 passed | 96 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 110e28d8..be582975 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -7434,6 +7434,6 @@ MiscTests.cpp:: PASSED: =============================================================================== -test cases: 177 | 124 passed | 49 failed | 4 failed as expected +test cases: 176 | 123 passed | 49 failed | 4 failed as expected assertions: 877 | 757 passed | 99 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 6ab21f15..f3a9ee6d 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -6946,9 +6946,6 @@ Message from section two - - - diff --git a/projects/SelfTest/ConditionTests.cpp b/projects/SelfTest/ConditionTests.cpp index 00ff6060..4bc09817 100644 --- a/projects/SelfTest/ConditionTests.cpp +++ b/projects/SelfTest/ConditionTests.cpp @@ -6,7 +6,9 @@ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) */ #ifdef __clang__ +# pragma clang diagnostic push # pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wdouble-promotion" #endif #include "catch.hpp" @@ -161,6 +163,11 @@ TEST_CASE( "Ordering comparison checks that should fail", "[.][failing]" ) CHECK( data.str_hello <= "a" ); } +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + + // Comparisons with int literals TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigned" ) { diff --git a/projects/SelfTest/ExceptionTests.cpp b/projects/SelfTest/ExceptionTests.cpp index 6c7cdb2c..4d092f44 100644 --- a/projects/SelfTest/ExceptionTests.cpp +++ b/projects/SelfTest/ExceptionTests.cpp @@ -14,6 +14,10 @@ #ifdef _MSC_VER #pragma warning(disable:4702) // Unreachable code -- MSVC 19 (VS 2015) sees right through the indirection #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#endif namespace { @@ -219,3 +223,7 @@ TEST_CASE( "#748 - captures with unexpected exceptions", "[.][failing][!throws][ REQUIRE_THROWS( thisThrows() ); } } + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif diff --git a/projects/SelfTest/MatchersTests.cpp b/projects/SelfTest/MatchersTests.cpp index 0482ed43..2a9040a8 100644 --- a/projects/SelfTest/MatchersTests.cpp +++ b/projects/SelfTest/MatchersTests.cpp @@ -8,6 +8,12 @@ #include "catch.hpp" +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#pragma clang diagnostic ignored "-Wpadded" +#endif + #ifndef CATCH_CONFIG_DISABLE_MATCHERS inline const char* testStringForMatching() @@ -166,16 +172,18 @@ TEST_CASE( "Vector matchers that fail", "[matchers][vector][.][failing]" ) { #include struct SpecialException : std::exception { - SpecialException(int i):i(i) {} + SpecialException(int i_):i(i_) {} int i; }; void doesNotThrow() {} +[[noreturn]] void throws(int i) { throw SpecialException{ i }; } +[[noreturn]] void throwsAsInt(int i) { throw i; } @@ -217,3 +225,7 @@ TEST_CASE("Exception matchers that fail", "[matchers][exceptions][!throws][.fail } #endif // CATCH_CONFIG_DISABLE_MATCHERS + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif diff --git a/projects/SelfTest/SurrogateCpps/catch_interfaces_capture.cpp b/projects/SelfTest/SurrogateCpps/catch_interfaces_capture.cpp deleted file mode 100644 index f46dae48..00000000 --- a/projects/SelfTest/SurrogateCpps/catch_interfaces_capture.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// This file is only here to verify (to the extent possible) the self sufficiency of the header -#include "internal/catch_suppress_warnings.h" -#include "internal/catch_interfaces_capture.h" diff --git a/projects/SelfTest/SurrogateCpps/catch_interfaces_config.cpp b/projects/SelfTest/SurrogateCpps/catch_interfaces_config.cpp deleted file mode 100644 index 46f80e86..00000000 --- a/projects/SelfTest/SurrogateCpps/catch_interfaces_config.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "internal/catch_suppress_warnings.h" -#include "internal/catch_interfaces_config.h" diff --git a/projects/SelfTest/SurrogateCpps/catch_interfaces_exception.cpp b/projects/SelfTest/SurrogateCpps/catch_interfaces_exception.cpp deleted file mode 100644 index f5ad4870..00000000 --- a/projects/SelfTest/SurrogateCpps/catch_interfaces_exception.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "internal/catch_suppress_warnings.h" -#include "internal/catch_interfaces_exception.h" diff --git a/projects/SelfTest/SurrogateCpps/catch_interfaces_registry_hub.cpp b/projects/SelfTest/SurrogateCpps/catch_interfaces_registry_hub.cpp deleted file mode 100644 index b399d862..00000000 --- a/projects/SelfTest/SurrogateCpps/catch_interfaces_registry_hub.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// This file is only here to verify (to the extent possible) the self sufficiency of the header -#include "internal/catch_suppress_warnings.h" -#include "internal/catch_interfaces_registry_hub.h" diff --git a/projects/SelfTest/SurrogateCpps/catch_interfaces_runner.cpp b/projects/SelfTest/SurrogateCpps/catch_interfaces_runner.cpp deleted file mode 100644 index 800f32ab..00000000 --- a/projects/SelfTest/SurrogateCpps/catch_interfaces_runner.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "internal/catch_interfaces_runner.h" diff --git a/projects/SelfTest/SurrogateCpps/catch_interfaces_testcase.cpp b/projects/SelfTest/SurrogateCpps/catch_interfaces_testcase.cpp deleted file mode 100644 index 0d6903cc..00000000 --- a/projects/SelfTest/SurrogateCpps/catch_interfaces_testcase.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "internal/catch_suppress_warnings.h" -#include "internal/catch_interfaces_testcase.h" diff --git a/projects/SelfTest/SurrogateCpps/catch_streambuf.cpp b/projects/SelfTest/SurrogateCpps/catch_streambuf.cpp deleted file mode 100644 index a9222e4b..00000000 --- a/projects/SelfTest/SurrogateCpps/catch_streambuf.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// This file is only here to verify (to the extent possible) the self sufficiency of the header -#include "internal/catch_suppress_warnings.h" -#include "internal/catch_streambuf.h" diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index cdb13c52..68271b7e 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -265,4 +265,4 @@ struct AutoTestReg { REGISTER_TEST_CASE( manuallyRegisteredTestFunction, "ManuallyRegistered" ); } }; -AutoTestReg autoTestReg; +static AutoTestReg autoTestReg; diff --git a/projects/SelfTest/TrickyTests.cpp b/projects/SelfTest/TrickyTests.cpp index c3f8a240..78f7052f 100644 --- a/projects/SelfTest/TrickyTests.cpp +++ b/projects/SelfTest/TrickyTests.cpp @@ -381,12 +381,9 @@ TEST_CASE( "has printf" ) { printf( "loose text artifact\n" ); } -TEST_CASE( "assertions with commas are allowed" ) { -} - namespace { struct constructor_throws { - constructor_throws() { + [[noreturn]] constructor_throws() { throw 1; } };