From: Tino Calancha <tino.calancha@gmail.com>
To: 28107@debbugs.gnu.org
Subject: bug#28107: 26.0.50; Byte compilation shows an unused var warning for an used variable
Date: Wed, 16 Aug 2017 15:11:47 +0900 [thread overview]
Message-ID: <87d17wyrbw.fsf@calancha-pc> (raw)
Write a file '/tmp/test.el' with following content:
--8<-----------------------------cut here---------------start------------->8---
;; -*- lexical-binding: t; -*-
;; Compiles OK
(defun test ()
(let ((lst (list "foo" 1)))
(when (cdr lst)
(equal (cdr lst) 1))))
;; Compiles OK
(defun getval (x) (cdr x))
(defun test3 ()
(let ((alist (list (cons "foo" 1) (cons "bar" 2))))
(dolist (x alist)
(when (getval x)
(equal (getval x) (alist-get (car x) alist))))))
;; Warning: value returned from (cdr x) is unused
(defun test2 ()
(let ((alist (list (cons "foo" 1) (cons "bar" 2))))
(dolist (x alist)
(when (cdr x)
(equal (cdr x) (alist-get (car x) alist))))))
--8<-----------------------------cut here---------------end--------------->8---
emacs -Q
M-x byte-compile-file /tmp/test.el RET
I got a warning from test2 func:
Warning: value returned from (cdr x) is unused
But the value is used as the `when' condition, and as `equal'
1st argument.
In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
of 2017-08-16
Repository revision: 3305dec5387021791eb09a93df5ab784b2297dc8
next reply other threads:[~2017-08-16 6:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 6:11 Tino Calancha [this message]
2017-08-17 16:39 ` bug#28107: 26.0.50; Byte compilation shows an unused var warning for an used variable Glenn Morris
2017-08-17 16:45 ` Glenn Morris
2017-08-17 17:32 ` Tino Calancha
2017-08-18 1:42 ` Glenn Morris
2019-06-12 15:03 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d17wyrbw.fsf@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=28107@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.