GNU bug report logs - #75964
Switching the Emacs build to -Wswitch-enum in src/

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> protonmail.com>

Date: Fri, 31 Jan 2025 09:41:02 UTC

Severity: wishlist

Full log


Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: <bug-gnu-emacs <at> gnu.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 75964 <at> debbugs.gnu.org,
 Pip Cet <pipcet <at> protonmail.com>
Subject: Re: bug#75964: Switching the Emacs build to -Wswitch-enum in src/
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" <bug-gnu-emacs <at> gnu.org> 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
-- 




This bug report was last modified 127 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.