mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Suppress Wunreachable-code in floating matchers and exception tests
Closes #1350
This commit is contained in:
parent
646e1f608d
commit
ee73989f9b
@ -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 {
|
bool WithinUlpsMatcher::match(double const& matchee) const {
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case FloatingPointKind::Float:
|
case FloatingPointKind::Float:
|
||||||
@ -115,6 +121,10 @@ namespace Floating {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string WithinUlpsMatcher::describe() const {
|
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" : "");
|
return "is within " + Catch::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : "");
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wweak-vtables"
|
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||||
#pragma clang diagnostic ignored "-Wmissing-noreturn"
|
#pragma clang diagnostic ignored "-Wmissing-noreturn"
|
||||||
|
#pragma clang diagnostic ignored "-Wunreachable-code"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace { namespace ExceptionTests {
|
namespace { namespace ExceptionTests {
|
||||||
|
Loading…
Reference in New Issue
Block a user