Subject: bug#41287: 28.0.50; Spurious warning "Unused lexical"

From: Philipp Stephani <[email-masked]>
Date: Fri, 15 May 2020 16:07:55 +0200

Am Fr., 15. Mai 2020 um 15:45 Uhr schrieb Michael Albinus
<[email-masked]>:
>
>
> I have the following defun in tramp.el (my local repo)
>
> --8<---------------cut here---------------start------------->8---
> (defun tramp-get-signal-strings ()
>   "Strings to return by `process-file' in case of signals."
>   ;; We use key nil for local connection properties.
>   (with-tramp-connection-property nil "signal-strings"
>     (let (result)
>       (if (and (stringp shell-file-name) (executable-find shell-file-name))
>           (dotimes (i 128 (reverse result))
>             (push
>              (if (= i 19) 1 ;; SIGSTOP
>                (call-process
>                 shell-file-name nil nil nil "-c" (format "kill -%d $$" i)))
>              result))
>         (dotimes (i 128 (reverse result))
>           (push (format "Signal %d" i) result))))))
> --8<---------------cut here---------------end--------------->8---
>
> Compiling this, I get
>
> --8<---------------cut here---------------start------------->8---
> tramp.el:5065:1: Warning: Unused lexical variable ‘i’
> tramp.el:5065:1: Warning: Unused lexical variable ‘i’
> --8<---------------cut here---------------end--------------->8---
>
> `i' is used in both `dotimes' loops. What does the compiler tell me?

This is probably the same as Bug#39919. tl;dr: remove the result
argument from the dotimes form.