maflcko
commented at 6:39 pm on February 27, 2024:
member
The bitcoin-config.h includes have issues:
The header is incompatible with iwyu, because symbols may be defined or not defined. So the IWYU pragma: keep is needed to keep the include when a symbol is not defined on a platform. Compare the previous discussion in #29408 (comment)
Guarding the includes by HAVE_CONFIG_H is verbose and brittle. Now that all build config dependencies have been removed from low level headers, the benefits are questionable, and the guard can be removed. The linter could also be tricked by guarding the include by #if defined(HAVE_C0NFIG_H) (O replaced by 0). Compare the previous discussion in #29404 (review) .
DrahtBot
commented at 6:39 pm on February 27, 2024:
contributor
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Conflicts
Reviewers, this pull request conflicts with the following ones:
#29868 (Reintroduce external signer support for Windows by hebasto)
#28167 (init: Add option for rpccookie permissions (replace 26088) by willcl-ark)
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.
DrahtBot renamed this:
build: Assume HAVE_CONFIG_H, Add IWYU pragma keep to bitcoin-config.h includes
build: Assume HAVE_CONFIG_H, Add IWYU pragma keep to bitcoin-config.h includes
on Feb 27, 2024
DrahtBot added the label
Build system
on Feb 27, 2024
maflcko
commented at 6:39 pm on February 27, 2024:
member
Currently a draft, so that the conflicting pulls can be merged first, which this pull depends on.
DrahtBot added the label
Needs rebase
on Feb 28, 2024
maflcko force-pushed
on Feb 29, 2024
DrahtBot removed the label
Needs rebase
on Feb 29, 2024
fanquake
commented at 4:21 pm on March 1, 2024:
member
Want to rebase this now?
DrahtBot added the label
Needs rebase
on Mar 1, 2024
maflcko marked this as ready for review
on Mar 12, 2024
maflcko force-pushed
on Mar 12, 2024
DrahtBot removed the label
Needs rebase
on Mar 12, 2024
maflcko force-pushed
on Mar 12, 2024
DrahtBot added the label
CI failed
on Mar 13, 2024
DrahtBot
commented at 11:08 am on March 13, 2024:
contributor
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the
documentation.
Possibly this is 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.
Leave a comment here, if you need help tracking down a confusing failure.
DrahtBot removed the label
CI failed
on Mar 13, 2024
theuni
commented at 6:42 pm on March 25, 2024:
member
I can’t say I like this as I don’t really agree that it’s harmful as-is. Can’t IWYU simply define HAVE_CONFIG_H, and we add the pragmas as well?
I’m not hugely opposed either though. My preference would be to maintain the status quo here, but ultimately I don’t care that much.
I would like to finish removing macros from low-level files though, and since this PR gives us a list to look though I’ll go ahead and thought-dump here:
I think we should:
Make all macros in crypto opt-out rather than opt-in, so they’re build-able outside of our tree but may require turning features off
Pass those defines explicitly rather than using bitcoin-config.h (we already do this with some sha2 defines)
The same for ENABLE_TRACING for util/trace.h: make it DISABLE_TRACING and pass it explicitly where needed.
Where possible, change the apis in low-level headers to be runtime errors (for ex runCommand and RegisterSignerRPCCommands) to avoid the need for the macros in the headers.
I can open a PR to do the above.
Either way, those things are independent of this PR, so no need to block.
maflcko
commented at 7:47 am on March 26, 2024:
member
Can’t IWYU simply define HAVE_CONFIG_H, and we add the pragmas as well?
Sorry for putting the two changes in the same scripted diff, but they are unrelated. Now that HAVE_CONFIG_H is no longer included in low-level (standalone) headers, I don’t see the need for it anymore. If there is a header that can be built standalone, and needs HAVE_CONFIG_H, let me know. I think iwyu already has HAVE_CONFIG_H defined, so only the pragma change is needed to fix the iwyu suggestions for this header. I am happy to drop the HAVE_CONFIG_H change, but unless there is still a reason to keep HAVE_CONFIG_H, it seems less brittle to me to drop it.
About your other suggested (unrelated) cleanups: There is also a discussion about moving from #ifdef to #if (https://github.com/bitcoin/bitcoin/issues/16419). If this was done for all symbols in the config header, the iwyu pragma would no longer be needed, I presume. Though, I won’t be working on this myself. I mostly care about the changes in this pull request. If someone reworks the build system to make this pull request obsolete, I wouldn’t mind :)
DrahtBot added the label
Needs rebase
on Apr 1, 2024
maflcko force-pushed
on Apr 4, 2024
DrahtBot removed the label
Needs rebase
on Apr 4, 2024
DrahtBot added the label
Needs rebase
on Apr 5, 2024
maflcko force-pushed
on Apr 9, 2024
DrahtBot removed the label
Needs rebase
on Apr 9, 2024
TheCharlatan approved
TheCharlatan
commented at 7:10 am on April 10, 2024:
contributor
Re-ACKffff3d2bae599d872bae184c4d7c2b0dacfc6e26
DrahtBot added the label
Needs rebase
on Apr 28, 2024
maflcko force-pushed
on Apr 29, 2024
DrahtBot removed the label
Needs rebase
on Apr 29, 2024
hebasto
commented at 1:27 pm on April 29, 2024:
member
How is it supposed to automatically catch cases when code changes make #include <config/bitcoin-config.h> unneeded in a header or source file?
maflcko
commented at 2:29 pm on April 29, 2024:
member
How is it supposed to automatically catch cases when code changes make #include <config/bitcoin-config.h> unneeded in a header or source file?
Yes, it is supposed to catch those. This is already the case and unrelated to this pull request. You can try it yourself. The output will be:
0^^^
1None of the files use a symbol declared in the bitcoin-config.h header. However, they are including
2the header. Consider removing the unused include.
34^---- ⚠️ Failure generated from build config includes check!
hebasto
commented at 3:06 pm on April 29, 2024:
member
While testing this PR I faced the problem that running linters locally alters the ownership of some files in src to the root user. How to avoid such behaviour?
maflcko
commented at 3:11 pm on April 29, 2024:
member
I didn’t add the docker image, nor is it modified in this pull request. If you have questions about docker or the linter usage, a separate issue may be more appropriate.
edit: If you want to run locally, my recommendation would be to use the test/lint/test_runner.
hebasto
commented at 3:18 pm on April 29, 2024:
member
How is it supposed to automatically catch cases when code changes make #include <config/bitcoin-config.h> unneeded in a header or source file?
Yes, it is supposed to catch those. This is already the case and unrelated to this pull request. You can try it yourself. The output will be:
0^^^
1None of the files use a symbol declared in the bitcoin-config.h header. However, they are including
2the header. Consider removing the unused include.
34^---- ⚠️ Failure generated from build config includes check!
The linter silently removes the added #include <config/bitcoin-config.h> // IWYU pragma: keep lines with no message.
To elaborate my concerns, adding // IWYU pragma: keep precludes the IWYU from notifying us about the cases when the config/bitcoin-config.h is no longer required, right?
maflcko
commented at 3:20 pm on April 29, 2024:
member
The linter silently removes the added #include <config/bitcoin-config.h> // IWYU pragma: keep lines with no message.
Again, this is not about the linter. This is an issue with the docker setup, which I didn’t write, and which is not changed in this pull request. If the issue persists in the lint/test_runner, then let me know. Otherwise, this is a separate issue.
To elaborate my concerns, adding // IWYU pragma: keep precludes the IWYU from notifying us about the cases when the config/bitcoin-config.h is no longer required, right?
The whole point of this pull request is that iwyu can not be used for this type of check.
hebasto approved
hebasto
commented at 3:35 pm on April 29, 2024:
member
ACKfa4673c7dd465f18b1d7b2042262123992e846df, I have reviewed the code and it looks OK. Tested on Ubuntu 23.10.
DrahtBot requested review from TheCharlatan
on Apr 29, 2024
DrahtBot added the label
Needs rebase
on Apr 30, 2024
scripted-diff: Add IWYU pragma keep to bitcoin-config.h includes
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2024-11-22 15:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me