I can see why this is done (to avoid forgetting a new case in the switch when adding a new enum value),
but this is quite some overhead.

If indeed a new case would be forgotten, then there would be another warning.
So I opt to remove the if () or at least #ifdef it for debug mode only.