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

From: Pip Cet <[email-masked]>
Date: Sun, 02 Feb 2025 08:39:11 +0000

"Paul Eggert" <[email-masked]> 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