Skip to content

ci: Add and use ci/test/modernize-deprecated-headers.py#34298

Closed
maflcko wants to merge 2 commits intobitcoin:masterfrom
maflcko:2601-iwyu-modernize-deprecated-headers
Closed

ci: Add and use ci/test/modernize-deprecated-headers.py#34298
maflcko wants to merge 2 commits intobitcoin:masterfrom
maflcko:2601-iwyu-modernize-deprecated-headers

Conversation

@maflcko
Copy link
Member

@maflcko maflcko commented Jan 15, 2026

Fixes #34237

Currently, there is a massive iwyu patch to try to implement modernize-deprecated-headers.

However, it does not work. For example https://github.com/bitcoin/bitcoin/actions/runs/21012214401/job/60409645985#step:11:35548:

+#include <assert.h>
 #include <bench/bench.h>

Fix all issues by removing the patch and using a trivial and fast modernize-deprecated-headers.py instead.

@DrahtBot DrahtBot changed the title ci: Add and use ci/test/modernize-deprecated-headers.py ci: Add and use ci/test/modernize-deprecated-headers.py Jan 15, 2026
@DrahtBot DrahtBot added the Tests label Jan 15, 2026
@DrahtBot
Copy link
Contributor

DrahtBot commented Jan 15, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34298.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK hebasto

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #34310 (iwyu: Add missed line to IWYU patch by hebasto)

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.

@maflcko maflcko force-pushed the 2601-iwyu-modernize-deprecated-headers branch from fa99a71 to fa947ba Compare January 15, 2026 08:56
@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Task lint: https://github.com/bitcoin/bitcoin/actions/runs/21025279080/job/60448207726
LLM reason (✨ experimental): Lint check failed in CI due to shellcheck SC2046 warning causing the lint suite to fail.

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@maflcko maflcko force-pushed the 2601-iwyu-modernize-deprecated-headers branch from fa947ba to aaaa247 Compare January 15, 2026 09:19
@maflcko maflcko force-pushed the 2601-iwyu-modernize-deprecated-headers branch from aaaa247 to fa31a9f Compare January 15, 2026 10:06
@maflcko
Copy link
Member Author

maflcko commented Jan 15, 2026

The CI logs show that the example from the pull description is now working correctly: https://github.com/bitcoin/bitcoin/actions/runs/21027399192/job/60455097235?pr=34298#step:11:38466:

--- a/src/bench/streams_findbyte.cpp
+++ b/src/bench/streams_findbyte.cpp
@@ -7,9 +7,12 @@
 #include <test/util/setup_common.h>
 #include <util/fs.h>
 
+#include <cassert>
 #include <cstddef>

@hebasto
Copy link
Member

hebasto commented Jan 15, 2026

The CI logs show that the example from the pull description is now working correctly: https://github.com/bitcoin/bitcoin/actions/runs/21027399192/job/60455097235?pr=34298#step:11:38466:

--- a/src/bench/streams_findbyte.cpp
+++ b/src/bench/streams_findbyte.cpp
@@ -7,9 +7,12 @@
 #include <test/util/setup_common.h>
 #include <util/fs.h>
 
+#include <cassert>
 #include <cstddef>

However, IWYU output still mentions C headers:

2026-01-15T10:19:53.0393770Z /home/admin/actions-runner/_work/_temp/src/bench/streams_findbyte.cpp should add these lines:
2026-01-15T10:19:53.0394044Z #include <assert.h>                  // for assert
2026-01-15T10:19:53.0394243Z #include <memory>                    // for make_unique, unique_ptr
2026-01-15T10:19:53.0394460Z #include <string>                    // for basic_string

Currently, there is a massive iwyu patch to try to implement modernize-deprecated-headers.

However, it does not work.

The patch has been fixed in #34310.

@maflcko
Copy link
Member Author

maflcko commented Jan 15, 2026

However, IWYU output still mentions C headers:

Yeah, this will also be the case with a vanilla iwyu, when run locally. Not sure if anyone does this, but the py script could be applicable there as well. Not sure if anyone runs iwyu locally, and if they'd prefer a patch to iwyu, or a fixup script, but happy to close this one, if people prefer a patch.

@hebasto
Copy link
Member

hebasto commented Jan 16, 2026

I am happy with both approaches, this one and #34310, though I have a slight preference for the latter for the following reasons:

  1. It is documented in the source code:

    If you did want to replace assert.h with cassert, you'd change it to a public->private mapping.

  2. We build IWYU from source and already applying another patch.
  3. The patch was chosen over a tiny script because it is "easier to review and maintain".
  4. Patches can be applied when building IWYU locally.

If the patch size is an issue, I'd prefer the previous "scripted-diff" style script to modify the source code.

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

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

ACK fa31a9f.

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

@maflcko
Copy link
Member Author

maflcko commented Jan 20, 2026

Closing for now. It can be re-opened in the future, if there is need

@maflcko maflcko closed this Jan 20, 2026
@maflcko maflcko deleted the 2601-iwyu-modernize-deprecated-headers branch January 20, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: IWYU job giving incorrect suggestions

3 participants