Ticket #861 (closed defect: invalid)
overzealous and flaky warning about SETQ'd unused lexical variable/
|Reported by:||mhd||Owned by:|
Sometimes the compiler warns
style-warning: Unused lexical variable FOO
where FOO is some variable I've SETQ'd but then not referred to.
That's annoying enough. I don't think that should be done at all. It's a pain to have to throw away documentary (multiple-value-setq (x y z) ...) variables or go through other hoops just to get rid of this warning. Also, it's "used" by reasonable definition: it's set, just not "read" or "eval'd". Whatever. It's a pain to encounter and to work around.
But that's not the main point.
Sometimes -- not always!! -- I cannot even still the compiler by simply placing the variable inline to be evaluated.
The compiler first of all is so clever as to optimize out the reference, then turns on me and tells me it's not referenced. That is quite frustrating to put it mildly.
Seems to happen in big functions. Small functions work fine, so I cannot give you an example. But it's like this:
(defun foo (a b) (let (c d) (multiple-value-setq (c d) (round a b)) c))
always warns about D "unused" (annoying to me, but I can deal with it)
(defun foo (a b) (let (c d) (multiple-value-setq (c d) (round a b)) d c))
not in this case, but in some larger functions, warns about D -- unacceptable, bug, etc.!
Note: let me know if this is a known problem: that is, the flakyness (dependency on function size, or whatever), or -- if not -- if you need an example. I'll put cycles on it, but would rather not if it's already known.
CCL::*OPENMCL-MAJOR-VERSION*, Value: 1 CCL::*OPENMCL-MINOR-VERSION*, Value: 6