diff options
| author | Alan Mackenzie | 2021-12-31 21:21:46 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2021-12-31 21:21:46 +0000 |
| commit | ff9af1f1f69264bcbb7b926363293e55a6b3f330 (patch) | |
| tree | 0ec9f8ce5850d6f6fd1defe23b1a42f45cb2a795 /src/eval.c | |
| parent | 1cd188799f86bcb13ad76e82e3436b1b7e9f9e9f (diff) | |
| download | emacs-ff9af1f1f69264bcbb7b926363293e55a6b3f330.tar.gz emacs-ff9af1f1f69264bcbb7b926363293e55a6b3f330.zip | |
Miscellaneous enhancements to scratch/correct-warning-pos.
1. Check the type (symbol with position) of the argument given to the native
compiled version of SYMBOL_WITH_POS_SYM.
2. Handle infinite recursion caused by circular lists, etc., in
macroexp-strip-symbol-positions by using hash tables.
3. Read byte compiled functions without giving symbols positions.
* lisp/emacs-lisp/comp.el (comp-finalize-relocs): Add symbol-with-pos-p into
the list of relocated symbols.
* lisp/emacs-lisp/macroexp.el (macroexp--ssp-conses-seen)
(macroexp--ssp-vectors-seen, macroexp--ssp-records-seen): Renamed, and
animated as hash tables.
(macroexp--strip-s-p-2): Optionally tests for the presence of an argument in
one of the above hash tables, so as to handle otherwise infinite recursion.
(byte-compile-strip-s-p-1): Add a condition-case to handle infinite recursion
caused by circular lists etc., using the above hash tables as required.
* src/comp.c (comp_t): New element symbol_with_pos_sym.
(emit_SYMBOL_WITH_POS_SYM): Amend just to call the new SYMBOL_WITH_POS_SYM.
(emit_CHECK_SYMBOL_WITH_POS, define_SYMBOL_WITH_POS_SYM): New functions.
(Fcomp__init_ctxt): Register an emitter for Qsymbol_with_pos_p.
(Fcomp__compile_ctxt_to_file): Call define_SYMBOL_WITH_POS_SYM.
(syms_of_comp): Define Qsymbol_with_pos_p.
* src/data.c (syms_of_data): Define a new error symbol Qrecursion_error, an
error category for the new error symbols Qexcessive_variable_binding and
Qexcessive_lisp_nesting.
* src/eval.c (grow_specpdl): Change the signal_error call to an xsignal0 call
using the new error symbol Qexcessive_variable_binding.
(eval_sub, Ffuncall): Change the `error' calls to xsignal using the new error
symbol Qexcessive_lisp_nesting.
* src/lread.c (read1): When reading a compiled function, read the components
of the vector without giving its symbols a position.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/eval.c b/src/eval.c index 94ad0607732..5cb673ab223 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -2398,8 +2398,7 @@ grow_specpdl (void) | |||
| 2398 | if (max_specpdl_size < 400) | 2398 | if (max_specpdl_size < 400) |
| 2399 | max_size = max_specpdl_size = 400; | 2399 | max_size = max_specpdl_size = 400; |
| 2400 | if (max_size <= specpdl_size) | 2400 | if (max_size <= specpdl_size) |
| 2401 | signal_error ("Variable binding depth exceeds max-specpdl-size", | 2401 | xsignal0 (Qexcessive_variable_binding); |
| 2402 | Qnil); | ||
| 2403 | } | 2402 | } |
| 2404 | pdlvec = xpalloc (pdlvec, &pdlvecsize, 1, max_size + 1, sizeof *specpdl); | 2403 | pdlvec = xpalloc (pdlvec, &pdlvecsize, 1, max_size + 1, sizeof *specpdl); |
| 2405 | specpdl = pdlvec + 1; | 2404 | specpdl = pdlvec + 1; |
| @@ -2453,7 +2452,7 @@ eval_sub (Lisp_Object form) | |||
| 2453 | if (max_lisp_eval_depth < 100) | 2452 | if (max_lisp_eval_depth < 100) |
| 2454 | max_lisp_eval_depth = 100; | 2453 | max_lisp_eval_depth = 100; |
| 2455 | if (lisp_eval_depth > max_lisp_eval_depth) | 2454 | if (lisp_eval_depth > max_lisp_eval_depth) |
| 2456 | error ("Lisp nesting exceeds `max-lisp-eval-depth'"); | 2455 | xsignal0 (Qexcessive_lisp_nesting); |
| 2457 | } | 2456 | } |
| 2458 | 2457 | ||
| 2459 | Lisp_Object original_fun = XCAR (form); | 2458 | Lisp_Object original_fun = XCAR (form); |
| @@ -3044,7 +3043,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 3044 | if (max_lisp_eval_depth < 100) | 3043 | if (max_lisp_eval_depth < 100) |
| 3045 | max_lisp_eval_depth = 100; | 3044 | max_lisp_eval_depth = 100; |
| 3046 | if (lisp_eval_depth > max_lisp_eval_depth) | 3045 | if (lisp_eval_depth > max_lisp_eval_depth) |
| 3047 | error ("Lisp nesting exceeds `max-lisp-eval-depth'"); | 3046 | xsignal0 (Qexcessive_lisp_nesting); |
| 3048 | } | 3047 | } |
| 3049 | 3048 | ||
| 3050 | count = record_in_backtrace (args[0], &args[1], nargs - 1); | 3049 | count = record_in_backtrace (args[0], &args[1], nargs - 1); |