Suppress warnings for register-groups-bind with empty var-list
If (for some reason) the var-list is empty, there is no code generated that uses the reg-starts and reg-ends variables, and hence they become unused. And without the bindings, the substr-fn is also not necessary.
This commit is contained in:
26
api.lisp
26
api.lisp
@ -332,15 +332,7 @@ substrings may share structure with TARGET-STRING."
|
|||||||
(with-rebinding (target-string)
|
(with-rebinding (target-string)
|
||||||
(with-unique-names (match-start match-end reg-starts reg-ends
|
(with-unique-names (match-start match-end reg-starts reg-ends
|
||||||
start-index substr-fn)
|
start-index substr-fn)
|
||||||
`(multiple-value-bind (,match-start ,match-end ,reg-starts ,reg-ends)
|
(let ((var-bindings
|
||||||
(scan ,regex ,target-string :start (or ,start 0)
|
|
||||||
:end (or ,end (length ,target-string)))
|
|
||||||
(declare (ignore ,match-end))
|
|
||||||
(when ,match-start
|
|
||||||
(let* ,(cons
|
|
||||||
`(,substr-fn (if ,sharedp
|
|
||||||
#'nsubseq
|
|
||||||
#'subseq))
|
|
||||||
(loop for (function var) in (normalize-var-list var-list)
|
(loop for (function var) in (normalize-var-list var-list)
|
||||||
for counter from 0
|
for counter from 0
|
||||||
when var
|
when var
|
||||||
@ -352,8 +344,20 @@ substrings may share structure with TARGET-STRING."
|
|||||||
,target-string
|
,target-string
|
||||||
,start-index
|
,start-index
|
||||||
(aref ,reg-ends ,counter)))
|
(aref ,reg-ends ,counter)))
|
||||||
nil)))))
|
nil))))))
|
||||||
,@body))))))
|
`(multiple-value-bind (,match-start ,match-end ,reg-starts ,reg-ends)
|
||||||
|
(scan ,regex ,target-string :start (or ,start 0)
|
||||||
|
:end (or ,end (length ,target-string)))
|
||||||
|
(declare (ignore ,match-end))
|
||||||
|
,@(unless var-bindings
|
||||||
|
`((declare (ignore ,reg-starts ,reg-ends))))
|
||||||
|
(when ,match-start
|
||||||
|
,@(if var-bindings
|
||||||
|
`((let* ,(list*
|
||||||
|
`(,substr-fn (if ,sharedp #'nsubseq #'subseq))
|
||||||
|
var-bindings)
|
||||||
|
,@body))
|
||||||
|
body)))))))
|
||||||
|
|
||||||
(defmacro do-scans ((match-start match-end reg-starts reg-ends regex
|
(defmacro do-scans ((match-start match-end reg-starts reg-ends regex
|
||||||
target-string
|
target-string
|
||||||
|
|||||||
Reference in New Issue
Block a user