From a3a1d75a0fa8e5db8eee9b59285251b6368530ac Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 20 Mar 2023 17:00:17 -0700 Subject: compiler: compiler options mechanism. Introducing a compiler options system, so we can control diagnostics and such. We begin with three options for diagnosing shadowing. * autoload.c (compiler_set_entries): Register a structure name compiler-opts, a with-compile-opts function name, *compile-opts* variable name, and slots shadow-fun, shadow-var and shadow-cross. * stdlib/compiler.tl (compile-opts): New struct. (%warning-syms%): New macro. (*compile-opts*): New special variable. (when-opt, with-compile-opts): New macros. (opt-controlled-diag): New function. (env extend-var): Call extend-var* method instead of repeating code. (env extend-var*): Implement shadow-var and shadow-cross diagnostic options. (env extend-fun): Implement shadow-fun and shadow-cross diagnostic options. --- autoload.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'autoload.c') diff --git a/autoload.c b/autoload.c index 745df8e9..accead94 100644 --- a/autoload.c +++ b/autoload.c @@ -652,19 +652,29 @@ static val compiler_set_entries(val fun) lit("compiler"), lit("*in-compilation-unit*"), nil }; + val sname[] = { + lit("compile-opts"), + nil + }; val name[] = { lit("compile-toplevel"), lit("compile"), lit("compile-file"), lit("compile-update-file"), lit("with-compilation-unit"), lit("dump-compiled-objects"), + lit("with-compile-opts"), nil }; val vname[] = { - lit("*opt-level*"), + lit("*opt-level*"), lit("*compile-opts*"), nil }; + val slname[] = { + lit("shadow-fun"), lit("shadow-var"), lit("shadow-cross"), nil + }; autoload_sys_set(al_struct, sys_name, fun); + autoload_set(al_struct, sname, fun); autoload_set(al_fun, name, fun); autoload_set(al_var, vname, fun); + autoload_set(al_slot, slname, fun); return nil; } -- cgit v1.2.3