📝 release preparation

pull/1202/head
Niels Lohmann 2018-08-18 12:00:14 +02:00
parent 6899fa304c
commit 3811daa8a3
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
7 changed files with 175 additions and 37 deletions

View File

@ -86,7 +86,7 @@ clean:
coverage:
mkdir build_coverage
cd build_coverage ; CXX=g++-5 cmake .. -GNinja -DJSON_Coverage=ON -DJSON_MultipleHeaders=ON
cd build_coverage ; CXX=g++-7 cmake .. -GNinja -DJSON_Coverage=ON -DJSON_MultipleHeaders=ON
cd build_coverage ; ninja
cd build_coverage ; ctest -E '.*_default' -j10
cd build_coverage ; ninja lcov_html

View File

@ -1046,6 +1046,16 @@ I deeply appreciate the help of the following people.
- [Carlos O'Ryan](https://github.com/coryan) fixed a typo.
- [James Upjohn](https://github.com/jammehcow) fixed a version number in the compilers section.
- [Chuck Atkins](https://github.com/chuckatkins) adjusted the CMake files to the CMake packaging guidelines
- [Jan Schöppach](https://github.com/dns13) fixed a typo.
- [martin-mfg](https://github.com/martin-mfg) fixed a typo.
- [Matthias Möller](https://github.com/TinyTinni) removed the dependency from `std::stringstream`.
- [agrianius](https://github.com/agrianius) added code to use alternative string implementations.
- [Daniel599](https://github.com/Daniel599) allowed to use more algorithms with the `items()` function.
- [Julius Rakow](https://github.com/jrakow) fixed the Meson include directory and fixed the links to [cppreference.com](cppreference.com).
- [Sonu Lohani](https://github.com/sonulohani) fixed the compilation with MSVC 2015 in debug mode.
- [grembo](https://github.com/grembo) fixed the test suite and re-enabled several test cases.
- [Hyeon Kim](https://github.com/simnalamburt) introduced the macro `JSON_INTERNAL_CATCH` to control the exception handling inside the library.
- [thyu](https://github.com/thyu) fixed a compiler warning.
Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone.

View File

@ -80,8 +80,10 @@ class binary_reader
result = parse_ubjson_internal();
break;
// LCOV_EXCL_START
default:
assert(false); // LCOV_EXCL_LINE
assert(false);
// LCOV_EXCL_STOP
}
// strict mode: next byte must be EOF

View File

@ -249,16 +249,18 @@ class json_sax_dom_parser
{
case 1:
JSON_THROW(*reinterpret_cast<const detail::parse_error*>(&ex));
case 2:
JSON_THROW(*reinterpret_cast<const detail::invalid_iterator*>(&ex)); // LCOV_EXCL_LINE
case 3:
JSON_THROW(*reinterpret_cast<const detail::type_error*>(&ex)); // LCOV_EXCL_LINE
case 4:
JSON_THROW(*reinterpret_cast<const detail::out_of_range*>(&ex));
// LCOV_EXCL_START
case 2:
JSON_THROW(*reinterpret_cast<const detail::invalid_iterator*>(&ex));
case 3:
JSON_THROW(*reinterpret_cast<const detail::type_error*>(&ex));
case 5:
JSON_THROW(*reinterpret_cast<const detail::other_error*>(&ex)); // LCOV_EXCL_LINE
JSON_THROW(*reinterpret_cast<const detail::other_error*>(&ex));
default:
assert(false); // LCOV_EXCL_LINE
assert(false);
// LCOV_EXCL_STOP
}
}
return false;
@ -505,16 +507,18 @@ class json_sax_dom_callback_parser
{
case 1:
JSON_THROW(*reinterpret_cast<const detail::parse_error*>(&ex));
case 2:
JSON_THROW(*reinterpret_cast<const detail::invalid_iterator*>(&ex)); // LCOV_EXCL_LINE
case 3:
JSON_THROW(*reinterpret_cast<const detail::type_error*>(&ex)); // LCOV_EXCL_LINE
case 4:
JSON_THROW(*reinterpret_cast<const detail::out_of_range*>(&ex));
// LCOV_EXCL_START
case 2:
JSON_THROW(*reinterpret_cast<const detail::invalid_iterator*>(&ex));
case 3:
JSON_THROW(*reinterpret_cast<const detail::type_error*>(&ex));
case 5:
JSON_THROW(*reinterpret_cast<const detail::other_error*>(&ex)); // LCOV_EXCL_LINE
JSON_THROW(*reinterpret_cast<const detail::other_error*>(&ex));
default:
assert(false); // LCOV_EXCL_LINE
assert(false);
// LCOV_EXCL_STOP
}
}
return false;

View File

@ -92,8 +92,10 @@ class lexer
return "end of input";
case token_type::literal_or_value:
return "'[', '{', or a literal";
// LCOV_EXCL_START
default: // catch non-enum values
return "unknown token"; // LCOV_EXCL_LINE
return "unknown token";
// LCOV_EXCL_STOP
}
}
@ -745,11 +747,13 @@ class lexer
goto scan_number_any1;
}
// LCOV_EXCL_START
default:
{
// all other characters are rejected outside scan_number()
assert(false); // LCOV_EXCL_LINE
assert(false);
}
// LCOV_EXCL_STOP
}
scan_number_minus:

View File

@ -1276,7 +1276,7 @@ class basic_json
was provided), strong guarantee holds: if an exception is thrown, there are
no changes to any JSON value.
@since version 3.1.2
@since version 3.2.0
*/
template <typename BasicJsonType,
detail::enable_if_t<
@ -2509,7 +2509,7 @@ class basic_json
@complexity Depending on the implementation of the called `from_json()`
method.
@since version 3.1.2
@since version 3.2.0
*/
template<typename BasicJsonType, detail::enable_if_t<
not std::is_same<BasicJsonType, basic_json>::value and
@ -6014,6 +6014,58 @@ class basic_json
return parser(i).accept(true);
}
/*!
@brief generate SAX events
The SAX event lister must follow the interface of @ref json_sax.
This function reads from a compatible input. Examples are:
- an array of 1-byte values
- strings with character/literal type with size of 1 byte
- input streams
- container with contiguous storage of 1-byte values. Compatible container
types include `std::vector`, `std::string`, `std::array`,
`std::valarray`, and `std::initializer_list`. Furthermore, C-style
arrays can be used with `std::begin()`/`std::end()`. User-defined
containers can be used as long as they implement random-access iterators
and a contiguous storage.
@pre Each element of the container has a size of 1 byte. Violating this
precondition yields undefined behavior. **This precondition is enforced
with a static assertion.**
@pre The container storage is contiguous. Violating this precondition
yields undefined behavior. **This precondition is enforced with an
assertion.**
@pre Each element of the container has a size of 1 byte. Violating this
precondition yields undefined behavior. **This precondition is enforced
with a static assertion.**
@warning There is no way to enforce all preconditions at compile-time. If
the function is called with a noncompliant container and with
assertions switched off, the behavior is undefined and will most
likely yield segmentation violation.
@param[in] i input to read from
@param[in,out] sax SAX event listener
@param[in] format the format to parse (JSON, CBOR, MessagePack, or UBJSON)
@param[in] strict whether the input has to be consumed completely
@return return value of the last processed SAX event
@throw parse_error.101 if a parse error occurs; example: `""unexpected end
of input; expected string literal""`
@throw parse_error.102 if to_unicode fails or surrogate error
@throw parse_error.103 if to_unicode fails
@complexity Linear in the length of the input. The parser is a predictive
LL(1) parser. The complexity can be higher if the SAX consumer @a sax has
a super-linear complexity.
@note A UTF-8 byte order mark is silently ignored.
@since version 3.2.0
*/
template <typename SAX>
static bool sax_parse(detail::input_adapter&& i, SAX* sax,
input_format_t format = input_format_t::json,
@ -7215,11 +7267,13 @@ class basic_json
break;
}
// LCOV_EXCL_START
default:
{
// if there exists a parent it cannot be primitive
assert(false); // LCOV_EXCL_LINE
assert(false);
}
// LCOV_EXCL_STOP
}
}
};

View File

@ -2307,8 +2307,10 @@ class lexer
return "end of input";
case token_type::literal_or_value:
return "'[', '{', or a literal";
// LCOV_EXCL_START
default: // catch non-enum values
return "unknown token"; // LCOV_EXCL_LINE
return "unknown token";
// LCOV_EXCL_STOP
}
}
@ -2960,11 +2962,13 @@ class lexer
goto scan_number_any1;
}
// LCOV_EXCL_START
default:
{
// all other characters are rejected outside scan_number()
assert(false); // LCOV_EXCL_LINE
assert(false);
}
// LCOV_EXCL_STOP
}
scan_number_minus:
@ -4025,16 +4029,18 @@ class json_sax_dom_parser
{
case 1:
JSON_THROW(*reinterpret_cast<const detail::parse_error*>(&ex));
case 2:
JSON_THROW(*reinterpret_cast<const detail::invalid_iterator*>(&ex)); // LCOV_EXCL_LINE
case 3:
JSON_THROW(*reinterpret_cast<const detail::type_error*>(&ex)); // LCOV_EXCL_LINE
case 4:
JSON_THROW(*reinterpret_cast<const detail::out_of_range*>(&ex));
// LCOV_EXCL_START
case 2:
JSON_THROW(*reinterpret_cast<const detail::invalid_iterator*>(&ex));
case 3:
JSON_THROW(*reinterpret_cast<const detail::type_error*>(&ex));
case 5:
JSON_THROW(*reinterpret_cast<const detail::other_error*>(&ex)); // LCOV_EXCL_LINE
JSON_THROW(*reinterpret_cast<const detail::other_error*>(&ex));
default:
assert(false); // LCOV_EXCL_LINE
assert(false);
// LCOV_EXCL_STOP
}
}
return false;
@ -4281,16 +4287,18 @@ class json_sax_dom_callback_parser
{
case 1:
JSON_THROW(*reinterpret_cast<const detail::parse_error*>(&ex));
case 2:
JSON_THROW(*reinterpret_cast<const detail::invalid_iterator*>(&ex)); // LCOV_EXCL_LINE
case 3:
JSON_THROW(*reinterpret_cast<const detail::type_error*>(&ex)); // LCOV_EXCL_LINE
case 4:
JSON_THROW(*reinterpret_cast<const detail::out_of_range*>(&ex));
// LCOV_EXCL_START
case 2:
JSON_THROW(*reinterpret_cast<const detail::invalid_iterator*>(&ex));
case 3:
JSON_THROW(*reinterpret_cast<const detail::type_error*>(&ex));
case 5:
JSON_THROW(*reinterpret_cast<const detail::other_error*>(&ex)); // LCOV_EXCL_LINE
JSON_THROW(*reinterpret_cast<const detail::other_error*>(&ex));
default:
assert(false); // LCOV_EXCL_LINE
assert(false);
// LCOV_EXCL_STOP
}
}
return false;
@ -6049,8 +6057,10 @@ class binary_reader
result = parse_ubjson_internal();
break;
// LCOV_EXCL_START
default:
assert(false); // LCOV_EXCL_LINE
assert(false);
// LCOV_EXCL_STOP
}
// strict mode: next byte must be EOF
@ -12372,7 +12382,7 @@ class basic_json
was provided), strong guarantee holds: if an exception is thrown, there are
no changes to any JSON value.
@since version 3.1.2
@since version 3.2.0
*/
template <typename BasicJsonType,
detail::enable_if_t<
@ -13605,7 +13615,7 @@ class basic_json
@complexity Depending on the implementation of the called `from_json()`
method.
@since version 3.1.2
@since version 3.2.0
*/
template<typename BasicJsonType, detail::enable_if_t<
not std::is_same<BasicJsonType, basic_json>::value and
@ -17110,6 +17120,58 @@ class basic_json
return parser(i).accept(true);
}
/*!
@brief generate SAX events
The SAX event lister must follow the interface of @ref json_sax.
This function reads from a compatible input. Examples are:
- an array of 1-byte values
- strings with character/literal type with size of 1 byte
- input streams
- container with contiguous storage of 1-byte values. Compatible container
types include `std::vector`, `std::string`, `std::array`,
`std::valarray`, and `std::initializer_list`. Furthermore, C-style
arrays can be used with `std::begin()`/`std::end()`. User-defined
containers can be used as long as they implement random-access iterators
and a contiguous storage.
@pre Each element of the container has a size of 1 byte. Violating this
precondition yields undefined behavior. **This precondition is enforced
with a static assertion.**
@pre The container storage is contiguous. Violating this precondition
yields undefined behavior. **This precondition is enforced with an
assertion.**
@pre Each element of the container has a size of 1 byte. Violating this
precondition yields undefined behavior. **This precondition is enforced
with a static assertion.**
@warning There is no way to enforce all preconditions at compile-time. If
the function is called with a noncompliant container and with
assertions switched off, the behavior is undefined and will most
likely yield segmentation violation.
@param[in] i input to read from
@param[in,out] sax SAX event listener
@param[in] format the format to parse (JSON, CBOR, MessagePack, or UBJSON)
@param[in] strict whether the input has to be consumed completely
@return result of the deserialization
@throw parse_error.101 if a parse error occurs; example: `""unexpected end
of input; expected string literal""`
@throw parse_error.102 if to_unicode fails or surrogate error
@throw parse_error.103 if to_unicode fails
@complexity Linear in the length of the input. The parser is a predictive
LL(1) parser. The complexity can be higher if the SAX consumer @a sax has
a super-linear complexity.
@note A UTF-8 byte order mark is silently ignored.
@since version 3.2.0
*/
template <typename SAX>
static bool sax_parse(detail::input_adapter&& i, SAX* sax,
input_format_t format = input_format_t::json,
@ -18311,11 +18373,13 @@ class basic_json
break;
}
// LCOV_EXCL_START
default:
{
// if there exists a parent it cannot be primitive
assert(false); // LCOV_EXCL_LINE
assert(false);
}
// LCOV_EXCL_STOP
}
}
};