From 14a29c03eb15783e798c1978f2613c0d6732cbe0 Mon Sep 17 00:00:00 2001 From: gabime Date: Mon, 31 Oct 2022 17:47:12 +0200 Subject: [PATCH] suppress warning 4307 when including format-inline.h under msvc 2017 --- include/spdlog/fmt/fmt.h | 11 +++++++++++ src/bundled_fmtlib_format.cpp | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/spdlog/fmt/fmt.h b/include/spdlog/fmt/fmt.h index fa4a2a84..d57ed002 100644 --- a/include/spdlog/fmt/fmt.h +++ b/include/spdlog/fmt/fmt.h @@ -21,9 +21,20 @@ # endif // enable the 'n' flag in for backward compatibility with fmt 6.x # define FMT_DEPRECATED_N_SPECIFIER + +// suppress "integral constant overflow" warning under msvc 2017 (which doesn't appear in other msvc versions) +#if defined(_MSC_VER) && ((_MSC_VER >= 1910) && (_MSC_VER <= 1916)) +# pragma warning(push) +# pragma warning(disable : 4307) +#endif + # include # include #else // SPDLOG_FMT_EXTERNAL is defined - use external fmtlib # include # include #endif + +#if defined(_MSC_VER) && ((_MSC_VER >= 1910) && (_MSC_VER <= 1916)) +# pragma warning(pop) +#endif diff --git a/src/bundled_fmtlib_format.cpp b/src/bundled_fmtlib_format.cpp index ada16cd7..772a6717 100644 --- a/src/bundled_fmtlib_format.cpp +++ b/src/bundled_fmtlib_format.cpp @@ -9,13 +9,13 @@ #if !defined(SPDLOG_FMT_EXTERNAL) && !defined(SPDLOG_USE_STD_FORMAT) // suppress "integral constant overflow" warning under msvc 2017 (which doesn't appear in other msvc versions) -#if defined(_MSC_VER) && (_MSC_VER >= 1910) && (_MSC_VER <= 1916) +#if defined(_MSC_VER) && ((_MSC_VER >= 1910) && (_MSC_VER <= 1916)) # pragma warning(push) # pragma warning(disable : 4307) #endif # include -#if defined(_MSC_VER) +#if defined(_MSC_VER) && ((_MSC_VER >= 1910) && (_MSC_VER <= 1916)) # pragma warning(pop) #endif