-
Notifications
You must be signed in to change notification settings - Fork 909
[sw] Fix missing switch default label problems
#27808
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
[sw] Fix missing switch default label problems
#27808
Conversation
Starting with version 18, Clang now actually respects -Wswitch-default instead of silently ignoring it. This patch fixes several cases of switch statements with a missing default label, to avoid warnings when compiling with recent versions of Clang. Signed-off-by: Luís Marques <[email protected]>
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.
I think some of these should error instead of breaking
| speed_khz = 1000; | ||
| break; | ||
| default: | ||
| break; |
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.
I think this one should be an error in case higher speeds are added later
| return INVALID_ARGUMENT(); | ||
| break; | ||
| default: | ||
| break; |
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 should also be an INVALID_ARGUMENT I think
|
@timothytrippel Thanks for approving and merging. I was actually going to address James' feedback before merging but that can also be done separately, it's not a problem. |
|
Ah my apologies. Sorry for merging prematurely. |
|
Successfully created backport PR for |
Starting with version 18, Clang now actually respects
-Wswitch-defaultinstead of silently ignoring it. This patch fixes several cases ofswitchstatements with a missingdefaultlabel, to avoid warnings when compiling with recent versions of Clang.