Skip to content

Conversation

@luismarques
Copy link
Contributor

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.

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]>
@luismarques luismarques requested a review from a team as a code owner August 1, 2025 17:27
@luismarques luismarques requested review from jwnrt, nbdd0121, pamaury and timothytrippel and removed request for a team August 1, 2025 17:27
Copy link
Contributor

@jwnrt jwnrt left a 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;
Copy link
Contributor

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

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 timothytrippel merged commit d27d298 into lowRISC:master Aug 4, 2025
45 checks passed
@luismarques
Copy link
Contributor Author

@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.

@timothytrippel
Copy link
Contributor

Ah my apologies. Sorry for merging prematurely.

@luismarques luismarques added the CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0 label Oct 29, 2025
@lowrisc-ci
Copy link

lowrisc-ci bot commented Oct 29, 2025

Successfully created backport PR for earlgrey_1.0.0:

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

Labels

CherryPick:earlgrey_1.0.0 This PR should be cherry-picked to earlgrey_1.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants