summaryrefslogtreecommitdiffstats
path: root/stdlib/struct.tl
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-03-22 23:57:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-03-22 23:57:38 -0700
commit502c6b4d4a1e29c51c80a39a6eaef27a3f5c0d89 (patch)
tree2dabede4707e240329405b6f008da043766dc657 /stdlib/struct.tl
parentdf0ade89277738dea89abfaa226e91a30025bf60 (diff)
downloadtxr-502c6b4d4a1e29c51c80a39a6eaef27a3f5c0d89.tar.gz
txr-502c6b4d4a1e29c51c80a39a6eaef27a3f5c0d89.tar.bz2
txr-502c6b4d4a1e29c51c80a39a6eaef27a3f5c0d89.zip
lib: address remaining unused variable warnings.
* stdlib/arith-each.tl (sys-arith-each): Remove :form param. * stdlib/awk.tl (awk-state :fini): Suppress unused warning in dohash form by using an uninterned symbol for this variable. This is a useful technique worth documenting. (awk-expander): Remove unused varaible in a predicate pattern. (awk-code-move-check): Lose the unused awc and aws-sym. (awk-mac-let): Don't pass the unused parameters to awk-code-move-check. * stdlib/conv.tl (conv-expand): Remove unused gensym. * stdlib/debugger.tl (fcall-frame loc, fcall-frame print-trace, expand-frame print-trace): Mark unused parameters ignored. * stdlib/defset.tl (defset-expander-simple): Remove unused parameter. (defset): Drop argument from defset-expander-simple call, and also fix unused warning in tree-case form. * stdlib/doc-lookup.tl (detached-run): Remove unused variable from a pattern matching predicate. It's not in the rightmost position so we have to revers the comparison. I will enhance the pattern matcher to support @nil in a predicate. (toplevel): Ignore a parameter of the not-implemented version of the open-url function. * stdlib/doloop.tl (expand-dooloop): Replace unused variable in a tree binding pattern with the t symbol. * stdlib/each-prod.tl (expand-each-prod*): Remove unused let variable. * stdlib/except.tl (expand-handle): Put else variable in tree bind pattern to use. * stdlib/getopts.tl (opt-desc (basic-type-p, cumul-type-p)): Replace unused catch-all variable in tree bind pattern with t symbol. (opt-processor parse-opts): Remove unused args argument. The object holds the args, prepared at construction time. (getopts, option-base getopts): Don't pass args to parse-opts. (define-option-struct): Replace unused treee pattern variable with t. * stdlib/ifa.tl (if-to-cond): Put catch-all else variable to use. * stdlib/keyparams.tl (param-expander): Mark unused parameter ignored. Replace unused variables in tree-case with t. * stdlib/match.tl (compile-struct-match, compile-predicate-match, compile-require-match, compile-as-match, compile-with-match, compile-or-match, compile-and-match, compile-not-match, compile-hash-match, compile-scan-match, compile-exprs-match): Address unused variables in mac-param-bind and tree-bind patterns. (match-case): Likewise, and also remove unused let variables. (while-match-case, while-true-match-case): Remove unused :env parameter. (expand-lambda-match): Remove unused let variable. (defun-match): Remove unused variable in tree-bind. (define-param-expander): Mark menv parameter ignored. Unused variables in tree-bind. (defmatch): Replace lambda variable with a gensym. (loosen, pat-len): Remove unused parameter. (sme, end): Fix calls to loosen and pat-len. (non-triv-pat-p): Mark parameter ignored in the temporary version of this function. (expand-quasi-match): Address unused variables in patterns, and remove unused gensyms. * stdlib/op.tl (op-rec-p): Unused variable in tree-case. (op-alpha-rename): Remove f parameter. (op-ignerr): Mark catch handler parameter ignored. (op-expand): Remove argument from calls to op-alpha-rename. * stdlib/path.test (if-windows, if-native-windows): The compiler complains here about the unused variable due to constant folding. We use the use function to indicate that the variable is not ignored, but used. * stdlib/pic.tl (expand-pic-num): Remove unused let variable. (pic): Remove unused :env parameter. * stdlib/place.tl (macroexpand-1-place): Ignore unused env parameter. (pset): Ignore some tree-bind variables. Not replacing them with t because their names help code readability. Lots of tricky code in place.tl. (shift): Replace unused variable with t in tree-case. (vecref, chr-str, ref, sub): Deal with unused expander parameters. (gethash): Deal with unused place parameter. (dwim): Remove unused env parameter, and deal with unused place parameters. (get-fun-getter-setter): Unused variables in tree-bind. (read-once, define-modify-macro): Remove unused gensyms. (placelet-1): Mark ignored a parameter of an update expander lambda. * stdlib/pmac.tl (macroexpand-params): Fix unused catch-all in tree-case. * stdlib/struct.tl (prune-missing-inits): Mark tree-bind unused variable ignored. (defstruct): Unused tree-case variable. (qref): Unused tree-case catch-all variables. (rslot): Unused parameter removed. (:delegate): Unused tree-case variables. * stdlib/tagbody.tl (tagbody): Drop unused :env param. Mark ignored the threaded-2 let variable, which cannot be removed because its init-form performs a needed side effect. * stdlib/trace.tl (trace-leave): Remove unused param. (trace): Don't pass argument to unused param of trace-leave. (untrace): Use gensym in dohash to suppress unused variable warning. * stdlib/type.tl (typecase-expander): Unused variable in tree-case. * stdlib/with-resources.tl (with-resources): Likewise. * stdlib/yield.tl (hlet-expand): Remove two unused locals. * tests/012/lambda.tl: Fix test cases that break the tests due to unused variable warnings. * tests/016/arith.tl: Add test case for each-prod*. At first I thought a bug was found in it but it turned out that the init-forms variable that was removed was really superfluous.
Diffstat (limited to 'stdlib/struct.tl')
-rw-r--r--stdlib/struct.tl13
1 files changed, 7 insertions, 6 deletions
diff --git a/stdlib/struct.tl b/stdlib/struct.tl
index 48e7055d..726b7fce 100644
--- a/stdlib/struct.tl
+++ b/stdlib/struct.tl
@@ -35,6 +35,7 @@
(defun sys:prune-missing-inits (slot-init-forms)
(remove-if (tb ((kind name : (init-form nil init-form-present)))
+ (ignore name init-form)
(and (member kind '(:static :instance :function))
(not init-form-present)))
slot-init-forms))
@@ -61,7 +62,7 @@
(additional-supers nil))
(labels ((expand-slot (form slot)
(tree-case slot
- ((op . args)
+ ((op . t)
(iflet ((expander [*struct-clause-expander* op]))
(append-each ((exslot [expander slot form]))
[expand-slot form exslot])
@@ -249,7 +250,7 @@
^(slet ((,s ,b))
(if ,s (qref ,s ,*refs))))
:))
- (x (tree-case refs
+ (t (tree-case refs
(() ())
(((pref sym) . more)
(if (eq pref t)
@@ -291,7 +292,7 @@
((sym . more)
(sys:check-slot form sym)
^(qref (slot ,obj ',sym) ,*more))
- (obj (throwf 'eval-error "~s: bad syntax: ~s" 'qref refs))))))
+ (else (throwf 'eval-error "~s: bad syntax: ~s" 'qref else))))))
(defmacro uref (. args)
(cond
@@ -393,7 +394,7 @@
(slotset struct sym val)
(call (umethod meth-sym) struct)))
-(defmacro usr:rslot (struct sym meth-sym)
+(defmacro usr:rslot (struct sym t)
^(slot ,struct ,sym))
(define-place-macro usr:rslot (struct sym meth-sym)
@@ -465,8 +466,8 @@
(cons : (collect-each ((o pp.opt))
(tree-case o
((sym) ^(,sym :))
- ((sym init) o)
- ((sym init sym-p)
+ ((t t) o)
+ ((t t t)
(compile-error form
"~s: three-element optional \ \
parameter ~s not supported"