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 #176 received at 75964 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Pip Cet <pipcet <at> protonmail.com>
Cc: Andrea Corallo <acorallo <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>,
 eggert <at> cs.ucla.edu, 75964 <at> debbugs.gnu.org, stefankangas <at> gmail.com
Subject: Re: bug#75964: Switching the Emacs build to -Wswitch-enum in src/
Date: Tue, 04 Feb 2025 08:58:21 -0500
> 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.

Ah, thanks, now I understand the problem.

Yes, this part of C sucks and I had forgotten about it.
I wish it offered a special label (call it `invalid:`, `notenum:`,
`bogus:`, `outofrange:`, ...) for "what to do when the value is not
a member of the enum".


        Stefan





This bug report was last modified 128 days ago.

Previous Next


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