fix newer clang warnings
diff --git a/fmt/format.cc b/fmt/format.cc
index f68b2f6..78f4d24 100644
--- a/fmt/format.cc
+++ b/fmt/format.cc
@@ -81,9 +81,9 @@
namespace fmt {
-FMT_FUNC internal::RuntimeError::~RuntimeError() throw() {}
-FMT_FUNC FormatError::~FormatError() throw() {}
-FMT_FUNC SystemError::~SystemError() throw() {}
+FMT_FUNC internal::RuntimeError::~RuntimeError() FMT_DTOR_NOEXCEPT {}
+FMT_FUNC FormatError::~FormatError() FMT_DTOR_NOEXCEPT {}
+FMT_FUNC SystemError::~SystemError() FMT_DTOR_NOEXCEPT {}
namespace {
diff --git a/fmt/format.h b/fmt/format.h
index de1475b..9913e4b 100644
--- a/fmt/format.h
+++ b/fmt/format.h
@@ -180,22 +180,32 @@
# define FMT_USE_NOEXCEPT 0
#endif
-#ifndef FMT_NOEXCEPT
-# if FMT_EXCEPTIONS
-# if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
+#if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
(FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \
FMT_MSC_VER >= 1900
-# define FMT_NOEXCEPT noexcept
-# else
-# define FMT_NOEXCEPT throw()
-# endif
+# define FMT_DETECTED_NOEXCEPT noexcept
+#else
+# define FMT_DETECTED_NOEXCEPT throw()
+#endif
+
+#ifndef FMT_NOEXCEPT
+# if FMT_EXCEPTIONS
+# define FMT_NOEXCEPT FMT_DETECTED_NOEXCEPT
# else
# define FMT_NOEXCEPT
# endif
#endif
+// This is needed because GCC still uses throw() in its headers when exceptions
+// are disabled.
+#if FMT_GCC_VERSION
+# define FMT_DTOR_NOEXCEPT FMT_DETECTED_NOEXCEPT
+#else
+# define FMT_DTOR_NOEXCEPT FMT_NOEXCEPT
+#endif
+
#ifndef FMT_OVERRIDE
-# if FMT_USE_OVERRIDE || FMT_HAS_FEATURE(cxx_override) || \
+# if (defined(FMT_USE_OVERRIDE) && FMT_USE_OVERRIDE) || FMT_HAS_FEATURE(cxx_override) || \
(FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \
FMT_MSC_VER >= 1900
# define FMT_OVERRIDE override
@@ -204,7 +214,6 @@
# endif
#endif
-
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#ifndef FMT_USE_DELETED_FUNCTIONS
@@ -550,7 +559,8 @@
public:
explicit FormatError(CStringRef message)
: std::runtime_error(message.c_str()) {}
- ~FormatError() throw();
+ FormatError(const FormatError &ferr) : std::runtime_error(ferr) {}
+ ~FormatError() FMT_DTOR_NOEXCEPT;
};
namespace internal {
@@ -1376,7 +1386,8 @@
class RuntimeError : public std::runtime_error {
protected:
RuntimeError() : std::runtime_error("") {}
- ~RuntimeError() throw();
+ RuntimeError(const RuntimeError &rerr) : std::runtime_error(rerr) {}
+ ~RuntimeError() FMT_DTOR_NOEXCEPT;
};
template <typename Char>
@@ -2325,7 +2336,7 @@
}
FMT_VARIADIC_CTOR(SystemError, init, int, CStringRef)
- ~SystemError() throw();
+ ~SystemError() FMT_DTOR_NOEXCEPT;
int error_code() const { return error_code_; }
};