-
Notifications
You must be signed in to change notification settings - Fork 38.6k
rpc: Add missing #include #15435
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
rpc: Add missing #include #15435
Conversation
bd0dbe8 introduced a dependency of rpc/util.h on RPCErrorCode, defined in rpc/protocol.h. The latter file is only included from rpc/util.cpp, though. This commit fixes the missing include, by moving the #include of rpc/protocol.h to rpc/util.h.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
|
Why is this specific change needed if master compiles? I mean, there's probably a lot of other missing includes right? Have you used iwyu? |
Master compiles because apparently I think this is a clear bug with a straight-forward fix, so even if it is not strictly necessary to make master compile, it is good to apply. |
|
Sorry but I don't see this as a bug fix. |
Why not? It is clearly a coding mistake to rely on symbols from a header that is not included. This is even explicitly stated in the developer notes:
That said, I agree that this is of course not a very important fix - but it is also trivial and straight-forward, so has hardly any costs either. But if you think it is not useful to merge simple patches like this, I'm happy to close the PR instead (I've fixed the issue for my own projects already, so I don't need it). |
|
It would be nice to have a tool to check for those, otherwise it seems like a one-off fix |
I agree, but I don't have such a tool. As mentioned above, I found this issue because it broke some code I'm working with (based on Bitcoin Core), and I thought it would be useful to fix this, once found, upstream. |
|
That's my point, there's no bug or code to fix. If you submit a pull that needs this "fixed" then let's review it there. |
|
There'd be iwyu, but it isn't a trivial process to set up: #15442 |
There is code to fix, since the current code is simply not correct and just compiles by accident. It also violates the style explicitly described in the developer notes as noted above. But if you don't think it is worthwhile to push a fix like this, then let's just close the PR. But to be honest, I don't understand what the potential downside of a trivial change like this is (even if the benefits are limited as well from a practical point of view). |
|
utACK 39e20fc Solves a problem for @domob1812: no need to fight this fix. |
|
I mean this opens the flood-gates to a torrent of similar PRs, which doesn't really solve a problem with any known compiler, so mild NACK from me. |
I understand if that's the general view. I agree that this PR has a very small (although positive) impact. Once found, I wanted to contribute this fix back upstream, and expected it to be trivially to review and quick to merge, thus I didn't see any downsides. But given how controversial this seems to be, it is obviously wasting more developer attention and time than I expected it to do. If there is a general "bar" for not accepting too-small PRs (even if positive), perhaps that should be defined explicitly and stated somewhere in the developer notes? As for this particular PR - I think it would be nice to merge it, as it is an improvement (although very small). But the real issue that led me to this on another project is obviously not relevant for Bitcoin's decisions, and already fixed. So I don't need it merged if you'd rather not set a precedent. Feel free to close in that case. |
|
Yea as said I'm not strongly against this, and when this can be automatically checked by some tool I'd be in favor of doing that. It's just that doing this include by include, seems inefficient, so I'd prefer if you group multiple similar changes, that's all.
We do have this line in contributing.md:
I mean "no clear benefits" can be arguable in this case. And if it helps you with whatever upstream project I'll utACK this for this time. But please don't make a habit out of it. utACK 39e20fc |
39e20fc Add missing #include. (Daniel Kraft) Pull request description: bd0dbe8 introduced a dependency of `rpc/util.h` on `RPCErrorCode`, defined in `rpc/protocol.h`. The latter file is only included from `rpc/util.cpp`, though. This commit fixes the missing include, by moving the `#include` of `rpc/protocol.h` to `rpc/util.h`. Tree-SHA512: 75c03cfadb28a309d6deb36feeb0ee6ce0b38e8a1176919bc611ea720feff8c42ec9ed0ac8ab74ba9c531a3b7ec9ccbed0c8692ebdf5f9fc17867b9750a1d9f6
|
Thanks everyone! I'm sorry for wasting everyone's time, I didn't intend that - thought it would just be quick to review and merge, as the change is trivial. I'll not submit things like that in the future. |
Summary: 39e20fc54f Add missing #include. (Daniel Kraft) Pull request description: bd0dbe8763fc3029cf96531c9ccaba280b939445 introduced a dependency of `rpc/util.h` on `RPCErrorCode`, defined in `rpc/protocol.h`. The latter file is only included from `rpc/util.cpp`, though. This commit fixes the missing include, by moving the `#include` of `rpc/protocol.h` to `rpc/util.h`. Tree-SHA512: 75c03cfadb28a309d6deb36feeb0ee6ce0b38e8a1176919bc611ea720feff8c42ec9ed0ac8ab74ba9c531a3b7ec9ccbed0c8692ebdf5f9fc17867b9750a1d9f6 --- Backport of Core [[bitcoin/bitcoin#15435 | PR15435]] Test Plan: ninja check Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Subscribers: Fabien Differential Revision: https://reviews.bitcoinabc.org/D6270
39e20fc Add missing #include. (Daniel Kraft) Pull request description: bd0dbe8 introduced a dependency of `rpc/util.h` on `RPCErrorCode`, defined in `rpc/protocol.h`. The latter file is only included from `rpc/util.cpp`, though. This commit fixes the missing include, by moving the `#include` of `rpc/protocol.h` to `rpc/util.h`. Tree-SHA512: 75c03cfadb28a309d6deb36feeb0ee6ce0b38e8a1176919bc611ea720feff8c42ec9ed0ac8ab74ba9c531a3b7ec9ccbed0c8692ebdf5f9fc17867b9750a1d9f6
39e20fc Add missing #include. (Daniel Kraft) Pull request description: bd0dbe8 introduced a dependency of `rpc/util.h` on `RPCErrorCode`, defined in `rpc/protocol.h`. The latter file is only included from `rpc/util.cpp`, though. This commit fixes the missing include, by moving the `#include` of `rpc/protocol.h` to `rpc/util.h`. Tree-SHA512: 75c03cfadb28a309d6deb36feeb0ee6ce0b38e8a1176919bc611ea720feff8c42ec9ed0ac8ab74ba9c531a3b7ec9ccbed0c8692ebdf5f9fc17867b9750a1d9f6
bd0dbe8 introduced a dependency of
rpc/util.honRPCErrorCode, defined inrpc/protocol.h. The latter file is only included fromrpc/util.cpp, though. This commit fixes the missing include, by moving the#includeofrpc/protocol.htorpc/util.h.