-
Notifications
You must be signed in to change notification settings - Fork 38.7k
build: warn on self-assignment #30235
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
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. |
test/uint256_tests.cpp:273:7: error: explicitly assigning value of variable of type 'arith_uint256' to itself [-Werror,-Wself-assign-overloaded]
v /= v;
~ ^ ~
test/uint256_tests.cpp:277:7: error: explicitly assigning value of variable of type 'arith_uint256' to itself [-Werror,-Wself-assign-overloaded]
v -= v;
~ ^ ~
2 errors generated. |
4adecc5 to
0c1852b
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. |
|
Ran into this: llvm/llvm-project#42469 Worked around it by disabling the warning for the specific tests rather than removing them. |
0c1852b to
91a1523
Compare
|
Turns out clang fixed this in v17. Updated the comment and commit message to reflect that. |
|
c3a5e8a build: re-enable deprecated warning copy (Cory Fields) Pull request description: Noticed while looking at the `-wno-*` flags in #30235. This was disabled in #18738 due to the combo of old gcc and qt. We no longer support the affected gcc, and the old qt should no longer be relevant to us anyway. See old fixes in: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88136 and https://bugreports.qt.io/browse/QTBUG-75210 and https://codereview.qt-project.org/c/qt/qtbase/+/245434 ACKs for top commit: maflcko: ACK c3a5e8a fanquake: ACK c3a5e8a - this is in `-Wextra` for Clang and GCC. Tree-SHA512: bd008dc50134d15ca3bb0c4f78d910db5b7a0ee98b04c159122a6f13a24b18827806492f053293d9cc1f1528ba60dea6d9ed31a366f63840ccb7c55f002d263b
91a1523 to
9f4f359
Compare
clang-16 and earlier detect "foo -= foo" and "foo /= foo" as self-assignments.
Belt-and suspenders after bitcoin#30234. Self-assignment should be safe _and_ discouraged. We used to opt out of this warning because something deep in our serialization/byteswapping code could self-assign, but that doesn't appear to be the case anymore.
9f4f359 to
15796d4
Compare
|
Fixed the other test (added another pragma and comment) and rebased after #30236. |
|
ACK 15796d4 |
fanquake
left a comment
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 15796d4 - not a huge fan of inline pragma usage, but this seems fine, given it's to work around an already-fixed compiler bug, and we'll only be carrying it for a shortish time in any case.
|
Ported to the CMake-based build system in hebasto#227. |
160fd92 fixup! cmake: Add compiler diagnostic flags (Hennadii Stepanov) bb12261 refactor: disable self-assign warning for tests (Cory Fields) Pull request description: This PR ports bitcoin#30235. Top commit has no ACKs. Tree-SHA512: 89a6c9fe3c34c5203992430970620bd3a1e787df49807c400d36224b920270fac56905eb151d7a6a6dc757400c42c38b36641d7feb369414f86cc77b9f8d9f96
c3a5e8a build: re-enable deprecated warning copy (Cory Fields) Pull request description: Noticed while looking at the `-wno-*` flags in bitcoin#30235. This was disabled in bitcoin#18738 due to the combo of old gcc and qt. We no longer support the affected gcc, and the old qt should no longer be relevant to us anyway. See old fixes in: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88136 and https://bugreports.qt.io/browse/QTBUG-75210 and https://codereview.qt-project.org/c/qt/qtbase/+/245434 ACKs for top commit: maflcko: ACK c3a5e8a fanquake: ACK c3a5e8a - this is in `-Wextra` for Clang and GCC. Tree-SHA512: bd008dc50134d15ca3bb0c4f78d910db5b7a0ee98b04c159122a6f13a24b18827806492f053293d9cc1f1528ba60dea6d9ed31a366f63840ccb7c55f002d263b
15796d4 build: warn on self-assignment (Cory Fields) 53372f2 refactor: disable self-assign warning for tests (Cory Fields) Pull request description: Belt-and suspenders after bitcoin#30234. Self-assignment should be safe _and_ discouraged. We used to opt out of this warning because something deep in our serialization/byteswapping code could self-assign, but that doesn't appear to be the case anymore. ACKs for top commit: maflcko: ACK 15796d4 fanquake: ACK 15796d4 - not a huge fan of inline pragma usage, but this seems fine, given it's to work around an already-fixed compiler bug, and we'll only be carrying it for a shortish time in any case. Tree-SHA512: 1f95f7c730b974ad1da55ebd381040bac312f2f380fff9d569ebab91d7c1963592a84d1613d81d96238c6f5a66aa40deebba68a76f6b24b02150d0a77c769654
c3a5e8a build: re-enable deprecated warning copy (Cory Fields) Pull request description: Noticed while looking at the `-wno-*` flags in bitcoin#30235. This was disabled in bitcoin#18738 due to the combo of old gcc and qt. We no longer support the affected gcc, and the old qt should no longer be relevant to us anyway. See old fixes in: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88136 and https://bugreports.qt.io/browse/QTBUG-75210 and https://codereview.qt-project.org/c/qt/qtbase/+/245434 ACKs for top commit: maflcko: ACK c3a5e8a fanquake: ACK c3a5e8a - this is in `-Wextra` for Clang and GCC. Tree-SHA512: bd008dc50134d15ca3bb0c4f78d910db5b7a0ee98b04c159122a6f13a24b18827806492f053293d9cc1f1528ba60dea6d9ed31a366f63840ccb7c55f002d263b
6dfb41e Merge bitcoin#30235: build: warn on self-assignment (merge-script) 325c8f0 Merge bitcoin#30236: build: re-enable deprecated warning copy (merge-script) 796e6ee Merge bitcoin#29882: netbase: clean up Proxy logging (merge-script) 9116563 Merge bitcoin#29315: refactor: Compile unreachable walletdb code (Ava Chow) ddbe865 Merge bitcoin#28672: build: move `-fstack-reuse=none` to CORE_CXXFLAGS (fanquake) 5349c5e Merge bitcoin#27918: fuzz: addrman, avoid `ConsumeDeserializable` when possible (fanquake) da71765 Merge bitcoin#28091: fuzz: use `ConnmanTestMsg` in `connman` (fanquake) 768f07c Merge bitcoin#27420: build: remove ancient unused define (fanquake) 84ce049 Merge bitcoin#25985: Revert "build: Use Homebrew's sqlite package if it is available" (Andrew Chow) 4d9b355 Merge bitcoin#26070: build: Quiet warnings in symlinked headers installed from homebrew (fanquake) f8630ba Merge bitcoin#25906: test: add coverage for invalid parameters for `rescanblockchain` (MacroFake) 494b7c0 Merge bitcoin#25282: Bugfix: configure: Define default for use_libevent (laanwj) ca63ea7 Merge bitcoin#24958: build: Fix macOS Apple M1 build with miniupnpc and libnatpmp. Again :) (laanwj) 075f8db Merge bitcoin#24696: ci: Use monterey-xcode-13.3 (MarcoFalke) Pull request description: ## Issue being fixed or feature implemented Batch of trivial backports ## How Has This Been Tested? CI ## Breaking Changes ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 6dfb41e knst: utACK 6dfb41e Tree-SHA512: ff0eb987feadbefa9493abc2a727ce7df6249ae1d82e929c44a90a9b23eff95d6f4f7d07a85c5b9a8ff54cf98b1b4bfa490fc6b38b705eae3f1d890383a323e6
Belt-and suspenders after #30234. Self-assignment should be safe and discouraged.
We used to opt out of this warning because something deep in our serialization/byteswapping code could self-assign, but that doesn't appear to be the case anymore.