🚨 remove -Wimplicit-fallthrough warning #2348

This commit is contained in:
Niels Lohmann committed 2020-08-10 20:48:39 +02:00
1 parent 1b28a58280
commit dd8cb2acc1
3 files changed
+16 -12

No files matched your search

+6 -5
View File
@@ -83,19 +83,19 @@ std::size_t hash(const BasicJsonType& j)
return combine(type, h); return combine(type, h);
} }
case nlohmann::detail::value_t::number_unsigned: case BasicJsonType::value_t::number_unsigned:
{ {
const auto h = std::hash<number_unsigned_t> {}(j.template get<number_unsigned_t>()); const auto h = std::hash<number_unsigned_t> {}(j.template get<number_unsigned_t>());
return combine(type, h); return combine(type, h);
} }
case nlohmann::detail::value_t::number_float: case BasicJsonType::value_t::number_float:
{ {
const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>()); const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>());
return combine(type, h); return combine(type, h);
} }
case nlohmann::detail::value_t::binary: case BasicJsonType::value_t::binary:
{ {
auto seed = combine(type, j.get_binary().size()); auto seed = combine(type, j.get_binary().size());
const auto h = std::hash<bool> {}(j.get_binary().has_subtype()); const auto h = std::hash<bool> {}(j.get_binary().has_subtype());
@@ -108,8 +108,9 @@ std::size_t hash(const BasicJsonType& j)
return seed; return seed;
} }
default: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE
JSON_ASSERT(false); // LCOV_EXCL_LINE JSON_ASSERT(false); // LCOV_EXCL_LINE
return 0; // LCOV_EXCL_LINE
} }
} }
@@ -752,8 +752,9 @@ class binary_reader
return parse_cbor_internal(true, tag_handler); return parse_cbor_internal(true, tag_handler);
} }
default: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE
JSON_ASSERT(false); // LCOV_EXCL_LINE JSON_ASSERT(false); // LCOV_EXCL_LINE
return false; // LCOV_EXCL_LINE
} }
} }
+8 -6
View File
@@ -4666,19 +4666,19 @@ std::size_t hash(const BasicJsonType& j)
return combine(type, h); return combine(type, h);
} }
case nlohmann::detail::value_t::number_unsigned: case BasicJsonType::value_t::number_unsigned:
{ {
const auto h = std::hash<number_unsigned_t> {}(j.template get<number_unsigned_t>()); const auto h = std::hash<number_unsigned_t> {}(j.template get<number_unsigned_t>());
return combine(type, h); return combine(type, h);
} }
case nlohmann::detail::value_t::number_float: case BasicJsonType::value_t::number_float:
{ {
const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>()); const auto h = std::hash<number_float_t> {}(j.template get<number_float_t>());
return combine(type, h); return combine(type, h);
} }
case nlohmann::detail::value_t::binary: case BasicJsonType::value_t::binary:
{ {
auto seed = combine(type, j.get_binary().size()); auto seed = combine(type, j.get_binary().size());
const auto h = std::hash<bool> {}(j.get_binary().has_subtype()); const auto h = std::hash<bool> {}(j.get_binary().has_subtype());
@@ -4691,8 +4691,9 @@ std::size_t hash(const BasicJsonType& j)
return seed; return seed;
} }
default: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE
JSON_ASSERT(false); // 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); return parse_cbor_internal(true, tag_handler);
} }
default: // LCOV_EXCL_LINE default: // LCOV_EXCL_LINE
JSON_ASSERT(false); // LCOV_EXCL_LINE JSON_ASSERT(false); // LCOV_EXCL_LINE
return false; // LCOV_EXCL_LINE
} }
} }