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/data.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/data.c')
| -rw-r--r-- | src/data.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/data.c b/src/data.c index 1f2af6f4743..6d9c0aef933 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -3969,7 +3969,7 @@ A is a bool vector, B is t or nil, and I is an index into A. */) | |||
| 3969 | void | 3969 | void |
| 3970 | syms_of_data (void) | 3970 | syms_of_data (void) |
| 3971 | { | 3971 | { |
| 3972 | Lisp_Object error_tail, arith_tail; | 3972 | Lisp_Object error_tail, arith_tail, recursion_tail; |
| 3973 | 3973 | ||
| 3974 | DEFSYM (Qquote, "quote"); | 3974 | DEFSYM (Qquote, "quote"); |
| 3975 | DEFSYM (Qlambda, "lambda"); | 3975 | DEFSYM (Qlambda, "lambda"); |
| @@ -4004,6 +4004,10 @@ syms_of_data (void) | |||
| 4004 | DEFSYM (Qmark_inactive, "mark-inactive"); | 4004 | DEFSYM (Qmark_inactive, "mark-inactive"); |
| 4005 | DEFSYM (Qinhibited_interaction, "inhibited-interaction"); | 4005 | DEFSYM (Qinhibited_interaction, "inhibited-interaction"); |
| 4006 | 4006 | ||
| 4007 | DEFSYM (Qrecursion_error, "recursion-error"); | ||
| 4008 | DEFSYM (Qexcessive_variable_binding, "excessive-variable-binding"); | ||
| 4009 | DEFSYM (Qexcessive_lisp_nesting, "excessive-lisp-nesting"); | ||
| 4010 | |||
| 4007 | DEFSYM (Qlistp, "listp"); | 4011 | DEFSYM (Qlistp, "listp"); |
| 4008 | DEFSYM (Qconsp, "consp"); | 4012 | DEFSYM (Qconsp, "consp"); |
| 4009 | DEFSYM (Qbare_symbol_p, "bare-symbol-p"); | 4013 | DEFSYM (Qbare_symbol_p, "bare-symbol-p"); |
| @@ -4112,6 +4116,16 @@ syms_of_data (void) | |||
| 4112 | PUT_ERROR (Qunderflow_error, Fcons (Qrange_error, arith_tail), | 4116 | PUT_ERROR (Qunderflow_error, Fcons (Qrange_error, arith_tail), |
| 4113 | "Arithmetic underflow error"); | 4117 | "Arithmetic underflow error"); |
| 4114 | 4118 | ||
| 4119 | recursion_tail = pure_cons (Qrecursion_error, error_tail); | ||
| 4120 | Fput (Qrecursion_error, Qerror_conditions, recursion_tail); | ||
| 4121 | Fput (Qrecursion_error, Qerror_message, build_pure_c_string | ||
| 4122 | ("Excessive recursive calling error")); | ||
| 4123 | |||
| 4124 | PUT_ERROR (Qexcessive_variable_binding, recursion_tail, | ||
| 4125 | "Variable binding depth exceeds max-specpdl-size"); | ||
| 4126 | PUT_ERROR (Qexcessive_lisp_nesting, recursion_tail, | ||
| 4127 | "Lisp nesting exceeds `max-lisp-eval-depth'"); | ||
| 4128 | |||
| 4115 | /* Types that type-of returns. */ | 4129 | /* Types that type-of returns. */ |
| 4116 | DEFSYM (Qinteger, "integer"); | 4130 | DEFSYM (Qinteger, "integer"); |
| 4117 | DEFSYM (Qsymbol, "symbol"); | 4131 | DEFSYM (Qsymbol, "symbol"); |