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
Suppress Wunreachable-code in floating matchers and exception tests
- Commit
ee73989f9bc3a42c6224218a222d90c44daf120c- Author
- Martin Hořeňovský ·
- Parents
646e1f608d37
Changes
include/internal/catch_matchers_floating.cpp | 10 ++++++++++ projects/SelfTest/UsageTests/Exception.tests.cpp | 1 + 2 files changed, 11 insertions(+) diff --git a/include/internal/catch_matchers_floating.cpp b/include/internal/catch_matchers_floating.cpp index 72728a83..455361eb 100644 --- a/include/internal/catch_matchers_floating.cpp +++ b/include/internal/catch_matchers_floating.cpp @@ -104,6 +104,12 @@ namespace Floating { } } +#if defined(__clang__) +#pragma clang diagnostic push +// Clang <3.5 reports on the default branch in the switch below +#pragma clang diagnostic ignored "-Wunreachable-code" +#endif + bool WithinUlpsMatcher::match(double const& matchee) const { switch (m_type) { case FloatingPointKind::Float: @@ -115,6 +121,10 @@ namespace Floating { } } +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + std::string WithinUlpsMatcher::describe() const { return "is within " + Catch::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : ""); } diff --git a/projects/SelfTest/UsageTests/Exception.tests.cpp b/projects/SelfTest/UsageTests/Exception.tests.cpp index f9c73ed5..9c198dfb 100644 --- a/projects/SelfTest/UsageTests/Exception.tests.cpp +++ b/projects/SelfTest/UsageTests/Exception.tests.cpp @@ -18,6 +18,7 @@ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wweak-vtables" #pragma clang diagnostic ignored "-Wmissing-noreturn" +#pragma clang diagnostic ignored "-Wunreachable-code" #endif namespace { namespace ExceptionTests {