From 3bc28fcc6b2a9014ff4e39a4a835f8f9e90e6260 Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Fri, 29 Nov 2019 10:33:47 -0500 Subject: [PATCH] Squelch MSVC warning exporting subclasses of runtime_error When compiling {fmt} as a DLL, MSVC complains that we are exporting classes that inherit from "std::runtime_error", which we are not exporting. In this case, it's not really a problem because that symbol is already exported via the C++ stdlib. So we just add a pragma to silence the warning. --- include/fmt/core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 14ab40f7..74e297ea 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -167,9 +167,9 @@ #if !defined(FMT_HEADER_ONLY) && defined(_WIN32) # ifdef FMT_EXPORT -# define FMT_API __declspec(dllexport) +# define FMT_API __pragma(warning(suppress : 4275)) __declspec(dllexport) # elif defined(FMT_SHARED) -# define FMT_API __declspec(dllimport) +# define FMT_API __pragma(warning(suppress : 4275)) __declspec(dllimport) # define FMT_EXTERN_TEMPLATE_API FMT_API # endif #endif