Skip to content

Commit

Permalink
Squelch MSVC warning exporting subclasses of runtime_error
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Chris Martin authored and vitaut committed Nov 30, 2019
1 parent 3c05fa4 commit 3bc28fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3bc28fc

Please sign in to comment.