Repository navigation
Conversation
added 2 commits
November 22, 2026 14:03
The project has a compile error when compiled without assertions in
util/check.h. Thus, util/check.h should be included for all assertions.
So do that with a scripted-diff to use util/check.h.
-BEGIN VERIFY SCRIPT-
# Files to edit.
paths=(
'src/bench/'
'src/ipc/test/'
'src/qt/test/'
'src/test/'
'src/wallet/test/'
':(exclude)src/bench/nanobench.h'
)
for f in $(git grep -l --extended-regexp '\<(a|A)ssert\(' -- "${paths[@]}"); do
# Add the util/check.h include when needed.
if ! git grep --quiet 'util/check.h' -- "$f"; then
line=$(grep --line-number --max-count=1 '^#include' "$f" | cut --delimiter=: --fields=1)
sed --in-place "${line}i#include <util/check.h>" "$f"
fi
# Remove leftover cassert includes.
sed --in-place '/^#include <cassert>$/d' "$f"
done
-END VERIFY SCRIPT-
-BEGIN VERIFY SCRIPT- git show -U0 HEAD~0 | ./contrib/devtools/clang-format-diff.py -p1 -i -v -END VERIFY SCRIPT-
maflcko
marked this pull request as draft
November 22, 2026 13:12
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
This was referenced Nov 23, 2026
This was referenced Nov 28, 2026
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.

In test code,
assertis used. This is perfectly fine, but sometimes confusion arises, when it is unclear whetherNDEBUGcan disable the assertions, or whether to useassertorAssert.Avoid that confusion in test code with a scripted replacement to add the util/check.h include. The changes here will also make it easier to run IWYU.
Scope: This change is only about test code, other code can be done later, if there is need to.
(Currently a draft, because it waits on other stuff)