From dd8cb2acc1e38b3dc06fce36b6688c662e59afe2 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 10 Aug 2020 20:48:39 +0200 Subject: [PATCH] :rotating_light: remove -Wimplicit-fallthrough warning #2348 --- include/nlohmann/detail/hash.hpp | 11 ++++++----- include/nlohmann/detail/input/binary_reader.hpp | 3 ++- single_include/nlohmann/json.hpp | 14 ++++++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/include/nlohmann/detail/hash.hpp b/include/nlohmann/detail/hash.hpp index 4094cc94fc..d2d5d332d3 100644 --- a/include/nlohmann/detail/hash.hpp +++ b/include/nlohmann/detail/hash.hpp @@ -83,19 +83,19 @@ std::size_t hash(const BasicJsonType& j) return combine(type, h); } - case nlohmann::detail::value_t::number_unsigned: + case BasicJsonType::value_t::number_unsigned: { const auto h = std::hash {}(j.template get()); return combine(type, h); } - case nlohmann::detail::value_t::number_float: + case BasicJsonType::value_t::number_float: { const auto h = std::hash {}(j.template get()); return combine(type, h); } - case nlohmann::detail::value_t::binary: + case BasicJsonType::value_t::binary: { auto seed = combine(type, j.get_binary().size()); const auto h = std::hash {}(j.get_binary().has_subtype()); @@ -108,8 +108,9 @@ std::size_t hash(const BasicJsonType& j) return seed; } - default: // LCOV_EXCL_LINE - JSON_ASSERT(false); // LCOV_EXCL_LINE + default: // LCOV_EXCL_LINE + JSON_ASSERT(false); // LCOV_EXCL_LINE + return 0; // LCOV_EXCL_LINE } } diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index 4c94d1ccfd..6ae5882c7e 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -752,8 +752,9 @@ class binary_reader return parse_cbor_internal(true, tag_handler); } - default: // LCOV_EXCL_LINE + default: // LCOV_EXCL_LINE JSON_ASSERT(false); // LCOV_EXCL_LINE + return false; // LCOV_EXCL_LINE } } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index b8c6d516ed..07ced71ace 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -4666,19 +4666,19 @@ std::size_t hash(const BasicJsonType& j) return combine(type, h); } - case nlohmann::detail::value_t::number_unsigned: + case BasicJsonType::value_t::number_unsigned: { const auto h = std::hash {}(j.template get()); return combine(type, h); } - case nlohmann::detail::value_t::number_float: + case BasicJsonType::value_t::number_float: { const auto h = std::hash {}(j.template get()); return combine(type, h); } - case nlohmann::detail::value_t::binary: + case BasicJsonType::value_t::binary: { auto seed = combine(type, j.get_binary().size()); const auto h = std::hash {}(j.get_binary().has_subtype()); @@ -4691,8 +4691,9 @@ std::size_t hash(const BasicJsonType& j) return seed; } - default: // LCOV_EXCL_LINE - JSON_ASSERT(false); // LCOV_EXCL_LINE + default: // LCOV_EXCL_LINE + JSON_ASSERT(false); // LCOV_EXCL_LINE + return 0; // LCOV_EXCL_LINE } } @@ -8391,8 +8392,9 @@ class binary_reader return parse_cbor_internal(true, tag_handler); } - default: // LCOV_EXCL_LINE + default: // LCOV_EXCL_LINE JSON_ASSERT(false); // LCOV_EXCL_LINE + return false; // LCOV_EXCL_LINE } }