-
Notifications
You must be signed in to change notification settings - Fork 37.7k
bench: [refactor] iwyu #30716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bench: [refactor] iwyu #30716
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code CoverageFor detailed information about the code coverage, see the test coverage report. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
Concept ACK. Maybe check |
Yes, this will be a follow-up, because it requires other changes as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see IWYU warnings in https://cirrus-ci.com/task/5307830952001536. Here are some of them:
bench/addrman.cpp should add these lines:
#include "netaddress.h" // for CService, CNetAddr, Network
#include "protocol.h" // for CAddress, ServiceFlags
bench/bech32.cpp should remove these lines:
- #include <cstdint> // lines 9-9
bench/bench.h should add these lines:
#include "nanobench.h" // for Bench (ptr only)
bench/data.cpp should add these lines:
#include <iterator> // for begin, end
Concept ACK |
Thanks, fixed. |
Still seems to be:
I'm guessing handling this case, or ignoring it, is part of that? |
Concept ACK Thanks for taking the initiative on this! (Should hopefully free contributors from considering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fab0e83
ACK fab0e83 https://cirrus-ci.com/task/4676750536343552 log only shows bench/ issues with bench/bench.h itself, as TheCharlatan previously mentioned. |
It reminds me include-what-you-use/include-what-you-use#1280. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fab0e83.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crACK fab0e83
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK fab0e83
Reviewed by:
- checking that all changes are limited to updating includes and fwd declarations in
bench/
files - checking the clang-tidy CI job output for suggestions on
bench/
files, yielding only one result forbench/bench.h
(as already pointed out by other reviewers):
grep "bench\/.*should" -A 3
bench/bench.h should add these lines:
#include "nanobench.h" // for Bench (ptr only)
bench/bench.h should remove these lines:
The full include-list for bench/bench.h:
#include <bench/nanobench.h>
@@ -4,16 +4,21 @@ | |||
|
|||
#include <bench/bench.h> | |||
|
|||
#include <test/util/setup_common.h> | |||
#include <test/util/setup_common.h> // IWYU pragma: keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: this include (and thus the new pragma) is necessary to compile setup_common.cpp
. Without it, fails with
Undefined symbols for architecture arm64:
"_G_TEST_COMMAND_LINE_ARGUMENTS", referenced from:
BasicTestingSetup::BasicTestingSetup(ChainType, TestOpts) in libtest_util.a[11](libtest_util_a-setup_common.o)
"_G_TEST_GET_FULL_NAME", referenced from:
BasicTestingSetup::BasicTestingSetup(ChainType, TestOpts) in libtest_util.a[11](libtest_util_a-setup_common.o)
"_G_TEST_LOG_FUN", referenced from:
BasicTestingSetup::BasicTestingSetup(ChainType, TestOpts) in libtest_util.a[11](libtest_util_a-setup_common.o)
ld: symbol(s) not found for architecture arm64
ACK fab0e83 |
Missing includes are problematic, because:
_LIBCPP_REMOVE_TRANSITIVE_INCLUDES
(https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html). This can lead to compile failures, which are easy to fix for developers, but may not be for users. For example, commit 138f867 had to add missing includes to accommodate GCC 15 (and the commit had to be backported).Moreover, missing or extraneous includes are problematic, because they may be confusing the code reader as to what the real dependencies are.
Finally, extraneous includes may slow down the build.
Fix all issues in
bench
, by applying the rule include-what-you-use (iwyu).Follow-up pull requests will handle the other places.