Skip to content

Commit

Permalink
Added MSVC checking for support for string_view.
Browse files Browse the repository at this point in the history
Also, driveby adding "override" to classes with inherited virtual destructors.
  • Loading branch information
mwinterb authored and vitaut committed Oct 9, 2017
1 parent bef89db commit 933a33a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
# define FMT_HAS_INCLUDE(x) 0
#endif

#if FMT_HAS_INCLUDE(<string_view>) && __cplusplus > 201402L
#if (FMT_HAS_INCLUDE(<string_view>) && __cplusplus > 201402L) || \
(defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910)
# include <string_view>
# define FMT_HAS_STRING_VIEW 1
#else
Expand Down Expand Up @@ -658,7 +659,7 @@ class FormatError : public std::runtime_error {
explicit FormatError(CStringRef message)
: std::runtime_error(message.c_str()) {}
FormatError(const FormatError &ferr) : std::runtime_error(ferr) {}
FMT_API ~FormatError() FMT_DTOR_NOEXCEPT;
FMT_API ~FormatError() FMT_DTOR_NOEXCEPT FMT_OVERRIDE;
};

namespace internal {
Expand Down Expand Up @@ -803,7 +804,7 @@ class MemoryBuffer : private Allocator, public Buffer<T> {
public:
explicit MemoryBuffer(const Allocator &alloc = Allocator())
: Allocator(alloc), Buffer<T>(data_, SIZE) {}
~MemoryBuffer() { deallocate(); }
~MemoryBuffer() FMT_OVERRIDE { deallocate(); }

#if FMT_USE_RVALUE_REFERENCES
private:
Expand Down Expand Up @@ -1505,7 +1506,7 @@ class RuntimeError : public std::runtime_error {
protected:
RuntimeError() : std::runtime_error("") {}
RuntimeError(const RuntimeError &rerr) : std::runtime_error(rerr) {}
FMT_API ~RuntimeError() FMT_DTOR_NOEXCEPT;
FMT_API ~RuntimeError() FMT_DTOR_NOEXCEPT FMT_OVERRIDE;
};

template <typename Char>
Expand Down Expand Up @@ -2514,7 +2515,7 @@ class SystemError : public internal::RuntimeError {
FMT_DEFAULTED_COPY_CTOR(SystemError)
FMT_VARIADIC_CTOR(SystemError, init, int, CStringRef)

FMT_API ~SystemError() FMT_DTOR_NOEXCEPT;
FMT_API ~SystemError() FMT_DTOR_NOEXCEPT FMT_OVERRIDE;

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

0 comments on commit 933a33a

Please sign in to comment.