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


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Pip Cet <pipcet <at> protonmail.com>
Cc: acorallo <at> gnu.org, eggert <at> cs.ucla.edu, 75964 <at> debbugs.gnu.org, stefankangas <at> gmail.com, monnier <at> iro.umontreal.ca
Subject: bug#75964: Switching the Emacs build to -Wswitch-enum in src/
Date: Sun, 02 Feb 2025 15:21:40 +0200
> Date: Sun, 02 Feb 2025 12:50:15 +0000
> From: Pip Cet <pipcet <at> protonmail.com>
> Cc: eggert <at> cs.ucla.edu, 75964 <at> debbugs.gnu.org, stefankangas <at> gmail.com, Andrea Corallo <acorallo <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>
> 
> "Eli Zaretskii" <eliz <at> gnu.org> writes:
> 
> > We (should) use emacs_abort when the code has no way of dealing with
> > some situation, so letting the execution continue past that point will
> > sometimes crash or corrupt data in ways that are much harder to debug
> > than an abort.
> 
> We often use eassert for that, and I don't know how many people realize
> this subtle difference between emacs_abort () and eassert (0).

Well, I do: eassert compiles to nothing in a production build, so it
is only okay if the code can do something with the situation, albeit
something that will cause weird effects.  eassert is also appropriate
to convey the assumptions made by the code, even if no trouble will be
caused by violating those assumptions.

> I still think eassume and eassert shouldn't evaluate expressions with
> side effects.

I agree.  Do we have code which does that in Emacs?




This bug report was last modified 183 days ago.

Previous Next


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