Update doctest to 2.5.3 and fmt to 12.0.0 - #196
Merged
Conversation
doctest 2.4.12 does not build with clang 22 at all: DOCTEST_ANONYMOUS uses __COUNTER__, C2y standardises it, and clang 22 rejects it under -Wc2y-extensions with werror=true. That is 153 errors and no binary, which left gcc as the only compiler this suite could be built with locally -- and a clang-only error has already reached CI once because of it. 2.5.3 fixes that by switching the counter to __LINE__ on clang 22+, but __LINE__ is only unique within a file, so two test cases sharing a line number collide once a unity build merges their files. unit/insert.cpp and unit/insert_or_assign.cpp both open with TEST_CASE_MAP on line 9, so the clang unity build fails to compile. That configuration is not exotic: there is a unity CI leg, and every lane of scripts/mutate/mutate.py is --unity=on, where this would present as every mutant coming back `compiler` rather than as an honest verdict. So take __COUNTER__ back through DOCTEST_COUNTER, doctest's own customisation point, and silence the extension warning that made doctest move away from it. Both are needed; either alone leaves one of the two configurations broken. Verified with clang and gcc across C++17/20/23, unity, 32 bit, asan+ubsan, the libFuzzer targets, and one end-to-end mutation run that comes back `caught`. abseil-cpp is already at the newest version wrapdb packages (20250814.1); the newer upstream release has no wrap, and the dependency is commented out anyway. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The MSVC 32 bit legs failed the wrap bump, and not because of anything in this repository: warning_level=3 and werror=true are inherited by subprojects, so fmt was being compiled with /W4 /WX and fmt 12.0.0 emits a warning there that 11.2.0 did not (format.h:2509, 32 bit only). Left alone that makes every future fmt release a coin flip -- a warning added anywhere in a dependency's own code becomes a red build here, on whichever platform happens to trigger it. -Werror is worth having for code this project wrote, which is the same line already drawn by giving doctest include_type 'system', and by the default_options on the commented-out absl dependency. The dependency has to be resolved after the add_global_arguments calls, since resolving it declares fmt's target and meson refuses a global argument once any target exists. Hoisting it into one variable also stops the test and fuzz targets from being able to disagree about how fmt is found. Verified fmt's translation units no longer carry -Werror while the project's still do, across gcc, clang, both unity builds, 32 bit, asan+ubsan and fuzz. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the meson wrap subprojects to their newest packaged versions, which as a side effect restores the local clang build that #195 was filed about.
Why this fixes #195, and why the fix there was the wrong one
doctest 2.4.12 does not build with clang 22 at all — 153 errors and no binary:
DOCTEST_ANONYMOUSuses__COUNTER__, C2y standardises it, and clang 22 warns underwerror=true. That is why gcc has been the only compiler able to build this suite locally, and it is why the structured-binding bug in #192 reached CI instead of being caught before the push.Worth recording: commit 794aa86 tried to solve this with
include_type: 'system', and it never worked. A diagnostic about what a macro expands to is reported against the line that used the macro, so it counts as this project's code no matter how the header was included. I've corrected that comment rather than leaving it asserting something untrue.The regression 2.5.3 brings, which is why this is not a one-line wrap bump
2.5.3 fixes the warning by using
__LINE__instead of__COUNTER__on clang 22+. But__LINE__is only unique within one file, so two test cases on the same line collide as soon as a unity build puts their files in one translation unit:Both files open with
TEST_CASE_MAPon line 9. This is not a corner case:Linux (gcc, C++17, unity)CI leg, andscripts/mutate/mutate.pyis--unity=on— there the failure would surface as every mutant returningcompilerinstead of a real verdict, i.e. a mutation run that looks like it ran and tells you nothing.The fix takes
__COUNTER__back viaDOCTEST_COUNTER, which is doctest's own customisation point (it only picks a default#if !defined), and silences the warning doctest was avoiding. Both halves are required — the flag alone leaves doctest choosing__LINE__(unity stays broken), and the define alone reintroduces the warning as an error.compiler.has_argument()keeps the clang-only flag off gcc; verified it is absent from gcc'scompile_commands.jsonand present in clang's.Verification
Every configuration built and the full suite run (539 cases, ~5.4M assertions):
--unity-size=16, the CI leg)-m32, switches fmt tobuiltin)fuzz_api/fuzz_string, corpus replayscripts/test_mutate.py(155 hermetic tests)caughtTwo local failures were checked against the baseline and are pre-existing and environmental, not from this change:
clang-tidy22 flags 20 issues inunordered_dense.h, a file this PR does not touch — CI pins clang-tidy-18 precisely because check families grow between releases.system_error), so the lint job is not locally reproducible either way.libc++ is not installed on this machine, so that leg is left to CI.
Follow-up
Item 1 of #195 (add
-Wno-c2y-extensionsto restore the local clang build) is superseded by this PR — the flag is here, but on its own it would not have been enough, since the real blocker after the bump is the unity collision. Items 2 and 3 (self-calibrating estimates, incremental--json) are untouched and still stand.🤖 Generated with Claude Code