Fix C4601 and enable C4602 warning for internal builds

Related to #1072
This commit is contained in:
Martin Hořeňovský 2017-10-30 12:14:20 +01:00
parent 57b4e0b64c
commit c672512979
3 changed files with 24 additions and 1 deletions

View File

@ -310,7 +310,7 @@ if (NOT NO_SELFTEST)
target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn ) target_compile_options( SelfTest PRIVATE -Wweak-vtables -Wexit-time-destructors -Wglobal-constructors -Wmissing-noreturn )
endif() endif()
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX ) target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX /w44061 /w44062 )
target_compile_options( Benchmark PRIVATE /W4 ) target_compile_options( Benchmark PRIVATE /W4 )
endif() endif()

View File

@ -17,6 +17,14 @@
#include <cfloat> #include <cfloat>
#include <cstdio> #include <cstdio>
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
// Note that 4062 (not all labels are handled
// and default is missing) is enabled
#endif
namespace Catch { namespace Catch {
namespace { namespace {
@ -639,3 +647,7 @@ namespace Catch {
ConsoleReporter::~ConsoleReporter() {} ConsoleReporter::~ConsoleReporter() {}
} // end namespace Catch } // end namespace Catch
#if defined(_MSC_VER)
#pragma warning(pop)
#endif

View File

@ -13,6 +13,13 @@
#include "internal/catch_xmlwriter.h" #include "internal/catch_xmlwriter.h"
#include "../internal/catch_timer.h" #include "../internal/catch_timer.h"
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
// Note that 4062 (not all labels are handled
// and default is missing) is enabled
#endif
namespace Catch { namespace Catch {
class XmlReporter : public StreamingReporterBase<XmlReporter> { class XmlReporter : public StreamingReporterBase<XmlReporter> {
public: public:
@ -223,3 +230,7 @@ namespace Catch {
CATCH_REGISTER_REPORTER( "xml", XmlReporter ) CATCH_REGISTER_REPORTER( "xml", XmlReporter )
} // end namespace Catch } // end namespace Catch
#if defined(_MSC_VER)
#pragma warning(pop)
#endif