1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-29 23:01:16 +03:00

Merge pull request #2274 from nlohmann/analyzers

Clean up maintainer Makefiles and fix some linter warnings
This commit is contained in:
Niels Lohmann
2020-07-17 14:01:19 +02:00
committed by GitHub
6 changed files with 31 additions and 199 deletions

View File

@ -4619,7 +4619,7 @@ class file_input_adapter
using char_type = char;
JSON_HEDLEY_NON_NULL(2)
explicit file_input_adapter(std::FILE* f) noexcept
explicit file_input_adapter(std::FILE* f) noexcept
: m_file(f)
{}
@ -4673,7 +4673,7 @@ class input_stream_adapter
input_stream_adapter& operator=(input_stream_adapter&) = delete;
input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
input_stream_adapter(input_stream_adapter&& rhs) : is(rhs.is), sb(rhs.sb)
input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs.is), sb(rhs.sb)
{
rhs.is = nullptr;
rhs.sb = nullptr;
@ -5299,30 +5299,14 @@ class json_sax_dom_parser
return true;
}
template<class Exception>
bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,
const detail::exception& ex)
const Exception& ex)
{
errored = true;
if (allow_exceptions)
{
// determine the proper exception type from the id
switch ((ex.id / 100) % 100)
{
case 1:
JSON_THROW(*dynamic_cast<const detail::parse_error*>(&ex));
case 4:
JSON_THROW(*dynamic_cast<const detail::out_of_range*>(&ex));
// LCOV_EXCL_START
case 2:
JSON_THROW(*dynamic_cast<const detail::invalid_iterator*>(&ex));
case 3:
JSON_THROW(*dynamic_cast<const detail::type_error*>(&ex));
case 5:
JSON_THROW(*dynamic_cast<const detail::other_error*>(&ex));
default:
JSON_ASSERT(false);
// LCOV_EXCL_STOP
}
JSON_THROW(ex);
}
return false;
}
@ -5553,30 +5537,14 @@ class json_sax_dom_callback_parser
return true;
}
template<class Exception>
bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,
const detail::exception& ex)
const Exception& ex)
{
errored = true;
if (allow_exceptions)
{
// determine the proper exception type from the id
switch ((ex.id / 100) % 100)
{
case 1:
JSON_THROW(*dynamic_cast<const detail::parse_error*>(&ex));
case 4:
JSON_THROW(*dynamic_cast<const detail::out_of_range*>(&ex));
// LCOV_EXCL_START
case 2:
JSON_THROW(*dynamic_cast<const detail::invalid_iterator*>(&ex));
case 3:
JSON_THROW(*dynamic_cast<const detail::type_error*>(&ex));
case 5:
JSON_THROW(*dynamic_cast<const detail::other_error*>(&ex));
default:
JSON_ASSERT(false);
// LCOV_EXCL_STOP
}
JSON_THROW(ex);
}
return false;
}
@ -9823,7 +9791,6 @@ scan_number_done:
// skip following whitespace
skip_whitespace();
}
while (current == ' ' || current == '\t' || current == '\n' || current == '\r');
switch (current)
{