Skip to content

Handle all value_t enumerators in has_no_children() - #5770

Merged
nlohmann merged 1 commit into
nlohmann:developfrom
fhgffy:fix/destroy-switch-enum-5762
Oct 6, 2026
Merged

nlohmann merged 1 commit into
nlohmann:developfrom
fhgffy:fix/destroy-switch-enum-5762

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

CI builds with -Werror=switch-enum fail after #5762 because has_no_children() explicitly handles only array and object. A default branch does not suppress this warning.

Add the other eight value_t labels to the existing return true branch and regenerate the single header. The behavior stays the same. This fixes the warning reported on #5760 and complements the separate ObjectType fix in #5767.

Validation with MinGW GCC 15.1:

  • The existing tests/abi/diag/diag_off.cpp fails before the patch with -std=c++11 -Wswitch-enum -Werror=switch-enum, using either header mode. It passes after the patch in C++11 and C++20.
  • CMake builds with the same warning flags pass. Split headers: ABI diagnostics, allocator, regression2 and the test-data fixture, 4/4. Single header: ABI diagnostics, 1/1.
  • Official amalgamation, pinned AStyle formatting and git diff --check pass.

The full suite was not rerun; the separate rbegin() build failure remains until #5767 lands.

  • The changes are described in detail, both the what and why.
  • If applicable, an existing issue is referenced (discussion on Fix NUL bytes in UBJSON/BJData high-precision numbers #5760).
  • If applicable, a fixed OSS-Fuzz issue is referenced (not applicable).
  • Code coverage remained at 100% (not measured locally; existing compile check used, no new executable path).
  • If applicable, documentation is updated (no API or behavior change).
  • The source code is amalgamated using the official generator.

2026-10-07: add the scalar enum labels already handled by the default
branch so -Werror=switch-enum builds succeed. Keep the existing behavior
and synchronize the generated single header.

Signed-off-by: fhgffy <102001626+fhgffy@users.noreply.github.com>
@fhgffy
fhgffy requested a review from nlohmann as a code owner October 6, 2026 17:30
@github-actions github-actions Bot added the M label Oct 6, 2026

@nlohmann nlohmann left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks good to me.

@nlohmann nlohmann added this to the Release 3.13.0 milestone Oct 6, 2026
@nlohmann
nlohmann merged commit 9b179ce into nlohmann:develop Oct 6, 2026
5 of 6 checks passed
@nlohmann

nlohmann commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants