Suppress Wunreachable-code in floating matchers and exception tests

Closes #1350
This commit is contained in:
Martin Hořeňovský 2018-09-01 22:34:29 +02:00
parent 646e1f608d
commit ee73989f9b
2 changed files with 11 additions and 0 deletions

View File

@ -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" : "");
}

View File

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