Don't explicitly suppress GCC's -Wterminate in tests' FMT_ASSERT.

Throwing from a separate function is enough to silence the warning, no need to
explicitly suppress it.
This commit is contained in:
John Steele Scott 2021-03-01 20:34:06 +10:30
parent 131e584391
commit 4471b2f133

View File

@ -22,19 +22,11 @@ class assertion_failure : public std::logic_error {
void assertion_failure::avoid_weak_vtable() {} void assertion_failure::avoid_weak_vtable() {}
// We use a separate function (rather than throw directly from FMT_ASSERT) to
// avoid GCC's -Wterminate warning when FMT_ASSERT is used in a destructor.
inline void throw_assertion_failure (const char *message) inline void throw_assertion_failure (const char *message)
{ {
# if defined(__GNUC__) && __GNUC__ >= 6
// Avoid warnings when FMT_ASSERT is used in a destructor.
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wterminate"
# endif
throw assertion_failure(message); throw assertion_failure(message);
# if defined(__GNUC__) && __GNUC__ >= 6
# pragma GCC diagnostic pop
# endif
} }