Subject: Re: bug#75451: scratch/igc: Enable CHECK_STRUCTS

From: Paul Eggert <[email-masked]>
Date: Mon, 27 Jan 2025 16:30:54 -0800

On 1/27/25 03:07, Pip Cet wrote:
> "Paul Eggert" <[email-masked]> writes:
> 
>> GCC complained in my builds after some pdumper.c changes were added
>> today in this area. I pacified GCC by installing the attached further
> 
> Did you build with optimization?

Yes.  --enable-gcc-warnings doesn't make much sense otherwise.

> . we lose the -Wswitch warning entirely this way.

Yes, unfortunately (and as I mentioned in the commit message).

> 2. GCC generates an equivalent table itself when building with
> optimization, if it can do so.

Heh, I didn't know that. Though I didn't see that in my little tests 
when compiling with default -O2 optimization. For example, if I compile 
the attached with gcc -std=gnu23 -O2 -S, 'dotab' has one indexed jump 
whereas 'doswitch' has three conditional branches. Not clear to me which 
is faster in practice. I used x86-64 gcc (GCC) 14.2.1 20250110 (Red Hat 
14.2.1-7).

> The warnings are annoying, so maybe we should go back to the "default:
> emacs_abort();" solution for now, or switch to "default: eassume (0);"

Between the two I would prefer the latter. "default: eassume (false);" 
will crash reliably if you use compiler flags like -fsanitize=undefined, 
and that should be good enough for this sort of thing.