diff --git a/include/fmt/core.h b/include/fmt/core.h index 398253cbbed62..9fa243155506d 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) diff --git a/include/fmt/format.h b/include/fmt/format.h index 01f41f5cbdd33..31505ba6a16b3 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -33,8 +33,6 @@ #ifndef FMT_FORMAT_H_ #define FMT_FORMAT_H_ -#include "core.h" - #include #include #include @@ -43,6 +41,9 @@ #include #include +#include "core.h" + + #ifdef __clang__ # define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) #else @@ -688,6 +689,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) {} @@ -2699,6 +2701,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);