Skip to content

Commit

Permalink
Enable Werror for dev builds
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Nov 21, 2017
1 parent 3b965aa commit 87c125e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -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" )
Expand Down
9 changes: 8 additions & 1 deletion examples/210-Evt-EventListeners.cpp
Expand Up @@ -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 {
Expand Down Expand Up @@ -367,6 +370,10 @@ struct MyListener : Catch::TestEventListenerBase {

CATCH_REGISTER_LISTENER( MyListener )

// Get rid of Wweak-tables
MyListener::~MyListener() {}


// -----------------------------------------------------------------------
// 3. Test cases:
//
Expand Down
9 changes: 9 additions & 0 deletions include/internal/catch_fatal_condition.cpp
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -174,3 +179,7 @@ namespace Catch {
# endif // CATCH_CONFIG_POSIX_SIGNALS

#endif // not Windows

#if defined(__GNUC__)
# pragma GCC diagnostic pop
#endif
5 changes: 4 additions & 1 deletion projects/SelfTest/UsageTests/Condition.tests.cpp
Expand Up @@ -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"
Expand Down

0 comments on commit 87c125e

Please sign in to comment.