diff --git a/include/nlohmann/detail/bit_ops.hpp b/include/nlohmann/detail/bit_ops.hpp index 42a09b68e..c9424a6d1 100644 --- a/include/nlohmann/detail/bit_ops.hpp +++ b/include/nlohmann/detail/bit_ops.hpp @@ -30,7 +30,7 @@ inline int count_leading_zeros(std::uint64_t x) noexcept #if defined(__GNUC__) || defined(__clang__) return __builtin_clzll(x); #elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) - unsigned long index = 0; + unsigned long index = 0; // NOLINT(runtime/int): the type _BitScan*64 takes _BitScanReverse64(&index, x); return 63 - static_cast(index); #else @@ -53,7 +53,7 @@ inline int count_trailing_zeros(std::uint64_t x) noexcept #if defined(__GNUC__) || defined(__clang__) return __builtin_ctzll(x); #elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) - unsigned long index = 0; + unsigned long index = 0; // NOLINT(runtime/int): the type _BitScan*64 takes _BitScanForward64(&index, x); return static_cast(index); #else diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 3e888b615..21eb1d95f 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -8884,7 +8884,7 @@ inline int count_leading_zeros(std::uint64_t x) noexcept #if defined(__GNUC__) || defined(__clang__) return __builtin_clzll(x); #elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) - unsigned long index = 0; + unsigned long index = 0; // NOLINT(runtime/int): the type _BitScan*64 takes _BitScanReverse64(&index, x); return 63 - static_cast(index); #else @@ -8907,7 +8907,7 @@ inline int count_trailing_zeros(std::uint64_t x) noexcept #if defined(__GNUC__) || defined(__clang__) return __builtin_ctzll(x); #elif defined(_MSC_VER) && (defined(_M_X64) || defined(_M_ARM64)) - unsigned long index = 0; + unsigned long index = 0; // NOLINT(runtime/int): the type _BitScan*64 takes _BitScanForward64(&index, x); return static_cast(index); #else diff --git a/tests/src/unit-to_chars.cpp b/tests/src/unit-to_chars.cpp index d8eb44434..c9b72fc97 100644 --- a/tests/src/unit-to_chars.cpp +++ b/tests/src/unit-to_chars.cpp @@ -837,6 +837,9 @@ TEST_CASE("choice of the conversion") SECTION("long double with the format of a double: Zmij") { // (on platforms where long double is wider, Grisu2 does not apply either: the snprintf fallback does) + // (constant on a given platform) + DOCTEST_MSVC_SUPPRESS_WARNING_PUSH + DOCTEST_MSVC_SUPPRESS_WARNING(4127) if (std::numeric_limits::digits == 53 && std::numeric_limits::is_iec559) { using long_double_json = nlohmann::json::with_float_t; @@ -850,5 +853,6 @@ TEST_CASE("choice of the conversion") } CHECK(long_double_json(5.3165205877497296e+16L).dump() == "5.31652058774973e+16"); } + DOCTEST_MSVC_SUPPRESS_WARNING_POP } }