GNU bug report logs - #41287
28.0.50; Spurious warning "Unused lexical"

Previous Next

Package: emacs;

Reported by: Michael Albinus <michael.albinus <at> gmx.de>

Date: Fri, 15 May 2020 13:45:02 UTC

Severity: minor

Merged with 16206, 31232, 39919

Found in versions 24.3, 26.3, 28.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41287 in the body.
You can then email your comments to 41287 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41287; Package emacs. (Fri, 15 May 2020 13:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Albinus <michael.albinus <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 15 May 2020 13:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; Spurious warning "Unused lexical"
Date: Fri, 15 May 2020 15:44:05 +0200
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?

Best regards, Michael.


In GNU Emacs 28.0.50 (build 12, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2020-05-04 built on gandalf
Repository revision: 106936415d2892fc373842b3aedd805096fc9e0e
Repository branch: master
Windowing system distributor 'Fedora Project', version 11.0.12008000
System Description: Fedora 32 (Workstation Edition)

Recent messages:
Grep finished with 8 matches found
Saving file /home/albinus/src/tramp-2-4-stable/lisp/tramp.el...
Wrote /home/albinus/src/tramp-2-4-stable/lisp/tramp.el
Undo [3 times]
Saving file /home/albinus/src/tramp-2-4-stable/lisp/tramp.el...
Wrote /home/albinus/src/tramp-2-4-stable/lisp/tramp.el
Saving file /home/albinus/src/tramp-2-4-stable/lisp/tramp.el...
Wrote /home/albinus/src/tramp-2-4-stable/lisp/tramp.el
Saving file /home/albinus/src/tramp-2-4-stable/lisp/tramp.el...
Wrote /home/albinus/src/tramp-2-4-stable/lisp/tramp.el

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS PDUMPER LCMS2
GMP

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8

Major mode: ELisp/l

Minor modes in effect:
  debbugs-browse-mode: t
  bug-reference-prog-mode: t
  erc-notify-mode: t
  erc-notifications-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  delete-selection-mode: t
  icomplete-mode: t
  show-paren-mode: t
  url-handler-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-autoloads hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-autoloads
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-pkg hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-pkg
~/lisp/dbus hides /usr/local/share/emacs/28.0.50/lisp/net/dbus
/home/albinus/src/tramp/lisp/tramp-sh hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-sh
/home/albinus/src/tramp/lisp/tramp-ftp hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-ftp
/home/albinus/src/tramp/lisp/tramp hides /usr/local/share/emacs/28.0.50/lisp/net/tramp
/home/albinus/src/tramp/lisp/tramp-cache hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-cache
/home/albinus/src/tramp/lisp/tramp-uu hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-uu
/home/albinus/src/tramp/lisp/tramp-rclone hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-rclone
/home/albinus/src/tramp/lisp/tramp-integration hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-integration
/home/albinus/src/tramp/lisp/tramp-archive hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-archive
/home/albinus/src/tramp/lisp/tramp-adb hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-adb
/home/albinus/src/tramp/lisp/tramp-cmds hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-cmds
/home/albinus/src/tramp/lisp/tramp-compat hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-compat
/home/albinus/src/tramp/lisp/tramp-sudoedit hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-sudoedit
/home/albinus/src/tramp/lisp/tramp-gvfs hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-gvfs
/home/albinus/src/tramp/lisp/tramp-loaddefs hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-loaddefs
/home/albinus/src/tramp/lisp/tramp-smb hides /usr/local/share/emacs/28.0.50/lisp/net/tramp-smb
/home/albinus/src/tramp/lisp/trampver hides /usr/local/share/emacs/28.0.50/lisp/net/trampver

Features:
(shadow emacsbug edebug tramp-archive cus-start cus-load makeinfo
texinfo eww mm-url cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs net-utils tabify imenu man gnus-fun
org-element avl-tree generator ol-eww ol-rmail ol-mhe ol-irc ol-info
ol-gnus ol-docview doc-view image-mode exif ol-bibtex bibtex ol-bbdb
ol-w3m org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-footnote org-src ob-comint org-pcomplete org-list org-faces
org-entities org-version ob-emacs-lisp ob-core ob-eval org-table ol
org-keys org-compat advice org-macs org-loaddefs cal-menu calendar
cal-loaddefs whitespace log-edit pcvs-util ediff-vers ediff ediff-merg
ediff-mult ediff-wind ediff-diff ediff-help ediff-init ediff-util vc-src
vc-sccs vc-svn vc-cvs vc-rcs vc-dir grep tramp-tests vc-hg vc-bzr ert-x
ert ewoc debug ibuf-ext ibuffer ibuffer-loaddefs eieio-opt speedbar
ezimage dframe smerge-mode diff crm debbugs-gnu add-log debbugs
soap-client warnings rng-xsd rng-dt rng-util xsd-regexp shr-color color
debbugs-browse bug-reference tramp-gvfs zeroconf vc-git diff-mode
yaml-mode reveal noutline outline easy-mmode help-fns radix-tree
cl-print backtrace find-func url-queue mailalias mule-util nnir
flow-fill url-http url-gw url-auth gnus-gravatar gravatar dns url-cache
sort gnus-cite smiley mm-archive mail-extr gnus-bcklg misearch
multi-isearch autorevert filenotify compile time-stamp gnus-async
cl-extra help-mode qp gnus-ml pop3 utf-7 nndraft nnmh nnml gnutls
network-stream nsm gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-cache
gnus-sum url url-proxy url-privacy url-expand url-methods url-history
mailcap shr url-cookie url-domsuf url-util svg dom nnnil smtpmail
sendmail gnus-demon nntp gnus-group gnus-undo gnus-start gnus-cloud
nnimap nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range
message rmc puny rfc822 mml mml-sec epa derived epg epg-config mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
gnus-win gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045
ietf-drums text-property-search mail-utils mm-util mail-prsvr wid-edit
vc vc-dispatcher erc-notify erc-networks erc-desktop-notifications
erc-match notifications dbus xml erc-goodies erc erc-backend erc-compat
thingatpt pp erc-loaddefs cperl-mode time tramp-sh docker-tramp
tramp-cache vagrant-tramp dash term disp-table ehelp tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat shell
pcomplete comint ansi-color ring parse-time iso8601 time-date ls-lisp
format-spec delsel ido jka-compr icomplete paren dired dired-loaddefs
info package easymenu browse-url url-handlers url-parse auth-source
cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json
subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv
cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 771270 139571)
 (symbols 48 46522 1)
 (strings 32 165305 29406)
 (string-bytes 1 5638146)
 (vectors 16 66173)
 (vector-slots 8 1598521 118508)
 (floats 8 447 455)
 (intervals 56 39716 5496)
 (buffers 992 88))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41287; Package emacs. (Fri, 15 May 2020 14:09:01 GMT) Full text and rfc822 format available.

Message #8 received at 41287 <at> debbugs.gnu.org (full text, mbox):

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 41287 <at> debbugs.gnu.org
Subject: Re: bug#41287: 28.0.50; Spurious warning "Unused lexical"
Date: Fri, 15 May 2020 16:07:55 +0200
Am Fr., 15. Mai 2020 um 15:45 Uhr schrieb Michael Albinus
<michael.albinus <at> gmx.de>:
>
>
> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41287; Package emacs. (Fri, 15 May 2020 14:26:02 GMT) Full text and rfc822 format available.

Message #11 received at 41287 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Philipp Stephani <p.stephani2 <at> gmail.com>
Cc: 41287 <at> debbugs.gnu.org
Subject: Re: bug#41287: 28.0.50; Spurious warning "Unused lexical"
Date: Fri, 15 May 2020 16:25:08 +0200
Philipp Stephani <p.stephani2 <at> gmail.com> writes:

>> `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.

Indeed, thanks. I've merged both bugs.

Best regards, Michael.




Severity set to 'minor' from 'normal' Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Fri, 15 May 2020 14:28:01 GMT) Full text and rfc822 format available.

Merged 16206 31232 39919 41287. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Fri, 15 May 2020 14:28:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 31232 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Wed, 30 Sep 2020 18:32:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Oct 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 172 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.