From db2d654347e06fe7e40a498eee02e523936f4a53 Mon Sep 17 00:00:00 2001
From: Kaz Kylheku <kaz@kylheku.com>
Date: Fri, 17 Mar 2017 06:47:48 -0700
Subject: trace: implement redefinition checks.

The tracing module should warn when traced functions or
methods are being redefined, and stop tracing the original
methods.

* eval.c (trace_check): New function. Calls
sys:trace-redefined-check if the trace module has been
loaded, otherwise does nothing.
(op_defun, op_defmacro): Call trace_check to have a warning
issued for a redefined traced function or macro.

* eval.h (trace_check): Declared.

* lisplib.c (trace_loaded): New global variable.
(trace_instantiate): Flip trace_loaded to t.

* lisplib.h (trace_loaded): Declared.

* share/txr/stdlib/trace.tl (sys:trace-redefine-check): New
function. Checks two situations: traced function or method
is redefined (neither old nor new is traced any longer),
and traced method is overridden (base method continues to be
traced, override is not traced).

* struct.c (static_slot_ensure): Do a trace check here,
taking care of defmeth.
---
 eval.h | 1 +
 1 file changed, 1 insertion(+)

(limited to 'eval.h')

diff --git a/eval.h b/eval.h
index bf97af3c..69391879 100644
--- a/eval.h
+++ b/eval.h
@@ -68,6 +68,7 @@ val apply_intrinsic(val fun, val args);
 val eval_progn(val forms, val env, val ctx_form);
 val eval(val form, val env, val ctx_form);
 val eval_intrinsic(val form, val env);
+void trace_check(val name);
 val format_field(val string_or_list, val modifier, val filter, val eval_fun);
 val subst_vars(val forms, val env, val filter);
 val expand_quasi(val quasi_forms, val menv);
-- 
cgit v1.2.3