- Mark the parameters of the new out-of-line throw helpers in json.hpp as
used, as JSON_THROW drops its argument with JSON_NOEXCEPTION (clang
-Wunused-parameter).
- all_children_leaves() iterates with begin()/end() via std::all_of: a
custom array_t such as the one in the custom_array_type example has no
rbegin() (examples check, clang-tidy readability-use-anyofallof).
- The rvalue to_json overloads (#5837) copy the elements of containers
with const elements such as std::set instead of moving them: GCC 4.9's
std::move_iterator cannot bind them. Object types are ruled out before
std::ranges::view is checked, which needs an incomplete ordered_json
for its object_t (GCC 11, C++20, unit-regression3 #3312).
- NOLINT the rvalue to_json parameters that are deliberately not
forwarded, and fix the other clang-tidy findings (modernize-use-auto in
zmij.hpp, readability-math-missing-parentheses in json_pointer.hpp).
- cpplint: NOLINT(readability/braces) on the new scalar fast-path macro
like on JSON_IMPLEMENT_OPERATOR, and include <map> in json.hpp.
- Tests: drop a useless cast (GCC -Wuseless-cast) and a signed/unsigned
comparison (MSVC C4018), wrap a vector<json> comparison in parentheses
so doctest does not try to print it (ambiguous operator<< on MSVC), and
also strip JSON_DIAGNOSTIC_POSITIONS' "(bytes x-y) " from the patch
messages in unit-throw_messages.
- Windows clang (MinGW): link with LLD. unit-msgpack.cpp (C++11) and
unit-regression2.cpp (C++20) have more than 32767 sections again
(33363 and 33197), which GNU ld cannot link; LLD links them.
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
patch_inplace() built its error messages inline. In particular get_value()
concatenated the context-sensitive "operation 'x'" string on every call, even
when nothing was wrong. The patch exceptions now come from NEVER_INLINE
helpers: the index and key errors reuse basic_json's existing
throw_array_index_out_of_range/throw_key_not_found, and the seven
patch-specific messages get one helper each in detail/exceptions.hpp. Ids
and messages are unchanged, and unit-throw_messages pins them (with and
without JSON_DIAGNOSTICS).
citm_catalog patch: -6.6 % (Apple clang), -9.5 % (GCC 16).
The other remaining throw sites (parser::syntax_error, binary_writer,
serializer, input_adapters, enum_key_duplicate, format_error) were prototyped
and measured: no gain beyond noise, so they stay as they are.
Signed-off-by: Niels Lohmann <mail@nlohmann.me>