-
Notifications
You must be signed in to change notification settings - Fork 37.7k
msvc, refactor: Avoid some rare compiler warnings #25819
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. 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. |
Wouldn't this be better in two separate PR's? I realise the code changes are trivial but as far as I can tell they're not Windows specific. It wouldn't be the first time an innocuos cast has had a side effect. IMHO the warnings removal and code changes should be in separate PR's. |
True. |
@@ -241,7 +241,7 @@ constexpr std::array<uint32_t, 25> GenerateSyndromeConstants() { | |||
std::array<uint32_t, 25> SYNDROME_CONSTS{}; | |||
for (int k = 1; k < 6; ++k) { | |||
for (int shift = 0; shift < 5; ++shift) { | |||
int16_t b = GF1024_LOG.at(1 << shift); | |||
int16_t b = GF1024_LOG.at(1ULL << shift); |
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.
It seems msvc violates the c++ standard by incorrectly promoting this to 64 bit
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.
The result of the shift operation is promoted to size_t
as std::array::at()
expects an argument of such a type.
Any updates of this PR? @hebasto @MarcoFalke Thank you~ |
I separated some changes into #26189. |
…turn value 30cc1c6 refactor: Drop `owns_lock()` call (Hennadii Stepanov) bff4e06 refactor: Do not discard `try_lock()` return value (Hennadii Stepanov) Pull request description: Microsoft's C++ Standard Library uses the `[[nodiscard]]` attribute for `try_lock()`. See: https://github.com/microsoft/STL/blob/main/stl/inc/mutex This change allows to drop the current suppression for the warning C4838 and helps to prevent the upcoming warning C4858. See: microsoft/STL@539c26c Fixes bitcoin/bitcoin#26017. Split from bitcoin/bitcoin#25819. ACKs for top commit: vasild: ACK 30cc1c6 Tree-SHA512: ce17404e1c78af4f763129753caf8e5a0e1c91ba398778fe912f9fcc56a847e8112460d1a1a35bf905a593b7d8e0b16c6b099ad74976b67dca5f4f3eda6ff621
30cc1c6 refactor: Drop `owns_lock()` call (Hennadii Stepanov) bff4e06 refactor: Do not discard `try_lock()` return value (Hennadii Stepanov) Pull request description: Microsoft's C++ Standard Library uses the `[[nodiscard]]` attribute for `try_lock()`. See: https://github.com/microsoft/STL/blob/main/stl/inc/mutex This change allows to drop the current suppression for the warning C4838 and helps to prevent the upcoming warning C4858. See: microsoft/STL@539c26c Fixes bitcoin#26017. Split from bitcoin#25819. ACKs for top commit: vasild: ACK 30cc1c6 Tree-SHA512: ce17404e1c78af4f763129753caf8e5a0e1c91ba398778fe912f9fcc56a847e8112460d1a1a35bf905a593b7d8e0b16c6b099ad74976b67dca5f4f3eda6ff621
@@ -209,7 +209,7 @@ enum opcodetype | |||
}; | |||
|
|||
// Maximum value that an opcode can be | |||
static const unsigned int MAX_OPCODE = OP_NOP10; | |||
static constexpr auto MAX_OPCODE = OP_NOP10; |
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.
If this is changed, it wouldn't be less effort to review making the underlying type explicit? Something like #22232 ?
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.
In addition, isn't clearer to move MAX_OPCODE = OP_NOP10
into enum opcodetype
definition?
This PR:
DisableSpecificWarnings
list