summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-04-09 01:57:17 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-04-09 01:57:17 -0700
commit1c5e9c9cc734eb69f9129d74f2250032dd1a1749 (patch)
treeb70523cbe604c2b2c15fca96e0b4975b677e72e9
parent51951d19cefd722633a9c3fb065ab4db7b10a989 (diff)
downloadtxr-1c5e9c9cc734eb69f9129d74f2250032dd1a1749.tar.gz
txr-1c5e9c9cc734eb69f9129d74f2250032dd1a1749.tar.bz2
txr-1c5e9c9cc734eb69f9129d74f2250032dd1a1749.zip
autoload: temporarily disable backward compat.
The purpose of this change is to help with the situation when an uncompiled stdlib is being used (.tl files, no .tlo) and txr is invoked with -C <num> to select compatibility mode with an old version. The problem with compatibility is that it potentially breaks the library due to the different behavior of some macros like caseql. Some test cases in the test suite use backwards compatibility, and sometimes it is necessary to run with the uncompiled test suite when debugging compiler work: situations when the compiler is too broken to build the library. * autoload.c (autoload_try): Temporarly set the opt_compat option to 0 (disabled) around autoload processing. Thus the loading of library code in source code form will not be adversely affected by any syntax or macro level backward compatibility hacks.
-rw-r--r--autoload.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/autoload.c b/autoload.c
index bb293022..002ddee4 100644
--- a/autoload.c
+++ b/autoload.c
@@ -999,11 +999,14 @@ static val autoload_try(al_ns_t ns, val sym)
if (check) {
unsigned ds = debug_clear(opt_dbg_autoload ? 0 : DBG_ENABLE);
val saved_dyn_env = dyn_env;
+ int saved_compat = opt_compat;
remhash(autoload_reg_hash, fun);
dyn_env = make_env(nil, nil, dyn_env);
env_vbind(dyn_env, package_s, system_package);
env_vbind(dyn_env, package_alist_s, packages);
+ opt_compat = 0;
funcall(fun);
+ opt_compat = saved_compat;
dyn_env = saved_dyn_env;
debug_restore(ds);
return t;