Skip to content

Fix develop CI: GCC 4.8, Clang 3.4 and clang-tidy errors - #6100

Merged
nlohmann merged 2 commits into
developfrom
fix/develop-ci-old-compilers-tidy
Nov 13, 2026
Merged

nlohmann merged 2 commits into
developfrom
fix/develop-ci-old-compilers-tidy

Conversation

@nlohmann

Copy link
Copy Markdown
Owner

Several PRs merged on 2026-11-11 left develop red; the develop runs since then were all cancelled, so it showed up first in PR runs (e.g. #6078).

  • GCC 4.8 (ci_test_compilers_gcc_old (4.8)): tests/src/unit-json_patch.cpp (Resume patch operations from the common prefix in constant time per step #6077) has multi-line raw strings inside CHECK(...), which GCC 4.8 cannot parse in a macro argument ("unterminated raw string"). The patches are now local const json variables.
  • Clang 3.4 (ci_test_compilers_clang (3.4)): tests/src/unit-recursion_depth_limit.cpp (Add JSON_RECURSION_DEPTH_LIMIT to set how deep value walks recurse #6081) default-initializes a const std::hash<json>; it is now value-initialized.
  • clang-tidy (ci_clang_tidy):
    • detail/view/document_data.hpp: modernize-use-transparent-functors — std::less<> is C++14, so NOLINT.
    • detail/view/compare.hpp: bugprone-suspicious-stringview-data-usage — float_token_is_nan() takes the length from the node, so NOLINT.
    • tests/src/unit-json_view_builder.cpp: raw string literal; NOLINT for the deliberate pointer use after clear() (only compared, never read) and for owning-memory on new char[16].

single_include/nlohmann/json_view.hpp is regenerated with make amalgamate.

Checked locally: the three changed tests build and pass with Apple clang (C++11). Not checked locally: GCC 4.8, Clang 3.4 and clang-tidy 22; these jobs stop at the first failing file, so CI may still surface more.

Breaks the public API?

No. Only tests and NOLINT comments change.

🤖 Generated with Claude Code

- unit-json_patch.cpp: move multi-line raw strings out of CHECK(), which
  GCC 4.8 cannot parse inside a macro argument
- unit-recursion_depth_limit.cpp: value-initialize the const std::hash
  (Clang 3.4 rejects default initialization of a const object)
- json_view: silence modernize-use-transparent-functors (std::less<> is
  C++14), bugprone-suspicious-stringview-data-usage (the length comes from
  the node) and the deliberate use-after-clear() / owning-memory hits in
  unit-json_view_builder.cpp; use a raw string literal there

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann nlohmann added this to the Release 3.13.0 milestone Nov 12, 2026
@nlohmann nlohmann added the 🚀 ready to merge Ready to merge - just waiting for CI to complete. label Nov 12, 2026
@github-actions github-actions Bot added M tests aspect: json_view json_document, json_view (zero-copy view) labels Nov 12, 2026
Test the lvalue path with the const original instead of a mutable copy
and the rvalue path with a temporary (misc-const-correctness), and mark
the intentional char8_t array with NOLINT (avoid-c-arrays).

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann
nlohmann merged commit 2755952 into develop Nov 13, 2026
170 of 171 checks passed
@nlohmann
nlohmann deleted the fix/develop-ci-old-compilers-tidy branch November 13, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aspect: json_view json_document, json_view (zero-copy view) M 🚀 ready to merge Ready to merge - just waiting for CI to complete. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants