From b95fa78d3bf572b190cb26bfc73a35d28a30d0dd Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 13 Apr 2020 19:24:31 -0700 Subject: bugfix: definitions must trigger autoload. When a function, macro, variale, symbol macro or struct is being defined, we must trigger any auto-load for that symbol. If the definition is redefining a library symbol, then if the autoload is later triggered, it will surprisingly reinstate the library definition. * eval.c (rt_defvarl, op_defsymacro, rt_defsymacro, rt_defun, rt_defmacro): Insert calls to lisplib_try_load against the symbol being defined. * struct.c (make_struct_type): Likewise. --- eval.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index b2954e91..b7cc387d 100644 --- a/eval.c +++ b/eval.c @@ -1945,7 +1945,8 @@ static val rt_defvarl(val sym) { val self = lit("defvar"); val new_p; - val cell = gethash_c(self, top_vb, sym, mkcloc(new_p)); + val cell = (lisplib_try_load(sym), + gethash_c(self, top_vb, sym, mkcloc(new_p))); if (new_p || !cdr(cell)) { uw_purge_deferred_warning(cons(var_s, sym)); @@ -1978,6 +1979,7 @@ static val op_defsymacro(val form, val env) (void) env; + lisplib_try_load(sym); remhash(top_vb, sym); if (!opt_compat || opt_compat > 143) remhash(special, sym); @@ -1987,6 +1989,7 @@ static val op_defsymacro(val form, val env) static val rt_defsymacro(val sym, val def) { + lisplib_try_load(sym); remhash(top_vb, sym); remhash(special, sym); sethash(top_smb, sym, cons(sym, def)); @@ -2008,6 +2011,7 @@ void trace_check(val name) static val rt_defun(val name, val function) { + lisplib_try_load(name); sethash(top_fb, name, cons(name, function)); uw_purge_deferred_warning(cons(fun_s, name)); uw_purge_deferred_warning(cons(sym_s, name)); @@ -2016,6 +2020,7 @@ static val rt_defun(val name, val function) static val rt_defmacro(val sym, val name, val function) { + lisplib_try_load(sym); sethash(top_mb, sym, cons(name, function)); return name; } -- cgit v1.2.3