Enable Werror for dev builds

This commit is contained in:
Martin Hořeňovský 2017-11-21 15:23:30 +01:00
parent 3b965aa501
commit 87c125ecb8
4 changed files with 22 additions and 3 deletions

View File

@ -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" )

View File

@ -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:
//

View File

@ -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

View File

@ -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"