From 933a33a7948c3d9bb984473b9b92832f52c590cd Mon Sep 17 00:00:00 2001 From: Michael Winterberg Date: Sun, 8 Oct 2017 13:50:12 -0700 Subject: [PATCH] Added MSVC checking for support for string_view. Also, driveby adding "override" to classes with inherited virtual destructors. --- fmt/format.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index 182398b4..c02a301e 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -51,7 +51,8 @@ # define FMT_HAS_INCLUDE(x) 0 #endif -#if FMT_HAS_INCLUDE() && __cplusplus > 201402L +#if (FMT_HAS_INCLUDE() && __cplusplus > 201402L) || \ + (defined(_MSVC_LANG) && _MSVC_LANG > 201402L && _MSC_VER >= 1910) # include # define FMT_HAS_STRING_VIEW 1 #else @@ -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 { @@ -803,7 +804,7 @@ class MemoryBuffer : private Allocator, public Buffer { public: explicit MemoryBuffer(const Allocator &alloc = Allocator()) : Allocator(alloc), Buffer(data_, SIZE) {} - ~MemoryBuffer() { deallocate(); } + ~MemoryBuffer() FMT_OVERRIDE { deallocate(); } #if FMT_USE_RVALUE_REFERENCES private: @@ -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 @@ -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_; } };