diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-03-08 20:00:24 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-03-08 20:00:24 -0800 |
commit | e3de6944770ff890e555f434d6d39e443d4b2542 (patch) | |
tree | a5f4d4ed1a3651f08bcada9acf0eb99c1a329627 /stdlib/optimize.tl | |
parent | c005ad21d1259ea8c984e0084fd8b71cff86ca4d (diff) | |
download | txr-e3de6944770ff890e555f434d6d39e443d4b2542.tar.gz txr-e3de6944770ff890e555f434d6d39e443d4b2542.tar.bz2 txr-e3de6944770ff890e555f434d6d39e443d4b2542.zip |
tests: suppress warnings in seq.tl.
When tests/012/compile.tl compiles tests/012/seq.tl, there
are now some compiler warnings due to constant expressions
that throw. We introduce a new compiler option to suppress
them, and then use it.
* stdlib/comp-opts.tl: New file. The definitions related
to compiler options are moved here out of compile.tl,
so that optimize.tl can use them.
* stdlib/compiler.tl (compile-opts, %warning-syms%,
when-opt, *compile-opts*, opt-controlled-diag): Moved to
comp-opts.tl. New constant-throws option added to
compile-opts and %warning-syms%.
(safe-constantp): Make the constant expression throws
diagnostic conditional on the new option.
* stdlib/optimize.tl: Load comp-opts file.
(basic-blocks do-peephole-block): Make diagnostic
about throwing situation subject to constant-throws
option.
* tests/012/seq.tl: Turn off constant-throws warning
option before the ref tests that work with ranges.
Fix: one of the expressions calls refs with the
wrong number of arguments, which was unintentional.
* txr.1: Document new diagnostic option.
Diffstat (limited to 'stdlib/optimize.tl')
-rw-r--r-- | stdlib/optimize.tl | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/stdlib/optimize.tl b/stdlib/optimize.tl index dd43de68..52e5504c 100644 --- a/stdlib/optimize.tl +++ b/stdlib/optimize.tl @@ -25,7 +25,9 @@ ;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ;; POSSIBILITY OF SUCH DAMAGE. -(load-for (usr:var %const-foldable% "constfun")) +(load-for + (usr:var %const-foldable% "constfun") + (usr:macro when-opt "comp-opts")) (compile-only (defstruct live-info nil @@ -555,12 +557,13 @@ (apply fun (append [args 0..-1] [args -1]))) (error (#:x) err)))) - (when (and (eq val err) - (not (member insn bb.warned-insns))) - (compile-warning co.top-form - "function ~s with arguments ~s throws" - fun args) - (push insn bb.warned-insns)) + (when-opt usr:constant-throws + (when (and (eq val err) + (not (member insn bb.warned-insns))) + (diag co.top-form + "function ~s with arguments ~s throws" + fun args) + (push insn bb.warned-insns))) val)) (neq val err))) (let* ((dreg bb.compiler.(get-dreg val))) |