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

From: Pip Cet <pipcet <at> protonmail.com>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 75964 <at> debbugs.gnu.org, Stefan Kangas <stefankangas <at> gmail.com>
Subject: Re: Switching the Emacs build to -Wswitch-enum in src/
Date: Sun, 02 Feb 2025 08:39:11 +0000
"Paul Eggert" <eggert <at> cs.ucla.edu> writes:

> On 2025-02-02 00:21, Pip Cet wrote:
>
>> emacs_abort () isn't equivalent to eassert (false), and that's
>> always been confusing to me.
>
> The inspiration is emacs_abort : abort :: eassert : assert. If we made
> emacs_abort () equivalent to eassert (false) we'd break that, as in C
> abort () is not equivalent to assert (false).

You're correct there.  I was confused because some software does turn
abort() into __builtin_unreachable(), but that's not what POSIX says.

>> can't we just enable
>> -Wswitch-enum and people live with what they get?
>
> Yes, if the new -Wswitch-enum behavior is in stable GCC and if Emacs
> compiles cleanly with the new GCC. Come to think of it, that'd be better
> than autoconfery.
>
> In other words, I'm thinking that the change to Emacs can wait until GCC
> is fixed, and once that happens we can change Emacs. We shouldn't need
> to fiddle with configure.ac or with Makefiles or whatever, other than to
> add -Wswitch-enum.

I think we should enable -Wswitch-enum now, and expect it to generate
more warnings in the future.  Not sure whether that's what you were
saying.  The current mixed collection of switches doesn't help
readability, IMHO.

Anyway, I'd like to convert a few more files first, then I'll have
another patch.

Pip





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.