Skip to content

Commit 07c6894

Browse files
Aaryaman Sagarfacebook-github-bot
authored andcommitted
Handle all enum case statements
Summary: This diff is part of a stack that allows us to turn on stricter compiler flags that prevent clang from compiling code with a switch-case that should be illegal. In particular, consider the following code ``` enum class E { ONE = 1, TWO = 2 } int foo(E e) { switch (e) { case E::ONE: { return 1; } case E::TWO: { return 2; } } } ``` - Calling foo(static_cast<E>(3)) compiles in clang (whereas it does not in gcc). This caused S519734. -Wswitch-default prevents us from hitting this UB. - If we do not enable -Wswitch-enum, we do not get exhaustiveness checking for enum-based switch-case statements. This diff enables that flag as well. Reviewed By: kvtsoy Differential Revision: D74753765 fbshipit-source-id: 0709048745385b33f94f7dfcc268291e1d2e2071
1 parent 0978aac commit 07c6894

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

quic/state/QuicTransportStatsCallback.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ class QuicTransportStatsCallback {
214214
return "NOMEM";
215215
case SocketErrorType::OTHER:
216216
return "Other";
217+
case SocketErrorType::MAX:
217218
default:
218219
throw std::runtime_error("Undefined SocketErrorType");
219220
}

0 commit comments

Comments
 (0)