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
build: Assume HAVE_CONFIG_H, Add IWYU pragma keep to bitcoin-config.h includes #29494
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. 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. |
Currently a draft, so that the conflicting pulls can be merged first, which this pull depends on. |
9d1e2ed
to
58d7dd9
Compare
Want to rebase this now? |
58d7dd9
to
fab3832
Compare
fab3832
to
fad2890
Compare
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the Possibly this is due to a silent merge conflict (the changes in this pull request being Leave a comment here, if you need help tracking down a confusing failure. |
fad2890
to
aaaa259
Compare
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.
git grep 'HAVE_CONFIG_H'
reveals one left over define in build-aux/m4/bitcoin_qt.m4
. Was that left on purpose?
aaaa259
to
fab657b
Compare
Thanks, removed as well. (Not sure why it would be needed for mocs at all) |
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 fab657b
I can't say I like this as I don't really agree that it's harmful as-is. Can't IWYU simply define 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:
I can open a PR to do the above. Either way, those things are independent of this PR, so no need to block. |
Sorry for putting the two changes in the same scripted diff, but they are unrelated. Now that About your other suggested (unrelated) cleanups: There is also a discussion about moving from |
ffff3d2
to
fa4673c
Compare
How is it supposed to automatically catch cases when code changes make |
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:
|
While testing this PR I faced the problem that running linters locally alters the ownership of some files in |
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 |
Of course, I've tried. Consider the following diff: $ git diff
diff --git a/src/base58.cpp b/src/base58.cpp
index cf5d62f164..96aa9255de 100644
--- a/src/base58.cpp
+++ b/src/base58.cpp
@@ -4,6 +4,8 @@
#include <base58.h>
+#include <config/bitcoin-config.h> // IWYU pragma: keep
+
#include <hash.h>
#include <uint256.h>
#include <util/strencodings.h>
diff --git a/src/base58.h b/src/base58.h
index 2f4d0b74b1..f4dc16d307 100644
--- a/src/base58.h
+++ b/src/base58.h
@@ -14,6 +14,8 @@
#ifndef BITCOIN_BASE58_H
#define BITCOIN_BASE58_H
+#include <config/bitcoin-config.h> // IWYU pragma: keep
+
#include <span.h>
#include <string> The linter silently removes the added To elaborate my concerns, adding |
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.
The whole point of this pull request is that iwyu can not be used for this type of check. |
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 fa4673c, I have reviewed the code and it looks OK. Tested on Ubuntu 23.10.
-BEGIN VERIFY SCRIPT- perl -0777 -pi -e 's/#if defined\(HAVE_CONFIG_H\)\n#include <config\/bitcoin-config.h>.*\n#endif.*\n/#include <config\/bitcoin-config.h> \/\/ IWYU pragma: keep\n/g' $( git grep -l '#include <config/bitcoin-config.h>' ) -END VERIFY SCRIPT-
Also, remove the no longer needed, remaining definitions and checks of HAVE_CONFIG_H.
fa4673c
to
fa09451
Compare
Rebased (should be trivial to re-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.
ACK fa09451
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.
Is this waiting for someone's review, or are two ACKs sufficient? |
ACK fa09451 |
The
bitcoin-config.h
includes have issues:IWYU pragma: keep
is needed to keep the include when a symbol is not defined on a platform. Compare the previous discussion in lint: Check for missing bitcoin-config.h includes #29408 (comment)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 by0
). Compare the previous discussion in refactor: bitcoin-config.h includes cleanup #29404 (comment) .