Skip to content

Fix CI failures on develop from the API performance stack - #5860

Merged
nlohmann merged 9 commits into
developfrom
fix/develop-ci-2026-10-16
Oct 16, 2026
Merged

nlohmann merged 9 commits into
developfrom
fix/develop-ci-2026-10-16

Conversation

@nlohmann

Copy link
Copy Markdown
Owner

Develop is red since the API performance stack (#5831–#5842) was merged; every open PR inherits these failures. This fixes all failures of the last develop run (5683f5e):

Job Cause Fix
ci_test_standards_clang (14, libstdcxx) (noexcept test) new throw helpers in json.hpp leave their parameters unused with JSON_NOEXCEPTION static_cast<void>(...) like the helpers in exceptions.hpp
ci_test_documentation (ci_test_examples) all_children_leaves() (#5835) calls rbegin(), which custom_array_type lacks iterate forward with std::all_of (also fixes clang-tidy readability-use-anyofallof)
ci_test_compilers_gcc_old (4.9) rvalue to_json (#5837) moves from std::set's const elements; GCC 4.9's move_iterator cannot bind them only use a move iterator for mutable elements
ci_test_compilers_gcc (11) (regression3, C++20) the rvalue array trait checks std::ranges::view for ordered_map, which needs the incomplete ordered_json (#3312) rule out object types before views
ci_clang_tidy missing-std-forward, use-auto, math-missing-parentheses, use-anyofallof NOLINT the deliberate non-forwarding, fix the rest
ci_cpplint braces in the new scalar fast-path macro; std::map without <map> same NOLINT as JSON_IMPLEMENT_OPERATOR; include <map>
ci_test_gcc, ci_test_standards_gcc (11) useless cast in unit-json_pointer.cpp drop it
MSVC C4018 in unit-serialization.cpp; doctest tries to print vector<json> (ambiguous operator<< with ordered_json) in unit-constructor2.cpp unsigned literals; CHECK((copy == v))
ci_test_diagnostic_positions unit-throw_messages stripped only the JSON_DIAGNOSTICS prefix also strip (bytes x-y)
Windows clang (NN) (MinGW) unit-msgpack.cpp (C++11) and unit-regression2.cpp (C++20) exceed 32767 COFF sections again (33363/33197), which GNU ld cannot link link with LLD (-fuse-ld=lld), which ends the repeated test-file splitting

Verified locally: gcc 4.9 and gcc 11 (Docker) build and pass the affected tests; clang builds of the touched tests with -Werror pass, with and without diagnostics/positions; cpplint is clean; LLD links the MinGW test-msgpack object that GNU ld rejects (Docker, clang 18). Running the MinGW binaries and clang-tidy is left to CI.

Breaking changes

No breaking changes. Rvalue std::set-like containers with const elements are now copied element by element instead of failing to compile on GCC 4.9; their observable result is unchanged.

🤖 Generated with Claude Code

- 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>
- ci_test_noexceptions: the JSON Patch section of unit-throw_messages
  and the strict dumps in unit-serialization catch exceptions, which
  JSON_NOEXCEPTION turns into std::abort(); skip them there.
- ci_cppcheck: insert() and iter_impl::key() ended with a call to a
  noreturn throw helper, which Cppcheck reports as missingReturn; check
  the error case first and end with the return, like the other functions.
- ci_single_binaries: ordered_map.hpp uses the Hedley macros since #5838,
  so include hedley.hpp (IWYU).
- MSVC: also wrap the second vector<json> comparison in unit-constructor2
  in parentheses.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
- object_capacity() (#5832) overloaded a static with a non-static member
  function template, which MSVC 2015 rejects (C2686); make all three
  overloads non-static.
- The JSON pointer hash constants (#5836) truncate on 32-bit size_t
  (C4309 with /WX); mask them to size_t's range before the cast.
- unit-diagnostics: MSVC 2015 cannot use-declare the base's Container
  typedef (C2886); use alias declarations instead.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
- unit-iterators1 (#5835) converted a json element to int implicitly,
  which does not compile with JSON_USE_IMPLICIT_CONVERSIONS=0.
- unit-testsuites parses a number followed by a NUL byte, which
  JSON_STRICT_NUL_HANDLING rejects; leave the NUL out in strict mode.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
The cast is useless where size_t is uint64_t (GCC -Wuseless-cast); the
mask alone already keeps the constants in size_t's range.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
- make_move_iterator_if_mutable takes the iterator by const reference
  (performance-unnecessary-value-param).
- throw_patch_missing_member builds its message without a local that
  is unused with JSON_NOEXCEPTION (bugprone-unused-local-non-trivial-variable).
- Tests: NOLINT the copies that test the copy constructor and the
  constant mt19937 seed, NOLINT the deliberate "\xC3" "a" literal
  concatenation, use references for the const views in
  unit-throw_messages and return {} from its lambda.

A full clang-tidy 22 run over all 107 test translation units is clean.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
… 2017

MSVC 2017 (/permissive- /std:c++17) rejects the braced std::vector<int>
temporary inside CHECK() in this templated test case (C2440).

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Comment thread tests/src/unit-testsuites.cpp Outdated
n1e308[1] = '1';
n1e308[310] = ']';
#if JSON_STRICT_NUL_HANDLING
n1e308.resize(311); // a NUL byte after the value is a syntax error in strict mode

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pop_back() so the number can't get out of sync?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 291dc5e: pop_back() now drops the last character, so the length is only stated once.

Written by Claude Code.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann
nlohmann merged commit cd6b428 into develop Oct 16, 2026
3 of 167 checks passed
@nlohmann
nlohmann deleted the fix/develop-ci-2026-10-16 branch October 16, 2026 17:16
nlohmann added a commit that referenced this pull request Oct 16, 2026
Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Append to the output vector through a position-tracking sink
- Write CBOR integers without branching on their sign or size
- Write MessagePack integers without branching on their sign or size
- Use std::array for the integer size class table
- Fix clang-tidy and GCC warnings in the integer array test
- Regenerate the amalgamation

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 16, 2026
Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Fix silent wrong results for custom number types
- Fix CI: build the out_of_range.407 message from string_t and fix a link
- Fix CI: diagnostics message, clang-tidy, and MinGW section limit
- Format the out_of_range.407 number without dump()
- Move the std::deque array test out of unit-regression3.cpp
- Fix clang-tidy and clang 3.4/3.5 failures in the custom number type changes
- Fix CI: cast the 128-bit unsigned value explicitly in the integer fast path

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 16, 2026
Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Let the lexer's bulk fast paths run on a window of the input
- Scan the get area of an input stream in bulk
- Lock a FILE once per parse instead of once per character
- Add benchmarks for parsing from a FILE* and for many values from a stream
- Avoid implicit unsigned char to char conversion in stream tests
- Make file_input_adapter::unlock() safe to call on a moved-from adapter

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 16, 2026
…onversions

Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Add benchmarks for SAX parsing, value operations, JSON Pointer, and conversions
- Time copies together with their destruction in the benchmarks
- Time destroying the json in ToJsonStrings

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 17, 2026
Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Append to the output vector through a position-tracking sink
- Write CBOR integers without branching on their sign or size
- Write MessagePack integers without branching on their sign or size
- Use std::array for the integer size class table
- Fix clang-tidy and GCC warnings in the integer array test
- Regenerate the amalgamation

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 17, 2026
…onversions

Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Add benchmarks for SAX parsing, value operations, JSON Pointer, and conversions
- Time copies together with their destruction in the benchmarks
- Time destroying the json in ToJsonStrings

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 17, 2026
Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Let the lexer's bulk fast paths run on a window of the input
- Scan the get area of an input stream in bulk
- Lock a FILE once per parse instead of once per character
- Add benchmarks for parsing from a FILE* and for many values from a stream
- Avoid implicit unsigned char to char conversion in stream tests
- Make file_input_adapter::unlock() safe to call on a moved-from adapter

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 19, 2026
* Make parsing from std::istream and FILE* fast

Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Let the lexer's bulk fast paths run on a window of the input
- Scan the get area of an input stream in bulk
- Lock a FILE once per parse instead of once per character
- Add benchmarks for parsing from a FILE* and for many values from a stream
- Avoid implicit unsigned char to char conversion in stream tests
- Make file_input_adapter::unlock() safe to call on a moved-from adapter

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Add ABI tags for JSON_DISABLE_STREAM_BULK_SCAN and JSON_DISABLE_UNLOCKED_FILE_IO

Both macros select between two definitions of an input adapter, so
translation units compiled with different settings violated the ODR when
linked together. Like the other ABI-affecting macros, they now append a
tag to the inline namespace: _dsbs and _dufio. Their defaults move to
abi_macros.hpp so that json_fwd.hpp sees them, and the natvis file is
regenerated for the new namespaces.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Skip the exception-only checks of the stream input tests without exceptions

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 20, 2026
…onversions

Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Add benchmarks for SAX parsing, value operations, JSON Pointer, and conversions
- Time copies together with their destruction in the benchmarks
- Time destroying the json in ToJsonStrings

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 21, 2026
* Speed up writing CBOR and MessagePack, above all integer arrays

Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Append to the output vector through a position-tracking sink
- Write CBOR integers without branching on their sign or size
- Write MessagePack integers without branching on their sign or size
- Use std::array for the integer size class table
- Fix clang-tidy and GCC warnings in the integer array test
- Regenerate the amalgamation

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Convert the streamed bytes explicitly in the binary writer sink tests

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 21, 2026
Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Fix silent wrong results for custom number types
- Fix CI: build the out_of_range.407 message from string_t and fix a link
- Fix CI: diagnostics message, clang-tidy, and MinGW section limit
- Format the out_of_range.407 number without dump()
- Move the std::deque array test out of unit-regression3.cpp
- Fix clang-tidy and clang 3.4/3.5 failures in the custom number type changes
- Fix CI: cast the 128-bit unsigned value explicitly in the integer fast path

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 21, 2026
* Fix silent wrong results for custom number types

Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Fix silent wrong results for custom number types
- Fix CI: build the out_of_range.407 message from string_t and fix a link
- Fix CI: diagnostics message, clang-tidy, and MinGW section limit
- Format the out_of_range.407 number without dump()
- Move the std::deque array test out of unit-regression3.cpp
- Fix clang-tidy and clang 3.4/3.5 failures in the custom number type changes
- Fix CI: cast the 128-bit unsigned value explicitly in the integer fast path

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Name the range checks of integer_fits_max/min

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 21, 2026
…onversions

Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Add benchmarks for SAX parsing, value operations, JSON Pointer, and conversions
- Time copies together with their destruction in the benchmarks
- Time destroying the json in ToJsonStrings

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann added a commit that referenced this pull request Oct 21, 2026
…onversions (#5845)

Squashed onto develop cd6b428 (CI fixes from #5860). Original commits:

- Add benchmarks for SAX parsing, value operations, JSON Pointer, and conversions
- Time copies together with their destruction in the benchmarks
- Time destroying the json in ToJsonStrings

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants