summaryrefslogtreecommitdiffstats
path: root/stdlib/getopts.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/getopts.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/getopts.tl')
-rw-r--r--stdlib/getopts.tl12
1 files changed, 6 insertions, 6 deletions
diff --git a/stdlib/getopts.tl b/stdlib/getopts.tl
index fee9b7f5..74c770bc 100644
--- a/stdlib/getopts.tl
+++ b/stdlib/getopts.tl
@@ -79,7 +79,7 @@
((indicator btype) (and (eq indicator 'list)
(neq btype :bool)
me.(basic-type-p btype)))
- (x nil)))
+ (t nil)))
(defmeth opt-desc cumul-type-p (me type)
(tree-case type
@@ -87,7 +87,7 @@
(neq btype :bool)
(or me.(basic-type-p btype)
me.(list-type-p btype))))
- (x nil)))
+ (t nil)))
(defmeth opt-desc check (me)
(unless (or me.(basic-type-p me.type)
@@ -232,7 +232,7 @@
opts.(add-opt (new (sys:opt-parsed o arg od))))
(sys:opt-err "unrecognized option: -~a" o))))
-(defmeth sys:opt-processor parse-opts (me args)
+(defmeth sys:opt-processor parse-opts (me)
(let ((opts me.opts))
(whilet ((arg (pop opts.out-args)))
(cond
@@ -273,7 +273,7 @@
(defun getopts (opt-desc-list args)
(let* ((opts (new opts in-args args out-args args))
(opr (new sys:opt-processor od-list opt-desc-list opts opts)))
- opr.(parse-opts args)))
+ opr.(parse-opts)))
(defun opthelp (opt-desc-list : (*stdout* *stdout*))
(let ((sorted [nsort (copy-list (remove-if (op null @1.helptext)
@@ -428,7 +428,7 @@
(:method getopts (me args)
(set me.in-args args me.out-args args)
(let ((opr (new sys:opt-processor od-list me.opt-desc-list opts me)))
- opr.(parse-opts args)))
+ opr.(parse-opts)))
(:method opthelp (me : (stream *stdout*))
(opthelp me.opt-desc-list stream))
(:method opthelp-conventions (me : (stream *stdout*))
@@ -437,7 +437,7 @@
(opthelp-types me.opt-desc-list stream)))
(defmacro define-option-struct (name super-spec . opts)
- (let* ((slots (mapcar (tb ((short long . rest))
+ (let* ((slots (mapcar (tb ((short long . t))
(or long short))
opts))
(supers (if (and super-spec (atom super-spec))