Skip to content
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

[C++] kernel.cc: Avoid default in switches to let the compiler warn us about missing cases #41994

Closed
felipecrv opened this issue Jun 5, 2024 · 1 comment

Comments

@felipecrv
Copy link
Contributor

Describe the enhancement requested

This can also be done in a way that is robust against the UB caused by reading memory that is not valid in the enum range.

Component(s)

C++

@kou kou changed the title kernel.cc: Avoid default in switches to let the compiler warn us about missing cases [C++] kernel.cc: Avoid default in switches to let the compiler warn us about missing cases Jun 6, 2024
felipecrv added a commit that referenced this issue Jun 6, 2024
… can check full enum coverage for us (#41995)

### Rationale for this change

To let the compiler warn us about missing cases and make the non-handled cases more obvious.

### What changes are included in this PR?

Removal of `default` in the switches and improving some dchecks with a message.

### Are these changes tested?

By existing tests.
* GitHub Issue: #41994

Authored-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
Signed-off-by: Felipe Oliveira Carvalho <felipekde@gmail.com>
@felipecrv felipecrv added this to the 17.0.0 milestone Jun 6, 2024
@felipecrv
Copy link
Contributor Author

Issue resolved by pull request 41995
#41995

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant