Subject: bug#15880: Compute C declarations for DEFSYMs automatically.

From: Paul Eggert <[email-masked]>
Date: Wed, 13 Nov 2013 08:25:41 -0800

Stefan Monnier wrote:
> I was thinking of doing it only for the DEFSYMs (which would obviously
> need to be kept in a separate file).

There still might be problems with existing symbols that are not
DEFSYMed.  For example, suppose we add 'DEFSYM (Qprotected_field,
"protected-field");' to window.c.  The new include file will be rebuilt
and only window.c will be recompiled, and 'make' will succeed.  But
buffer.c (which declares Qprotected_field as a static var and
defines it by hand) will disagree with window.c about where
Qprotected_field is, so Emacs might not work right, and the
problems might be hard to find and diagnose.

While we're on the topic let me tell you of a couple more things
I've been thinking of doing, which this patch would make easier to do.

First, put all DEFSYMS into a single table, initialized statically
with the name of the symbol.  That way, during startup we can run
through the table and intern all the strings, and DEFSYM can turn
into a no-op; this should make Emacs smaller (no need to
staticpro the symbols, for example, since the g.c. can consult the
table).  (This idea is incompatible with the idea of removing
dependencies on a new DEFSYMs include file.)

Second, preallocate each DEFSYM's struct Lisp_Symbol, so that its
address is known at link-time.  This should measurably improve
runtime performance, e.g., NILP will run faster.