-
Notifications
You must be signed in to change notification settings - Fork 165
Fix: Clang warnings related to switch statements #780
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
Fix: Clang warnings related to switch statements #780
Conversation
5ac9dfd to
de91c0b
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.
Build 2764 of commit de91c0b has completed with FAILURE
src/groups/bmq/bmqp/bmqp_crc32c.cpp
Outdated
| // This code relies on the platform-dependent assumption that the distance | ||
| // from 'data' to next alignment boundary <= 7. This is true on machines | ||
| // with 64-bit word sizes or smaller, but to be safe we assert this. | ||
| BSLS_ASSERT(adj < 8); |
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.
This is probably correct, but may be the only "major" breaking change in this PR from what I see. To be clear, I'm fine with it. We'll revisit this code in the immediate near future with #688 (or similar, based on BDE's implementation).
chrisbeard
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.
lgtm, a second look wouldn't hurt though
de91c0b to
5fbad40
Compare
|
Recent push fixes bogus conflict with generated bmqex_future component files from 42b2473. |
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.
Build 2844 of commit 5fbad40 has completed with FAILURE
7646825 to
775bf13
Compare
775bf13 to
e2a2191
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.
Build 2982 of commit e2a2191 has completed with FAILURE
0573609 to
3b2b50f
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.
Build 2995 of commit 3b2b50f has completed with FAILURE
This patch adds `BSLA_UNREACHABLE` annotations to `default` cases in exhaustive `switch` statements. Signed-off-by: Patrick M. Niedzielski <[email protected]>
For some exhaustive switch statements, it is a clear logic error if we add an enumerator and forget to add to all places where we switch on it. Previously, this would have been undetectable. This patch adds asserts in places where it is safe to do so. Signed-off-by: Patrick M. Niedzielski <[email protected]>
This patch turns off all warnings in code generated from XSD schemas, which we cannot modify. Signed-off-by: Patrick M. Niedzielski <[email protected]>
There are some cases where it would be catastrophic for the broker to abort due to an unexpected value being provided in a `switch` statement. This value may come over the network, which we have no control over, or from a file on disk, which may have been corrupted. This patch introduces default cases to warn when this happens, but it keeps the current behavior otherwise in these cases. Signed-off-by: Patrick M. Niedzielski <[email protected]>
This patch adds a forgotten case to the `mqbplug_plugintype`, which did not fully handle the new authenticator plugin type. Signed-off-by: Patrick M. Niedzielski <[email protected]>
This patch simplifies the `printOption` function in the `mqbs_filestoreprotocolprinter` component. Before, we were exhaustively switching on an enumeration `bmqp::OptionType` and doing the exact same work in each case. This patch removes the `switch` statement entirely, and replaces it with the work we were doing in all cases. Signed-off-by: Patrick M. Niedzielski <[email protected]>
3b2b50f to
d1c8edf
Compare
This PR fixes warnings that Clang emits due to missing
defaultcases in switch statements.Please see commit messages for more details.