-
Notifications
You must be signed in to change notification settings - Fork 27
refactor: fix warnings from clang-tidy-20 and bitcoin-tidy #172
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
base: master
Are you sure you want to change the base?
Conversation
Concept ACK. |
Reported by Sjors Provoost <sjors@sprovoost.nl> bitcoin/bitcoin#31802 (comment) /ci_container_base/include/mp/proxy-io.h:252:16: error: forwarding reference passed to std::move(), which may unexpectedly cause lvalues to be moved; use std::forward() instead [bugprone-move-forwarding-reference,-warnings-as-errors] /ci_container_base/include/mp/proxy-io.h:336:18: error: forwarding reference passed to std::move(), which may unexpectedly cause lvalues to be moved; use std::forward() instead [bugprone-move-forwarding-reference,-warnings-as-errors] /ci_container_base/include/mp/util.h:186:12: error: forwarding reference passed to std::move(), which may unexpectedly cause lvalues to be moved; use std::forward() instead [bugprone-move-forwarding-reference,-warnings-as-errors] https://cirrus-ci.com/task/6187773452877824?logs=ci#L4712
/ci_container_base/include/mp/type-interface.h:47:75: error: forwarding reference passed to std::move(), which may unexpectedly cause lvalues to be moved; use std::forward() instead [bugprone-move-forwarding-reference,-warnings-as-errors] https://cirrus-ci.com/task/6187773452877824?logs=ci#L4712 Error was caused by mp/type-interface.h CustomBuildField field using std::move instead of std::forward. Just switching from std::move to std::forward, however, would lead to another error in the CustomMakeProxyServer function which is expecting an rvalue, not an lvalue. That error could be fixed by changing CustomMakeProxyServer to accept lvalues and copy the shared_ptr, which would have a slight performance cost. But it is better to resolve the problem at the root and switch to perfect forwarding everywhere, all the way up the call stack. This required some small changes to the code generator and clientInvoke.
/ci_container_base/include/mp/proxy-io.h:637:1: error: Variable with non-trivial destructor cannot be thread_local. [bitcoin-nontrivial-threadlocal,-warnings-as-errors] https://cirrus-ci.com/task/6187773452877824?logs=ci#L4720
I added the latest version of this to bitcoin/bitcoin#31802, the tidy job is still happy. Some background for the first two commits: https://clang.llvm.org/extra/clang-tidy/checks/bugprone/move-forwarding-reference.html With that in mind the first commit seems fine, the second one e922bb8 is a bit over my head due to the changes in I don't have an informed opinion on the last commit a5bff37 that suppresses |
Thanks @Sjors. Now that this git repo is a subtree and a bitcoin-core project, I would like to (1) stop my previous practice of merging PRs like this that do not have any ACKs and (2) try to encourage more review to happen earlier in the upstream PR's in this repository rather than later in the downstream PRs in the bitcoin repository. So would you feel comfortable reviewing more and maybe giving an ACK along the lines of...
... or however you might actually review it? I am happy to answer any questions that could help clarify things. The second commit should be the only complicated one here, and I can break it down. It is:
Maybe I should add some of these explanations in code comments or commit messages too. Would welcome any feedback. |
This might help more people understand the code. |
Warnings are described in commit messages and were reported by Sjors in bitcoin/bitcoin#31802 (comment)