diff --git a/CMakeLists.txt b/CMakeLists.txt index e1208a9a..3792bad6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -302,7 +302,7 @@ if (NOT NO_SELFTEST) # Add desired warnings if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" ) - target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code ) + target_compile_options( SelfTest PRIVATE -Wall -Wextra -Wunreachable-code -Werror ) endif() # Clang specific warning go here if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) diff --git a/examples/210-Evt-EventListeners.cpp b/examples/210-Evt-EventListeners.cpp index a2103a0b..8ba360f5 100644 --- a/examples/210-Evt-EventListeners.cpp +++ b/examples/210-Evt-EventListeners.cpp @@ -295,12 +295,15 @@ void print( std::ostream& os, int const level, std::string const& title, Catch:: // 2. My listener and registration: // -const std::string dashed_line = +char const * dashed_line = "--------------------------------------------------------------------------"; struct MyListener : Catch::TestEventListenerBase { using TestEventListenerBase::TestEventListenerBase; // inherit constructor + + // Get rid of Wweak-tables + ~MyListener(); // The whole test run starting virtual void testRunStarting( Catch::TestRunInfo const& testRunInfo ) override { @@ -367,6 +370,10 @@ struct MyListener : Catch::TestEventListenerBase { CATCH_REGISTER_LISTENER( MyListener ) +// Get rid of Wweak-tables +MyListener::~MyListener() {} + + // ----------------------------------------------------------------------- // 3. Test cases: // diff --git a/include/internal/catch_fatal_condition.cpp b/include/internal/catch_fatal_condition.cpp index 39b63455..0fa09f26 100644 --- a/include/internal/catch_fatal_condition.cpp +++ b/include/internal/catch_fatal_condition.cpp @@ -12,6 +12,11 @@ #include "catch_context.h" #include "catch_interfaces_capture.h" +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + namespace { // Report the error condition void reportFatal( char const * const message ) { @@ -174,3 +179,7 @@ namespace Catch { # endif // CATCH_CONFIG_POSIX_SIGNALS #endif // not Windows + +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif diff --git a/projects/SelfTest/UsageTests/Condition.tests.cpp b/projects/SelfTest/UsageTests/Condition.tests.cpp index 975fd400..9aed5e2c 100644 --- a/projects/SelfTest/UsageTests/Condition.tests.cpp +++ b/projects/SelfTest/UsageTests/Condition.tests.cpp @@ -8,7 +8,10 @@ #ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wpadded" -# pragma clang diagnostic ignored "-Wdouble-promotion" +// Wdouble-promotion is not supported until 3.8 +# if (__clang_major__ > 3) || (__clang_major__ == 3 && __clang_minor__ > 7) +# pragma clang diagnostic ignored "-Wdouble-promotion" +# endif #endif #include "catch.hpp"