1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Better support for future plugins

See the thread containing:
http://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00720.html
* lib-src/make-docfile.c (write_globals): Generate code that #defines
Qxxx macros other than Qnil only if DEFINE_NONNIL_Q_SYMBOL_MACROS.
Qnil is safe to define even in plugins, since it must be zero for
other reasons.
* src/lisp.h (DEFINE_LISP_SYMBOL): New macro, replacing and simplifying
DEFINE_LISP_SYMBOL_BEGIN / DEFINE_LISP_SYMBOL_END.  All uses changed.
(DEFINE_NONNIL_Q_SYMBOL_MACROS): New macro, defaulting to true.
This commit is contained in:
Paul Eggert 2015-02-12 18:20:12 -08:00
parent e39d96ebe4
commit 65563fd771
4 changed files with 41 additions and 16 deletions

View file

@ -707,12 +707,9 @@ write_globals (void)
globals[i].name, globals[i].name);
}
else if (globals[i].type == SYMBOL)
printf (("DEFINE_LISP_SYMBOL_BEGIN (%s)\n"
"#define i%s %d\n"
"#define %s builtin_lisp_symbol (i%s)\n"
"DEFINE_LISP_SYMBOL_END (%s)\n\n"),
globals[i].name, globals[i].name, symnum++,
globals[i].name, globals[i].name, globals[i].name);
printf (("#define i%s %d\n"
"DEFINE_LISP_SYMBOL (%s)\n"),
globals[i].name, symnum++, globals[i].name);
else
{
if (globals[i].flags & DEFUN_noreturn)
@ -740,15 +737,19 @@ write_globals (void)
puts ("#ifdef DEFINE_SYMBOLS");
puts ("static char const *const defsym_name[] = {");
for (int i = 0; i < num_globals; i++)
{
if (globals[i].type == SYMBOL)
printf ("\t\"%s\",\n", globals[i].v.svalue);
while (i + 1 < num_globals
&& strcmp (globals[i].name, globals[i + 1].name) == 0)
i++;
}
if (globals[i].type == SYMBOL)
printf ("\t\"%s\",\n", globals[i].v.svalue);
puts ("};");
puts ("#endif");
puts ("#define Qnil builtin_lisp_symbol (0)");
puts ("#if DEFINE_NONNIL_Q_SYMBOL_MACROS");
num_symbols = 0;
for (int i = 0; i < num_globals; i++)
if (globals[i].type == SYMBOL && num_symbols++ != 0)
printf ("# define %s builtin_lisp_symbol (%d)\n",
globals[i].name, num_symbols - 1);
puts ("#endif");
}