Fix CI: unused parameter without exceptions, cpplint, BUILD.bazel
- json_sax_error_reporter::parse_error: mark the exception unused, as JSON_THROW does not use it with JSON_NOEXCEPTION - unit-contiguous_parser.cpp: compare the exceptions of both paths only when exceptions are enabled (invalid input aborted the test otherwise) - silence cpplint's readability/braces false positives on the if statements inside the parser's macros - add contiguous_parser.hpp to BUILD.bazel Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
4 files changed
+18
-14
No files matched your search
@@ -120,7 +120,7 @@ class contiguous_parser
|
||||
#define JSON_CONTIGUOUS_OPEN(is_object) \
|
||||
do \
|
||||
{ \
|
||||
if (JSON_HEDLEY_UNLIKELY(depth != 0 && (depth % 64) == 0)) \
|
||||
if (JSON_HEDLEY_UNLIKELY(depth != 0 && (depth % 64) == 0)) /* NOLINT(readability/braces) */ \
|
||||
{ \
|
||||
outer.push_back(kinds); \
|
||||
kinds = 0; \
|
||||
@@ -226,13 +226,13 @@ class contiguous_parser
|
||||
// what may follow a value in an array: a comma and the next value, or the end
|
||||
#define JSON_CONTIGUOUS_AFTER_ELEMENT \
|
||||
JSON_CONTIGUOUS_WS(); \
|
||||
if (JSON_HEDLEY_LIKELY(JSON_CONTIGUOUS_CUR() == ',')) \
|
||||
if (JSON_HEDLEY_LIKELY(JSON_CONTIGUOUS_CUR() == ',')) /* NOLINT(readability/braces) */ \
|
||||
{ \
|
||||
++p; \
|
||||
JSON_CONTIGUOUS_WS(); \
|
||||
goto array_value; \
|
||||
} \
|
||||
if (JSON_HEDLEY_LIKELY(JSON_CONTIGUOUS_CUR() == ']')) \
|
||||
if (JSON_HEDLEY_LIKELY(JSON_CONTIGUOUS_CUR() == ']')) /* NOLINT(readability/braces) */ \
|
||||
{ \
|
||||
++p; \
|
||||
if (JSON_HEDLEY_UNLIKELY(!report(sax->end_array()))) \
|
||||
@@ -246,13 +246,13 @@ class contiguous_parser
|
||||
// what may follow a value in an object: a comma and the next member, or the end
|
||||
#define JSON_CONTIGUOUS_AFTER_MEMBER \
|
||||
JSON_CONTIGUOUS_WS(); \
|
||||
if (JSON_HEDLEY_LIKELY(JSON_CONTIGUOUS_CUR() == ',')) \
|
||||
if (JSON_HEDLEY_LIKELY(JSON_CONTIGUOUS_CUR() == ',')) /* NOLINT(readability/braces) */ \
|
||||
{ \
|
||||
++p; \
|
||||
JSON_CONTIGUOUS_WS(); \
|
||||
goto object_key; \
|
||||
} \
|
||||
if (JSON_HEDLEY_LIKELY(JSON_CONTIGUOUS_CUR() == '}')) \
|
||||
if (JSON_HEDLEY_LIKELY(JSON_CONTIGUOUS_CUR() == '}')) /* NOLINT(readability/braces) */ \
|
||||
{ \
|
||||
++p; \
|
||||
if (JSON_HEDLEY_UNLIKELY(!report(sax->end_object()))) \
|
||||
@@ -836,6 +836,7 @@ class json_sax_error_reporter : public json_sax_acceptor<BasicJsonType>
|
||||
template<class Exception>
|
||||
bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const Exception& ex)
|
||||
{
|
||||
static_cast<void>(ex); // (unused without exceptions)
|
||||
if (allow_exceptions)
|
||||
{
|
||||
JSON_THROW(ex);
|
||||
|
||||
Reference in new issue
Block a user