Skip to content

Conversation

@pniedzielski
Copy link
Collaborator

This PR fixes warnings that Clang emits due to missing default cases in switch statements.

Please see commit messages for more details.

@pniedzielski pniedzielski requested a review from a team as a code owner June 13, 2025 19:36
@pniedzielski pniedzielski force-pushed the published/fix/warnings/switch branch 2 times, most recently from 5ac9dfd to de91c0b Compare June 13, 2025 20:17
Copy link

@bmq-oss-ci bmq-oss-ci bot left a 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

// 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);
Copy link
Contributor

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
chrisbeard previously approved these changes Jun 16, 2025
Copy link
Contributor

@chrisbeard chrisbeard left a 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

hallfox
hallfox previously approved these changes Jun 26, 2025
@pniedzielski pniedzielski dismissed stale reviews from hallfox and chrisbeard via 5fbad40 July 7, 2025 18:21
@pniedzielski pniedzielski force-pushed the published/fix/warnings/switch branch from de91c0b to 5fbad40 Compare July 7, 2025 18:21
@pniedzielski
Copy link
Collaborator Author

Recent push fixes bogus conflict with generated bmqex_future component files from 42b2473.

Copy link

@bmq-oss-ci bmq-oss-ci bot left a 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

@pniedzielski pniedzielski requested a review from hallfox July 7, 2025 21:55
@pniedzielski pniedzielski force-pushed the published/fix/warnings/switch branch 2 times, most recently from 7646825 to 775bf13 Compare August 26, 2025 21:47
@pniedzielski pniedzielski requested a review from hallfox August 26, 2025 21:47
@pniedzielski pniedzielski force-pushed the published/fix/warnings/switch branch from 775bf13 to e2a2191 Compare August 26, 2025 21:48
Copy link

@bmq-oss-ci bmq-oss-ci bot left a 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

@pniedzielski pniedzielski force-pushed the published/fix/warnings/switch branch 2 times, most recently from 0573609 to 3b2b50f Compare August 28, 2025 20:48
Copy link

@bmq-oss-ci bmq-oss-ci bot left a 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]>
@pniedzielski pniedzielski force-pushed the published/fix/warnings/switch branch from 3b2b50f to d1c8edf Compare August 29, 2025 15:04
@pniedzielski pniedzielski merged commit 54ad896 into bloomberg:main Aug 29, 2025
47 of 63 checks passed
@pniedzielski pniedzielski deleted the published/fix/warnings/switch branch August 29, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants