diff options
| author | Paul Eggert | 2021-12-02 19:01:33 -0800 |
|---|---|---|
| committer | Paul Eggert | 2021-12-02 19:03:14 -0800 |
| commit | 9c222b9c1a7f91497a37567b4d7de3a511fff069 (patch) | |
| tree | a0e9016aac8318734b5e9d744f9cc1502bef72f3 /src/eval.c | |
| parent | fed35a89517aa4e282273f7e3c75bafd4e698ce4 (diff) | |
| download | emacs-9c222b9c1a7f91497a37567b4d7de3a511fff069.tar.gz emacs-9c222b9c1a7f91497a37567b4d7de3a511fff069.zip | |
Port to C compilers that lack size-0 arrays
The C standard does not allow size-zero arrays, so redo struct
Lisp_Subr to not use size-zero arrays when native compilation is
not being used. Formerly, the code was using size-zero arrays (a
GNU C extension) to avoid using memory unnecessarily when
HAVE_NATIVE_COMP is not defined. Replace this hack with the
more-traditional hack of putting the relevant members inside
‘#ifdef HAVE_NATIVE_COMP’.
* src/alloc.c (cleanup_vector, mark_object):
* src/comp.c (make_subr):
* src/data.c (Fsubr_native_lambda_list, Fsubr_native_comp_unit):
* src/eval.c (init_eval_once, funcall_lambda):
* src/lisp.h (SUBR_NATIVE_COMPILEDP, SUBR_NATIVE_COMPILED_DYNP)
(SUBR_TYPE):
* src/lread.c (Fload):
Conditionally compile with ‘#ifdef HAVE_NATIVE_COMP’ instead of
with ‘if (NATIVE_COMP_FLAG)’. Redo members like native_comp_u[0]
to be plain native_comp_u. Put all uses of these members inside
‘#ifdef HAVE_NATIVE_COMP’.
* src/lisp.h (struct Lisp_Subr): Members native_comp_u,
native_c_name, lambda_list, type are now all ifdeffed out if
HAVE_NATIVE_COMP is not defined, instead of being size-zero
arrays. All uses changed.
* src/pdumper.c (dump_subr, dump_cold_native_subr)
(dump_do_dump_relocation):
* src/comp.h (NATIVE_COMP_FLAG): Remove; no longer needed.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/eval.c b/src/eval.c index 0f792b487ed..3ac1afc17bd 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -219,17 +219,14 @@ void | |||
| 219 | init_eval_once (void) | 219 | init_eval_once (void) |
| 220 | { | 220 | { |
| 221 | /* Don't forget to update docs (lispref node "Local Variables"). */ | 221 | /* Don't forget to update docs (lispref node "Local Variables"). */ |
| 222 | if (!NATIVE_COMP_FLAG) | 222 | #ifndef HAVE_NATIVE_COMP |
| 223 | { | 223 | max_specpdl_size = 1800; /* See bug#46818. */ |
| 224 | max_specpdl_size = 1800; /* See bug#46818. */ | 224 | max_lisp_eval_depth = 800; |
| 225 | max_lisp_eval_depth = 800; | 225 | #else |
| 226 | } | 226 | /* Original values increased for comp.el. */ |
| 227 | else | 227 | max_specpdl_size = 2500; |
| 228 | { | 228 | max_lisp_eval_depth = 1600; |
| 229 | /* Original values increased for comp.el. */ | 229 | #endif |
| 230 | max_specpdl_size = 2500; | ||
| 231 | max_lisp_eval_depth = 1600; | ||
| 232 | } | ||
| 233 | Vrun_hooks = Qnil; | 230 | Vrun_hooks = Qnil; |
| 234 | pdumper_do_now_and_after_load (init_eval_once_for_pdumper); | 231 | pdumper_do_now_and_after_load (init_eval_once_for_pdumper); |
| 235 | } | 232 | } |
| @@ -3236,11 +3233,13 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, | |||
| 3236 | else if (MODULE_FUNCTIONP (fun)) | 3233 | else if (MODULE_FUNCTIONP (fun)) |
| 3237 | return funcall_module (fun, nargs, arg_vector); | 3234 | return funcall_module (fun, nargs, arg_vector); |
| 3238 | #endif | 3235 | #endif |
| 3236 | #ifdef HAVE_NATIVE_COMP | ||
| 3239 | else if (SUBR_NATIVE_COMPILED_DYNP (fun)) | 3237 | else if (SUBR_NATIVE_COMPILED_DYNP (fun)) |
| 3240 | { | 3238 | { |
| 3241 | syms_left = XSUBR (fun)->lambda_list[0]; | 3239 | syms_left = XSUBR (fun)->lambda_list; |
| 3242 | lexenv = Qnil; | 3240 | lexenv = Qnil; |
| 3243 | } | 3241 | } |
| 3242 | #endif | ||
| 3244 | else | 3243 | else |
| 3245 | emacs_abort (); | 3244 | emacs_abort (); |
| 3246 | 3245 | ||