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

Silence [[fallthrough]] warnings #3162

Merged
merged 4 commits into from
Oct 24, 2022

Conversation

StephanTLavavej
Copy link
Member

MSVC has implemented a new off-by-default "warning C5262: implicit fall-through occurs here; are you missing a break statement? Use [[fallthrough]] when a break statement is intentionally omitted between cases". While we don't attempt to be /Wall clean in general, this warning is high value (capable of detecting bugs in product code!) and easy to avoid.

Much of our C++17-and-later code is already using the [[fallthrough]] attribute. For our older code, I'm introducing a _FALLTHROUGH macro.

In VSO_0226079_mutex, we can simply avoid fallthrough by repeating a bit of code.

Adding /w15262 to tests/universal_prefix.lst provides comprehensive test coverage.

Finally, we need to silence fallthrough warnings in variant after _STL_UNREACHABLE - these are the only occurrences that weren't already commented.

Reported as DevCom-10163250 and internal VSO-1644941 / AB#1644941 .

warning C5262: implicit fall-through occurs here; are you missing a break statement? Use [[fallthrough]] when a break statement is intentionally omitted between cases
@StephanTLavavej StephanTLavavej added the bug Something isn't working label Oct 19, 2022
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner October 19, 2022 08:52
@StephanTLavavej StephanTLavavej self-assigned this Oct 21, 2022
@StephanTLavavej
Copy link
Member Author

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit fb386c0 into microsoft:main Oct 24, 2022
@StephanTLavavej StephanTLavavej deleted the fallthrough branch October 24, 2022 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants