Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Fix C4601 and enable C4602 warning for internal builds

Related to #1072
Commit
c67251297910982586e2db79748d23ff02b773c5
Author
Martin Hořeňovský ·
Parents
57b4e0b64ce0

Files · Download .tar.gz

Changes

 CMakeLists.txt                               |  2 +-
 include/reporters/catch_reporter_console.cpp | 12 ++++++++++++
 include/reporters/catch_reporter_xml.cpp     | 11 +++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f25f47fe..bda4b293 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -310,7 +310,7 @@ if (NOT NO_SELFTEST)
         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 )
+        target_compile_options( SelfTest PRIVATE /W4 /w44265 /WX /w44061 /w44062 )
         target_compile_options( Benchmark PRIVATE /W4 )
     endif()
 
diff --git a/include/reporters/catch_reporter_console.cpp b/include/reporters/catch_reporter_console.cpp
index 31a46bd9..68eb3b94 100644
--- a/include/reporters/catch_reporter_console.cpp
+++ b/include/reporters/catch_reporter_console.cpp
@@ -17,6 +17,14 @@
 #include <cfloat>
 #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 {
@@ -639,3 +647,7 @@ namespace Catch {
     ConsoleReporter::~ConsoleReporter() {}
 
 } // end namespace Catch
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif
diff --git a/include/reporters/catch_reporter_xml.cpp b/include/reporters/catch_reporter_xml.cpp
index abdfbce5..36f169fd 100644
--- a/include/reporters/catch_reporter_xml.cpp
+++ b/include/reporters/catch_reporter_xml.cpp
@@ -13,6 +13,13 @@
 #include "internal/catch_xmlwriter.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 {
     class XmlReporter : public StreamingReporterBase<XmlReporter> {
     public:
@@ -223,3 +230,7 @@ namespace Catch {
     CATCH_REGISTER_REPORTER( "xml", XmlReporter )
 
 } // end namespace Catch
+
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif