Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove -Wimplicit-fallthrough warning #2349

Merged
merged 1 commit into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions include/nlohmann/detail/hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<number_unsigned_t> {}(j.template get<number_unsigned_t>());
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>());
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<bool> {}(j.get_binary().has_subtype());
Expand All @@ -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
}
}

Expand Down
3 changes: 2 additions & 1 deletion include/nlohmann/detail/input/binary_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
14 changes: 8 additions & 6 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<number_unsigned_t> {}(j.template get<number_unsigned_t>());
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>());
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<bool> {}(j.get_binary().has_subtype());
Expand All @@ -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
}
}

Expand Down Expand Up @@ -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
}
}

Expand Down