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

From: Robert Pluim <[email-masked]>
Date: Fri, 31 Jan 2025 14:58:19 +0100

>>>>> On Fri, 31 Jan 2025 12:48:02 +0000, Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email-masked]> said:
    >> 
    >> That might be fine when the enumeration is ours, but if it comes from
    >> a system header file, the only practical option is 0, with 1 being a
    >> very distant second (having a switch with many dozens of values is
    >> hardly a good thing).

    Pip> You're talking about a different problem then.  If an
    Pip> externally-controlled enum is expected to grow, we want a compiler
    Pip> warning to let us know when this happens, but we also need a default:
    Pip> handler that deals with this case.  So the right option is that we don't
    Pip> need any of the extra options, the default behaviour will be just fine.

Both gcc and clang support case ranges these days, so handling large
enums should not be a problem.

Robert
--