diff --git a/include/fmt/core.h b/include/fmt/core.h index f4fe1088..b48dac1b 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -166,6 +166,12 @@ #endif #if !defined(FMT_HEADER_ONLY) && defined(_WIN32) +# if FMT_MSC_VER +# define FMT_NO_W4275 __pragma(warning(suppress : 4275)) +# else +# define FMT_NO_W4275 +# endif +# define FMT_CLASS_API FMT_NO_W4275 # ifdef FMT_EXPORT # define FMT_API __declspec(dllexport) # elif defined(FMT_SHARED) @@ -173,6 +179,9 @@ # define FMT_EXTERN_TEMPLATE_API FMT_API # endif #endif +#ifndef FMT_CLASS_API +# define FMT_CLASS_API +#endif #ifndef FMT_API # define FMT_API #endif diff --git a/include/fmt/format.h b/include/fmt/format.h index b993beca..e0c128b9 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -696,6 +696,7 @@ using memory_buffer = basic_memory_buffer; using wmemory_buffer = basic_memory_buffer; /** A formatting error such as invalid format string. */ +FMT_CLASS_API class FMT_API format_error : public std::runtime_error { public: explicit format_error(const char* message) : std::runtime_error(message) {} @@ -2707,6 +2708,7 @@ class arg_formatter : public internal::arg_formatter_base { An error returned by an operating system or a language runtime, for example a file opening error. */ +FMT_CLASS_API class FMT_API system_error : public std::runtime_error { private: void init(int err_code, string_view format_str, format_args args);