Skip to content

Commit

Permalink
fix newer clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Lectem authored and vitaut committed Oct 31, 2016
1 parent 8c63ea4 commit a5b9611
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
6 changes: 3 additions & 3 deletions fmt/format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ static inline fmt::internal::Null<> strerror_s(char *, std::size_t, ...) {

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 {

Expand Down
36 changes: 24 additions & 12 deletions fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,22 +180,32 @@ typedef __int64 intmax_t;
# define FMT_USE_NOEXCEPT 0
#endif

#ifndef FMT_NOEXCEPT
#ifdef FMT_NOEXCEPT
# define FMT_DTOR_NOEXCEPT FMT_NOEXCEPT
#else
# if FMT_USE_NOEXCEPT || FMT_HAS_FEATURE(cxx_noexcept) || \
(FMT_GCC_VERSION >= 408 && FMT_HAS_GXX_CXX11) || \
FMT_MSC_VER >= 1900
# define FMT_DETECTED_NOEXCEPT noexcept
# else
# define FMT_DETECTED_NOEXCEPT throw()
# endif
# if FMT_EXCEPTIONS
# 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_NOEXCEPT FMT_DETECTED_NOEXCEPT
# else
# define FMT_NOEXCEPT
# 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
#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
Expand Down Expand Up @@ -550,7 +560,8 @@ class FormatError : public std::runtime_error {
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 {
Expand Down Expand Up @@ -1376,7 +1387,8 @@ struct NamedArgWithType : NamedArg<Char> {
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>
Expand Down Expand Up @@ -2325,7 +2337,7 @@ class SystemError : public internal::RuntimeError {
}
FMT_VARIADIC_CTOR(SystemError, init, int, CStringRef)

~SystemError() throw();
~SystemError() FMT_DTOR_NOEXCEPT;

int error_code() const { return error_code_; }
};
Expand Down

0 comments on commit a5b9611

Please sign in to comment.