Skip to content

Fix CI on develop - #5750

Merged
nlohmann merged 3 commits into
developfrom
fix/develop-ci-2026-10
Oct 2, 2026
Merged

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

Conversation

@nlohmann

@nlohmann nlohmann commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Develop has had no green Ubuntu or Windows run since 09-23 (1054b20). Several PRs merged in the meantime while the Actions queue was backed up, and two CI tools were updated (gcc:latest → GCC 16.2, clang-tidy 22.0 → 22.1.8). This PR fixes every failure I could find on develop 6aec1a0. It also unblocks #5744, #5743, and #5638, which fail only because of develop.

CI configuration

  • GCC jobs (ci_test_gcc, ci_test_standards_gcc): -Wexperimental-fmv-target, added in Fix lint debt: enum-macro NOLINTs, doctest as SYSTEM, no-op analyzer #5737, is aarch64-only, so amd64 GCC 16 rejects it. Removed.
  • ci_cmake_flags, ci_module_cpp20: the checksum command in ci_get_cmake lacked VERBATIM, so $' broke the generated Makefile and build.ninja. The CMake 3.5.0 download also failed twice, because its checksum file and archive directory both spell it Linux-x86_64.
  • ci_single_binaries: json.hpp's IWYU findings are meant to be informational, but --error still failed its build.
  • ci_clang_tidy, ci_test_clang*: Fix lint debt: enum-macro NOLINTs, doctest as SYSTEM, no-op analyzer #5737 removed the blanket -Wno-deprecated, but several tests call deprecated functions on purpose. This restores only -Wno-deprecated-declarations, so -Wfloat-equal stays active. It also turns off clang-tidy 22.1's new misc-use-internal-linkage checking of types (100 test helper types) and includes fifo_map as SYSTEM.

Library

Tests

  • Deep copy of a value nested more than 128 levels crashes when an allocation fails #5640 allocator test: skipped under MSVC STL iterator debugging (clang-cl and MSVC Debug). There, containers allocate a debug proxy inside noexcept move constructors, so a failing allocation calls std::terminate.
  • unit-conversions: expects the more accurate (/0) path when JSON_DIAGNOSTICS is on.
  • Strict-enum comparisons: now done via get<>(). See the note below.
  • Remaining fixes: -Wexit-time-destructors, -Wsign-conversion (amd64 only), and smaller clang-tidy 22.1 findings in the tests.
  • Infer (ci_infer): 8 new findings, all false positives. They are suppressed per line with @infer-ignore instead of extending the type-level baseline in .inferconfig.

Verification

  • Run locally in the CI containers (native arm64):

    • ci_test_gcc (gcc:latest, full warning set)
    • ci_test_clang_libcxx_cxx11
    • ci_test_diagnostics
    • ci_clang_tidy (silkeh/clang:22 + clang-tools, same as CI)

    All are clean. The only failures were the git_required FetchContent tests, which fail in Docker because a git worktree can't be cloned there.

  • Tested once on amd64: the CMake 3.5.0 download and checksum, under both Ninja and Makefiles. 3.31.6 and 4.0.0 aren't confirmed yet.

  • make check-amalgamation: passes.

  • Not reproducible locally: the MSVC/clang-cl changes and whether Infer honors the @infer-ignore placement. They are based on the CI logs; this PR's own CI is the check.

Note: strict enums and operator==

operator==(ScalarType, const_reference) is noexcept, but converting a NLOHMANN_JSON_SERIALIZE_ENUM_STRICT enum can throw, so comparing an out-of-range value with json calls std::terminate. clang-tidy now reports this. This PR only changes the tests; whether to change the operator is a separate API decision.

Public API

No breaking changes. The only behavior change is that arrays built from C++20 range views now have correct parent pointers with JSON_DIAGNOSTICS. Everything else is casts, pragmas, includes, comments, CI configuration, and tests.

🤖 Generated with Claude Code

- gcc_flags.cmake: drop -Wexperimental-fmv-target, which GCC 16 accepts
  only on aarch64; amd64 rejects it, so every GCC job failed while
  checking the compiler.
- ci_get_cmake: add VERBATIM so the checksum pipeline is passed to the
  shell intact (the unescaped `$'` broke the generated Makefile and
  build.ninja, failing ci_cmake_flags and ci_module_cpp20); match the
  SHA-256 entry case-insensitively, as CMake 3.5.0 lists the archive as
  "Linux-x86_64"; and unpack with --strip-components, as that archive's
  top-level directory is spelled "Linux" too.
- ci_single_binaries: compile json.hpp's TU without IWYU's --error, as
  the comment above the gate already intends.
- tests: restore -Wno-deprecated-declarations for all non-MSVC compilers
  (#5737 kept it for GCC only), as several tests call deprecated
  functions on purpose; include thirdparty/fifo_map as SYSTEM.
- .clang-tidy: set misc-use-internal-linkage.AnalyzeTypes to false;
  clang-tidy 22.1 extended the check to classes and enums and flagged
  100 test helper types.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
- binary_reader: pass integers to sax->number_integer() through
  conditional_static_cast<number_integer_t>, making the existing
  narrowing for a narrow number_integer_t explicit (MSVC C4244 and GCC
  -Wconversion/-Warith-conversion with the int16_t test from #5694);
  mark two Infer DEAD_STORE false positives with @infer-ignore.
- to_json: set the parents of an array built from a C++20 range view
  after all elements are in place; a reallocating push_back moved the
  earlier elements and left their parent pointers stale, failing the
  JSON_DIAGNOSTICS invariant assertion.
- json.hpp: suppress MSVC C4127 for the new is_ordered_map check in
  diff(), like the three existing ones; spell out std::formatter::parse's
  return and iterator types for clang-tidy 22.1.
- number_parse: make the Eisel-Lemire digit counter unsigned
  (GCC -Wstrict-overflow).
- string_utils: take encode_utf8's callable by const reference
  (cppcoreguidelines-missing-std-forward) and drop a \u from its doc
  comment (-Wdocumentation-unknown-command).
- ordered_map: include <memory> for std::allocator (cpplint).

Ran make amalgamate.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
- unit-allocator: skip the #5640 test under MSVC STL iterator debugging,
  where containers allocate a debug proxy in noexcept move constructors
  and a failing allocation terminates; move a decrement out of an if
  condition (bugprone-inc-dec-in-conditions).
- unit-conversions: expect the "(/0)" path with JSON_DIAGNOSTICS;
  compare strict enums via get<>() rather than through the noexcept
  operator==(ScalarType, json), which bugprone-exception-escape flags.
- unit-alt-string: suppress -Wexit-time-destructors for the strict enum
  macro and misc-use-internal-linkage for its enum.
- unit-bjdata: call the static lookup functions through the type and
  pass unsigned char (-Wsign-conversion on amd64).
- Mark Infer false positives with @infer-ignore in unit-diagnostics,
  unit-pointer_access, unit-udt, and unit-conversions.
- Smaller clang-tidy 22.1 findings in unit-class_parser,
  unit-constructor2, unit-custom-base-class, unit-locale-cpp, and
  unit-noexcept.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann
nlohmann added this pull request to stack #5752 October 2, 2026 08:19
@nlohmann
nlohmann merged commit 4d46bce into develop Oct 2, 2026
94 of 162 checks passed
@nlohmann nlohmann added this to the Release 3.13.0 milestone Oct 2, 2026
@nlohmann
nlohmann deleted the fix/develop-ci-2026-10 branch October 2, 2026 09:23
@github-actions github-actions Bot added aspect: binary formats BSON, CBOR, MessagePack, UBJSON L tests CMake labels Oct 2, 2026
SA-gitlab-to-github pushed a commit to DarkhiveAI/dh-fork-json that referenced this pull request Oct 3, 2026
Conflicts:
- number_parse.hpp: kept this branch's float parser, which replaces the
  Eisel-Lemire code that develop's side changed (nlohmann#5750 made its digit
  counter unsigned; this parser has no such counter, and it compiles
  cleanly with GCC's -Wstrict-overflow=5).
- number_handling.md, template_parameters.md: kept this branch's
  description of the conversion and added develop's "Before version
  3.13.0" sentence.

Ran make amalgamate.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann nlohmann mentioned this pull request Oct 4, 2026
4 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aspect: binary formats BSON, CBOR, MessagePack, UBJSON CMake L tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant