Subject: bug#75964: Switching the Emacs build to -Wswitch-enum in src/

From: Eli Zaretskii <[email-masked]>
Date: Tue, 04 Feb 2025 14:24:32 +0200

> Date: Mon, 03 Feb 2025 21:15:38 +0000
> From: Pip Cet <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>, [email-masked], [email-masked], [email-masked], Andrea Corallo <[email-masked]>
> 
> "Stefan Monnier" <[email-masked]> writes:
> 
> >> enum ABC abc;
> >> switch (abc) {
> >> case A:
> >>   /* handle case A */
> >>   break;
> >> default:
> >>   /* we know this must be case C */
> >>   /* handle case C */
> >>   break;
> >> }
> >
> > I think this just suggests we should refrain from using `default:`
> 
> Switching over an enum without a default: label will generate
> fall-through code, for those cases in which the enum variable has a
> value that's not in the enumeration.

What is "fall-through code" in this context, and why is it bad that
the compiler will generate such code?