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

From: Paul Eggert <[email-masked]>
Date: Fri, 10 Jan 2025 11:33:43 -0800

On 2025-01-10 10:58, Gerd Möllmann wrote:
> Stefan Kangas <[email-masked]> writes:

>> I'm curios to know what is the experience while developing scratch/igc:
>> have these checks been very helpful?
> 
> It was helpful for me, in the pdumper, because I hadn't activated it in
> igc.c. Reason for it being that I have some other differences in my fork,
> like CL packages :-).

I haven't been developing in scratch/igc and so can't say anything there.

As I recall, CHECK_STRUCTS was introduced for pdumper and got in the way 
of everything else I developed, where it generated nothing but false alarms.

> I'm personally a big fan of exhaustive switches, as igc.c might show
> :-). I find they make it a lot easier to find all relevant places when
> adding enums. And I think the default case would work against that.

Yes, inserting 'default: emacs_abort ();' switches from static to 
dynamic checking, which is less reliable. Although 'default: emacs_abort 
();' is sometimes the best one can do, it's better to avoid it when 
possible.

I use 'default: eassume (false);' more often than 'default: emacs_abort 
();', though for a completely different purpose: to tell GCC something 
that it's not smart enough to figure out on its own, so that GCC can do 
better static checking elsewhere.