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

From: Stefan Monnier <[email-masked]>
Date: Tue, 04 Feb 2025 13:17:36 -0500

>> should return 2, because I'd prefer that it aborts and/or that the
>> programmer have a way to say explicitly what should happen.  `default:`
>> works for that in the case where you have listed *all* the enum's
>> values, but then you get stiffed in the case where you add an enum value
>> because the compiler won't tell you that you forgot to update this
>> `switch` accordingly.
>
> But... that's precisely what -Wswitch-enum does!  It warns about a
> forgotten case even though there is also a default label!

But IIUC that breaks the other case, where you do want to use `default:`
to mean "any other (valid) enum value".

        Stefan